EU law · 24 official languagesArticle-level JSON · typed citation graphMCP server · Claude, Cursor, VS CodeSDKs · Python, TypeScriptFree plan · 500 credits to start
Brussels · CET
Vol. II·Section M — Model Context Protocol
@lexapi/mcp · MIT · Node 20+

§ MCP server — For Claude, Cursor & VS Code

An MCP server
for EU law.

LexAPI's MCP server gives Claude, Cursor, VS Code and other MCP clients that accept an API key direct access to EU law — search, fetch articles, follow citations — with your LexAPI key.

26 tools over EUR-Lex legislation, Court of Justice case law and the Official Journal, as an npm package that runs locally or a hosted endpoint at mcp.lex-api.com.

§ 01 — Setup

Running in a minute.

Same key and credit pool as the REST API

claude_desktop_config.json (Settings → Developer → Edit Config), then restart Claude

{
  "mcpServers": {
    "lexapi": {
      "command": "npx",
      "args": ["-y", "@lexapi/mcp"],
      "env": { "LEXAPI_API_KEY": "lex_your_key" }
    }
  }
}

npm: @lexapi/mcp·source: Lex-API/lexapi-mcp·MCP Registry: io.github.Lex-API/lexapi-mcp

  1. N° 01

    Get a key

    Create a free account and an API key in your dashboard. No credit card.

  2. N° 02

    Add the server

    Paste the snippet for your client and replace lex_your_key with your key. The npm package needs Node.js 20+; the hosted endpoint needs nothing installed.

  3. N° 03

    Ask

    Ask about EU law in plain language. The model picks the tools; every tool description states its credit cost.

Claude Desktop

Add your API key to claude_desktop_config.json

Claude Desktop runs the npm package on your machine and passes your key to it from its config file. Open the file from Settings → Developer → Edit Config, or find it at:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add the lexapi entry under mcpServers (inside the existing object if the file already has one) and replace lex_your_key with your key: the package reads it from LEXAPI_API_KEY and does not start without it. Save the file and restart Claude Desktop.

{
  "mcpServers": {
    "lexapi": {
      "command": "npx",
      "args": ["-y", "@lexapi/mcp"],
      "env": { "LEXAPI_API_KEY": "lex_your_key" }
    }
  }
}

The key sits in plain text in this file: use a key just for Claude Desktop, and revoke it from your dashboard if the file is ever shared or exposed.

§ 02 — What it can do

26 tools, six groups.

Read-only mode (LEXAPI_MCP_READ_ONLY=true) hides the five that write: 21 remain

Group & useTools
SearchKeyword search over EUR-Lex with filters, and the latest publications.lex_search, lex_recent_documents
DocumentsFull text and metadata by CELEX number or EUR-Lex URL, batches, version history, bulk export.lex_get_document, lex_get_documents_batch, lex_get_metadata, lex_get_document_by_url, lex_resolve, lex_document_versions, lex_get_document_version, lex_export
CitationsWhat an act cites and what cites it, typed (amends, repeals, legal basis…), paths and related acts.lex_cites, lex_cited_by, lex_citation_network, lex_citation_path, lex_related, lex_citation_stats, lex_extract_citations
Semantic searchSearch legislation at article level and CJEU case law by meaning, not keywords.lex_semantic_legislation, lex_semantic_case_law
WebhooksNotifications for new documents matching a search or a watch list of acts (paid plans).lex_list_webhooks, lex_get_webhook, lex_create_webhook, lex_update_webhook, lex_delete_webhook, lex_test_webhook
AccountYour plan and remaining credits.lex_info

Each tool calls the REST endpoint it wraps and returns what that endpoint returns — documents with their CELEX numbers, article text and typed citation links. Plan gates apply as over REST: lex_export needs Business or above, webhooks need a paid plan, semantic search works on every credit plan, Free included.

§ 03 — Try asking

Questions it answers with sources.

The tools each prompt typically calls are listed under it

