CourtListener MCP adapter with citation parser and fixture tests
Gadoes adds the CourtListener connector for federal and state caselaw in the United States: config builder, key validator, tool definitions, system prompt, two JSON fixtures, and 19 tests covering both citation parsing and a mock-MCP round trip.
The whole thing lives in backend/src/lib/mcp/servers/courtlistener.ts - a single file exporting buildCourtListenerConfig, isValidCourtListenerKey, COURTLISTENER_TOOLS, and COURTLISTENER_SYSTEM_PROMPT. Key validation is simple: non-null, non-empty, non-whitespace string.
The fixture pair in backend/src/__fixtures__/courtlistener/ covers a three-result search response (including a SCOTUS opinion, a D.C. Circuit case, and an S.D.N.Y. case) and an empty-results response. Tests confirm citation parsing maps case names to title, CourtListener opinion IDs to source_id, URLs to courtlistener.com paths, and snippets to excerpt. The mock-MCP integration test uses the InMemoryTransport-based mock server from Chunk 2 to exercise the config without spawning a child process.
The buildCourtListenerConfig/isValidXKey/X_TOOLS/X_SYSTEM_PROMPT shape is the template all later per-source adapters follow. If you're adding your own sources, start here.
Spotted something wrong? Or know the PR text has fresher detail than the writeup above?