@cyanheads/eur-lex-mcp-server
Public Hosted Server: https://eur-lex.caseyjhand.com/mcp
Tools
Seven tools covering EU legal research — document discovery, content retrieval, citation resolution, case law, relationship graph traversal, EuroVoc thesaurus lookup, and raw SPARQL access:
Tool | Description |
| 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. |
| Fetch structured metadata and full text (HTML, Markdown, or Formex4 XML) for a work by CELEX number, ELI URI, or CELLAR work URI. |
| Resolve an EU legal citation — a CELEX number or an ELI URI — to the canonical CELLAR work. |
| Search CJEU and General Court case law — judgments, orders, and Advocate General opinions — by case number, party name, subject, or date range. |
| Traverse the CELLAR relationship graph: amendment chain, consolidated versions, legal basis, citation network, and national transposition measures. |
| Search the EuroVoc multilingual thesaurus to resolve human-readable terms to EuroVoc concept IDs — required before using the |
| 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. |
eurlex_search_documents
Search EU legislation, treaties, preparatory acts, and more across the 2.7M+ work CELLAR corpus.
Keyword search across work titles and CELEX string patterns
Filter by document category (
REG,DIR,DEC,TREATY, and more), with each category expanding to its reviewed CELLAR authority familyOptionally include consolidated texts whose basic act belongs to the selected category
Date range filtering (
date_from,date_to)EuroVoc concept filtering — use
eurlex_browse_subjectsfirst to resolve concept IDsFilter to in-force acts only
Pagination via
offsetand configurablelimit(max 100)Returns CELEX numbers, work URIs, document types, and dates for chaining into
eurlex_get_document
eurlex_get_document
Fetch the notice and full text of an EU legal act.
Accepts CELEX numbers (e.g.,
32016R0679), ELI URIs, or CELLAR work URIsReturns structured metadata: title, date, document type, author institution, legal basis, EuroVoc subjects, in-force flag
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)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 includecontent_chars_total,content_offset,content_chars_returned, andhas_more, so repeated paged calls can reconstruct the complete body without loss;"metadata_only"skips the body, while structural outline/selection behavior is unchangedNavigate structure instead of raw offsets:
outline: truereturns the act's chapters, articles, annexes, and recitals as a heading list (each with its character offset), andselect(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)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
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
Older acts and some CJEU judgments may lack English translations
eurlex_lookup_celex
Resolve EU legal identifiers to canonical CELLAR works.
Accepts CELEX numbers and ELI URIs
Auto-detects format with
identifier_type: "auto"(default); set explicitly when auto-detection failsReturns work URI, confirmed CELEX number, document type, and date — the prerequisite step before
eurlex_get_documentoreurlex_get_relations
eurlex_get_cases
Search CJEU and General Court case law.
Case-specific search: case number, keyword, court (
CJEUorGC), and case type (judgment,order,ag_opinion)Date range filtering
Primary records only by default — derivative information notices, abstracts, and summaries are excluded; set
include_derivativeto include themReturns case identifier, court, date, document type, and parties
Distinct from
eurlex_search_documents— case law (CELEX sector 6) has its own search parameters and practitioner workflows
eurlex_get_relations
Traverse the CELLAR relationship graph for a given work.
Amendment chain (what amends it, what it amends)
Consolidated versions (the current in-force text)
Legal basis
Citation network (
cdm:work_cites_workin both directions)National transposition measures
Filter to specific relation types or retrieve all at once
Returns one-hop relations; multi-hop traversal requires multiple calls or
eurlex_query_sparql
eurlex_browse_subjects
Resolve human-readable terms to EuroVoc concept IDs.
Full-text search across the multilingual EuroVoc thesaurus
Returns concept URI, preferred label, concept code, and broader/narrower hierarchy hints
Supports all EU official languages; defaults to English
Required before using the
eurovoc_conceptfilter ineurlex_search_documents
Resources and prompts
Type | Name | Description |
Resource |
| Metadata snapshot for a CELLAR work — type, date, title, author institution, in-force flag |
Resource |
| Relationship summary for a work: amendment chain, consolidations, legal basis, cited-by count |
Prompt |
| Frames a comparative legal analysis across EU and US law for a given policy domain |
All resource data is also reachable via tools. Resources provide stable-URI injectable context for agents that support MCP resources.
Features
Built on @cyanheads/mcp-ts-core:
Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
Unified error handling — handlers throw, framework catches, classifies, and formats
Pluggable auth:
none,jwt,oauthSwappable storage backends:
in-memory,filesystem,Supabase,Cloudflare KV/R2/D1Structured logging with optional OpenTelemetry tracing
STDIO and Streamable HTTP transports
MCP 2026-07-28 support, exact tool-input validation, and structured error envelopes clients can act on
EUR-Lex-specific:
No API key required — both CELLAR SPARQL and EUR-Lex REST content endpoints are publicly accessible
CellarSparqlServicePOSTsapplication/x-www-form-urlencodedSPARQL with CDM prefix declarations built in; server-side LIMIT enforcement (max 100) prevents Virtuoso timeout abuseEurLexContentServicefetches act text from the CELLAR content-negotiation resolver (/resource/celex/{CELEX}withAccept/Accept-Languageheaders); HTML and Formex4 XML pass through, Markdown is converted server-side from the HTML bodyVirtuoso error classification: HTTP 200 with
Virtuoso 37000 Errorbody is parsed and re-raised asServiceUnavailable(transient/timeout) orInvalidParams(syntax error)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_statusand a typed unavailability cause, while a WAF challenge remains a typedcontent_challengeerrorTyped error contracts on every tool — structured
reasoncodes let agents branch on outcomes without parsing text
Agent-friendly output:
EuroVoc prerequisite guidance in server-level instructions — agents are directed to
eurlex_browse_subjectsbefore attempting concept-filtered searcheseurlex_lookup_celexsurfaces CELEX confirmation and work existence upfront, preventing downstream errors in document or relation fetchescontent_status,content_unavailability_reason, and requested/effective language fields let agents distinguish skipped, available, absent, upstream-failed, and incomplete multipart content without string parsingRelationship graph output carries relation type labels alongside CELLAR URIs and resolved CELEX numbers for human-readable downstream use
Getting started
Public Hosted Instance
A public instance is available at https://eur-lex.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"eur-lex-mcp-server": {
"type": "streamable-http",
"url": "https://eur-lex.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file. No API key is required.
{
"mcpServers": {
"eur-lex-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/eur-lex-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"eur-lex-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/eur-lex-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with Docker:
{
"mcpServers": {
"eur-lex-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/eur-lex-mcp-server:latest"
]
}
}
}For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
Bun v1.4.0 or higher (or Node.js v24+).
No API key needed — EUR-Lex and CELLAR are publicly accessible.
Installation
Clone the repository:
git clone https://github.com/cyanheads/eur-lex-mcp-server.gitNavigate into the directory:
cd eur-lex-mcp-serverInstall dependencies:
bun installConfigure environment (optional):
cp .env.example .env
# All server-specific vars have sensible defaults — no required varsConfiguration
All configuration is validated at startup via Zod schemas in src/config/server-config.ts.
Variable | Description | Default |
| CELLAR SPARQL endpoint URL override (e.g., for a local Virtuoso mirror). |
|
| EU Publications Office CELLAR content resolver base URL override. |
|
| Client-side timeout for SPARQL requests in milliseconds. |
|
| Enforced ceiling on LIMIT in all generated SPARQL queries. |
|
| Transport: |
|
| Port for HTTP server. |
|
| Auth mode: |
|
| Session handling: |
|
| Log level (RFC 5424). |
|
| Directory for log files (Node.js only). |
|
| Enable OpenTelemetry instrumentation. |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
Build and run:
# One-time build bun run rebuild # Run the built server bun run start:stdio # or bun run start:httpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t eur-lex-mcp-server .
docker run --rm -p 3010:3010 eur-lex-mcp-serverThe 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.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing and validation with Zod. |
| CELLAR SPARQL service — POST client, binding mapper, LIMIT enforcement, CDM PREFIX declarations. |
| CELLAR content service — content-negotiation GET client for |
| Tool definitions ( |
| Resource definitions ( |
| Prompt definitions ( |
| Unit and integration tests mirroring |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageRegister new tools and resources via the barrels in
src/mcp-server/*/definitions/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/eur-lex-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server