N° 01

“Find the GDPR articles on data portability and summarise the obligations, citing each article.”

lex_semantic_legislation · lex_get_document
N° 02

“Find Court of Justice judgments on automated decision-making under the GDPR and give me each case name, CELEX number and holding.”

lex_semantic_case_law · lex_get_document
N° 03

“What did the Capital Requirements Regulation say about own funds requirements on 1 June 2019?”

lex_semantic_legislation · lex_document_versions
N° 04

“Map the citation network around the NIS2 Directive: what it amends, what it repeals and which acts cite it.”

lex_citation_network · lex_cites · lex_cited_by
N° 05

“List the EU regulations published on EUR-Lex this week and flag anything on sustainability reporting.”

lex_recent_documents · lex_search
N° 06

“Compare how the Digital Services Act and the Digital Markets Act define the platforms they regulate, quoting the definition articles.”

lex_search · lex_get_document

§ 04 — Pricing

MCP calls draw on the same monthly credit pool as REST calls, at the same price — a search page 3 credits, a document 5 or less, a semantic search 5. The Free plan starts with 500 credits, then 150 a month; no credit card.

§ 05 — FAQ

Asked &
answered.

The full reference — every tool, auth, errors and costs — is in the MCP docs.

N° 01Is there an MCP server for EU law?+
Yes. LexAPI publishes one: @lexapi/mcp on npm (MIT-licensed, source at github.com/Lex-API/lexapi-mcp, listed in the MCP Registry as io.github.Lex-API/lexapi-mcp), plus a hosted version at https://mcp.lex-api.com/v1. Its 26 tools search EUR-Lex, fetch legislation and CJEU judgments by CELEX number, return point-in-time versions and walk the citation graph.
N° 02Which AI clients does it work with? Does it work with ChatGPT?+
Any MCP client that can run a local stdio server, or connect to a Streamable HTTP server with an API key in a header: Claude Desktop, Claude Code, Cursor and VS Code among them. Clients that add remote servers only through an OAuth sign-in, such as claude.ai custom connectors, need that sign-in on the hosted LexAPI server; the MCP docs say whether it is available. LexAPI does not document ChatGPT as a supported client.
N° 03Is it free?+
The server itself is free and open source. Its tools call the LexAPI API with your key, and each call is billed from your monthly credit pool exactly like the REST endpoint it wraps. The FREE plan starts with 500 credits, then 150 a month, with semantic search included and no credit card required; paid plans start at €15 a month.
N° 04Which data sources does it use?+
EU law from the EU’s own publishers: EUR-Lex legislation and treaties, Court of Justice case law and the Official Journal. LexAPI keeps its own EU-hosted mirror of the corpus from 2010 onward, updated hourly; a document that is not in the mirror yet is fetched from the Publications Office (Cellar) or EUR-Lex on first request.
N° 05Does it hallucinate citations?+
The tools do not generate text. They return the documents themselves — titles, CELEX numbers, article text and citation links taken from EUR-Lex — so the model can quote and link real sources. The model writing the answer can still misread or misquote them: LexAPI grounds the answer, it does not guarantee it. Check the cited CELEX numbers against the source before you rely on them.
N° 06Where do I put my LexAPI API key for Claude Desktop?+
In claude_desktop_config.json: add a lexapi entry under mcpServers that runs npx -y @lexapi/mcp, with your key in its env block as LEXAPI_API_KEY, the variable the package reads. Open the file from Settings → Developer → Edit Config in Claude Desktop; it lives at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows. Save it and restart Claude Desktop. The key is stored in plain text in that file, so use a dedicated key and revoke it from your dashboard if the file is ever exposed.
N° 07Do I need to install anything?+
No, if your client supports remote servers: point it at https://mcp.lex-api.com/v1 with your API key as a Bearer header. The npm package runs locally instead (Node.js 20 or later) and adds a read-only mode that hides the five tools that write.