{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/eur-lex-mcp-server</h1>\n  <p><b>Search EU legislation, CJEU case law, and treaties; traverse the CELLAR relationship graph; resolve EuroVoc concepts via MCP. STDIO or Streamable HTTP.</b>\n  <div>7 Tools • 2 Resources • 1 Prompt</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-0.10.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/eur-lex-mcp-server) [![MCP Server](https://img.shields.io/badge/MCP%20Server-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/eur-lex-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/eur-lex-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.0-blueviolet.svg?style=flat-square)](https://bun.sh/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/eur-lex-mcp-server/releases/latest/download/eur-lex-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=eur-lex-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZXVyLWxleC1tY3Atc2VydmVyIl19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22eur-lex-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Feur-lex-mcp-server%22%5D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n</div>\n\n<div align=\"center\">\n\n**Public Hosted Server:** [https://eur-lex.caseyjhand.com/mcp](https://eur-lex.caseyjhand.com/mcp)\n\n</div>\n\n---\n\n## Tools\n\nSeven tools covering EU legal research — document discovery, content retrieval, citation resolution, case law, relationship graph traversal, EuroVoc thesaurus lookup, and raw SPARQL access:\n\n| Tool | Description |\n|:-----|:------------|\n| `eurlex_search_documents` | Search EU legislation, treaties, and preparatory acts across the CELLAR corpus. Filters by document category, date range, EuroVoc concept, author institution, and in-force status; consolidated texts can be folded in through the selected basic-act family. |\n| `eurlex_get_document` | Fetch structured metadata and full text (HTML, Markdown, or Formex4 XML) for a work by CELEX number, ELI URI, or CELLAR work URI. |\n| `eurlex_lookup_celex` | Resolve an EU legal citation — a CELEX number or an ELI URI — to the canonical CELLAR work. |\n| `eurlex_get_cases` | Search CJEU and General Court case law — judgments, orders, and Advocate General opinions — by case number, party name, subject, or date range. |\n| `eurlex_get_relations` | Traverse the CELLAR relationship graph: amendment chain, consolidated versions, legal basis, citation network, and national transposition measures. |\n| `eurlex_browse_subjects` | Search the EuroVoc multilingual thesaurus to resolve human-readable terms to EuroVoc concept IDs — required before using the `eurovoc_concept` filter in `eurlex_search_documents`. |\n| `eurlex_query_sparql` | Execute a raw SPARQL SELECT query against the CELLAR Virtuoso endpoint. Results capped at 100; use only when curated tools don't cover the needed CDM ontology traversal. |\n\n### `eurlex_search_documents`\n\nSearch EU legislation, treaties, preparatory acts, and more across the 2.7M+ work CELLAR corpus.\n\n- Keyword search across work titles and CELEX string patterns\n- Filter by document category (`REG`, `DIR`, `DEC`, `TREATY`, and more), with each category expanding to its reviewed CELLAR authority family\n- Optionally include consolidated texts whose basic act belongs to the selected category\n- Date range filtering (`date_from`, `date_to`)\n- EuroVoc concept filtering — use `eurlex_browse_subjects` first to resolve concept IDs\n- Filter to in-force acts only\n- Pagination via `offset` and configurable `limit` (max 100)\n- Returns CELEX numbers, work URIs, document types, and dates for chaining into `eurlex_get_document`\n\n---\n\n### `eurlex_get_document`\n\nFetch the notice and full text of an EU legal act.\n\n- Accepts CELEX numbers (e.g., `32016R0679`), ELI URIs, or CELLAR work URIs\n- Returns structured metadata: title, date, document type, author institution, legal basis, EuroVoc subjects, in-force flag\n- Full text in HTML (default), Markdown, or Formex4 XML — `format: \"markdown\"` converts the act body to clean Markdown server-side (recitals and numbered points as readable text, genuine data tables as GFM)\n- Content shaping for large acts: ordinary offset-based `\"paged\"` windows and `\"full\"` windows are capped at 100,000 characters; `content_mode` `\"paged\"` (default) returns the requested character window (`offset` + `limit`), while `\"full\"` returns the first window from offset zero. Both include `content_chars_total`, `content_offset`, `content_chars_returned`, and `has_more`, so repeated paged calls can reconstruct the complete body without loss; `\"metadata_only\"` skips the body, while structural outline/selection behavior is unchanged\n- Navigate structure instead of raw offsets: `outline: true` returns the act's chapters, articles, annexes, and recitals as a heading list (each with its character offset), and `select` (e.g. `{ articles: \"1,5,17\" }`) returns just those sections' text — degrading cleanly to the paging floor for acts with no detectable structure (e.g. case law)\n- Supports the 24 EUR-Lex language codes case-insensitively, normalizes them to uppercase, defaults to English, and automatically falls back to English when a requested translation is unavailable\n- Preserves the exact shaped body in structured output; HTML and XML are shown literally in the text response inside a source-safe tilde fence, while Markdown remains rendered Markdown\n- Older acts and some CJEU judgments may lack English translations\n\n---\n\n### `eurlex_lookup_celex`\n\nResolve EU legal identifiers to canonical CELLAR works.\n\n- Accepts CELEX numbers and ELI URIs\n- Auto-detects format with `identifier_type: \"auto\"` (default); set explicitly when auto-detection fails\n- Returns work URI, confirmed CELEX number, document type, and date — the prerequisite step before `eurlex_get_document` or `eurlex_get_relations`\n\n---\n\n### `eurlex_get_cases`\n\nSearch CJEU and General Court case law.\n\n- Case-specific search: case number, keyword, court (`CJEU` or `GC`), and case type (`judgment`, `order`, `ag_opinion`)\n- Date range filtering\n- Primary records only by default — derivative information notices, abstracts, and summaries are excluded; set `include_derivative` to include them\n- Returns case identifier, court, date, document type, and parties\n- Distinct from `eurlex_search_documents` — case law (CELEX sector 6) has its own search parameters and practitioner workflows\n\n---\n\n### `eurlex_get_relations`\n\nTraverse the CELLAR relationship graph for a given work.\n\n- Amendment chain (what amends it, what it amends)\n- Consolidated versions (the current in-force text)\n- Legal basis\n- Citation network (`cdm:work_cites_work` in both directions)\n- National transposition measures\n- Filter to specific relation types or retrieve all at once\n- Returns one-hop relations; multi-hop traversal requires multiple calls or `eurlex_query_sparql`\n\n---\n\n### `eurlex_browse_subjects`\n\nResolve human-readable terms to EuroVoc concept IDs.\n\n- Full-text search across the multilingual EuroVoc thesaurus\n- Returns concept URI, preferred label, concept code, and broader/narrower hierarchy hints\n- Supports all EU official languages; defaults to English\n- Required before using the `eurovoc_concept` filter in `eurlex_search_documents`\n\n---\n\n## Resources and prompts\n\n| Type | Name | Description |\n|:-----|:-----|:------------|\n| Resource | `eurlex://document/{celexNumber}` | Metadata snapshot for a CELLAR work — type, date, title, author institution, in-force flag |\n| Resource | `eurlex://document/{celexNumber}/relations` | Relationship summary for a work: amendment chain, consolidations, legal basis, cited-by count |\n| Prompt | `eurlex_comparative_analysis` | Frames a comparative legal analysis across EU and US law for a given policy domain |\n\nAll resource data is also reachable via tools. Resources provide stable-URI injectable context for agents that support MCP resources.\n\n---\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):\n\n- Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation\n- Unified error handling — handlers throw, framework catches, classifies, and formats\n- Pluggable auth: `none`, `jwt`, `oauth`\n- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`\n- Structured logging with optional OpenTelemetry tracing\n- STDIO and Streamable HTTP transports\n- MCP 2026-07-28 support, exact tool-input validation, and structured error envelopes clients can act on\n\nEUR-Lex-specific:\n\n- No API key required — both CELLAR SPARQL and EUR-Lex REST content endpoints are publicly accessible\n- `CellarSparqlService` POSTs `application/x-www-form-urlencoded` SPARQL with CDM prefix declarations built in; server-side LIMIT enforcement (max 100) prevents Virtuoso timeout abuse\n- `EurLexContentService` fetches act text from the CELLAR content-negotiation resolver (`/resource/celex/{CELEX}` with `Accept` / `Accept-Language` headers); HTML and Formex4 XML pass through, Markdown is converted server-side from the HTML body\n- Virtuoso error classification: HTTP 200 with `Virtuoso 37000 Error` body is parsed and re-raised as `ServiceUnavailable` (transient/timeout) or `InvalidParams` (syntax error)\n- Language fallback on document fetch: if the requested language is unavailable, retries with English and reports requested/effective language parity; ordinary absence after both attempts remains a successful metadata response with `content_status` and a typed unavailability cause, while a WAF challenge remains a typed `content_challenge` error\n- Typed error contracts on every tool — structured `reason` codes let agents branch on outcomes without parsing text\n\nAgent-friendly output:\n\n- EuroVoc prerequisite guidance in server-level instructions — agents are directed to `eurlex_browse_subjects` before attempting concept-filtered searches\n- `eurlex_lookup_celex` surfaces CELEX confirmation and work existence upfront, preventing downstream errors in document or relation fetches\n- `content_status`, `content_unavailability_reason`, and requested/effective language fields let agents distinguish skipped, available, absent, upstream-failed, and incomplete multipart content without string parsing\n- Relationship graph output carries relation type labels alongside CELLAR URIs and resolved CELEX numbers for human-readable downstream use\n\n---\n\n## Getting started\n\n### Public Hosted Instance\n\nA public instance is available at `https://eur-lex.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"eur-lex-mcp-server\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://eur-lex.caseyjhand.com/mcp\"\n    }\n  }\n}\n```\n\n### Self-Hosted / Local\n\nAdd the following to your MCP client configuration file. No API key is required.\n\n```json\n{\n  \"mcpServers\": {\n    \"eur-lex-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/eur-lex-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"eur-lex-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/eur-lex-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"eur-lex-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"ghcr.io/cyanheads/eur-lex-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\nFor Streamable HTTP, set the transport and start the server:\n\n```sh\nMCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http\n# Server listens at http://localhost:3010/mcp\n```\n\n### Prerequisites\n\n- [Bun v1.4.0](https://bun.sh/) or higher (or Node.js v24+).\n- No API key needed — EUR-Lex and CELLAR are publicly accessible.\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/eur-lex-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd eur-lex-mcp-server\n```\n\n3. **Install dependencies:**\n\n```sh\nbun install\n```\n\n4. **Configure environment (optional):**\n\n```sh\ncp .env.example .env\n# All server-specific vars have sensible defaults — no required vars\n```\n\n---\n\n## Configuration\n\nAll configuration is validated at startup via Zod schemas in `src/config/server-config.ts`.\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `CELLAR_SPARQL_ENDPOINT` | CELLAR SPARQL endpoint URL override (e.g., for a local Virtuoso mirror). | `http://publications.europa.eu/webapi/rdf/sparql` |\n| `EURLEX_CONTENT_BASE_URL` | EU Publications Office CELLAR content resolver base URL override. | `http://publications.europa.eu` |\n| `SPARQL_QUERY_TIMEOUT_MS` | Client-side timeout for SPARQL requests in milliseconds. | `55000` |\n| `MAX_SPARQL_RESULTS` | Enforced ceiling on LIMIT in all generated SPARQL queries. | `100` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_SESSION_MODE` | Session handling: `stateful`, `stateless`, or `auto` (`auto` resolves to stateful). | `stateless` |\n| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |\n| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |\n| `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |\n\nSee [`.env.example`](./.env.example) for the full list of optional overrides.\n\n---\n\n## Running the server\n\n### Local development\n\n- **Build and run:**\n\n  ```sh\n  # One-time build\n  bun run rebuild\n\n  # Run the built server\n  bun run start:stdio\n  # or\n  bun run start:http\n  ```\n\n- **Run checks and tests:**\n\n  ```sh\n  bun run devcheck   # Lint, format, typecheck, security\n  bun run test       # Vitest test suite\n  bun run lint:mcp   # Validate MCP definitions against spec\n  ```\n\n### Docker\n\n```sh\ndocker build -t eur-lex-mcp-server .\ndocker run --rm -p 3010:3010 eur-lex-mcp-server\n```\n\nThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/eur-lex-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.\n\n---\n\n## Project structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/index.ts` | `createApp()` entry point — registers tools, resources, and prompts; initializes services. |\n| `src/config` | Server-specific environment variable parsing and validation with Zod. |\n| `src/services/cellar-sparql` | CELLAR SPARQL service — POST client, binding mapper, LIMIT enforcement, CDM PREFIX declarations. |\n| `src/services/eurlex-content` | CELLAR content service — content-negotiation GET client for `/resource/celex/{CELEX}` (`Accept` / `Accept-Language`) with English language fallback. |\n| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`). Seven tools across document search, retrieval, resolution, case law, relations, EuroVoc, and raw SPARQL. |\n| `src/mcp-server/resources` | Resource definitions (`*.resource.ts`). Metadata and relations resources. |\n| `src/mcp-server/prompts` | Prompt definitions (`*.prompt.ts`). Comparative analysis prompt. |\n| `tests/` | Unit and integration tests mirroring `src/`. |\n\n---\n\n## Development guide\n\nSee [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage\n- Register new tools and resources via the barrels in `src/mcp-server/*/definitions/index.ts`\n- Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields\n\n---\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks and tests before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n---\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 17333,
  "sha": "91bf2e0bb4b1279b4af3260b74c47a7c715fbef68ee6265fa9a2b32b2f8406bc",
  "repo_slug": "cyanheads/eur-lex-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_eur_lex_mcp_server_940254ce/readme"
}