EU law as tools your AI agent can call.
Connect an agent to EU law over the Model Context Protocol, or call the REST API from your own tool loop: legislation by article, Court of Justice case law, citations and semantic search, with the identifiers to cite each source.
The free plan starts with 500 credits, no card. Your API key is on the dashboard once you confirm your email.
Nothing to install.
- Run this in your terminal.
- In Claude Code, run
/mcp, chooselexapi, then Authenticate. Sign in to LexAPI in the browser and approve. - Ask: Using LexAPI, quote Article 17 of the GDPR (CELEX 32016R0679) and cite it.
claude mcp add --transport http lexapi https://mcp.lex-api.com/v1
An agent without a browser signs in with an API key instead:
claude mcp add --transport http lexapi https://mcp.lex-api.com/v1 --header "Authorization: Bearer lex_your_key"
The server is at https://mcp.lex-api.com/v1 (Streamable HTTP) and serves 37 tools. Tool calls use your plan’s credits at the price of the REST call they wrap, and each tool description states that price, so the model can see it.
The npm package, over stdio.
@lexapi/mcp runs on your machine and serves the same tools. Claude Code:
claude mcp add lexapi --env LEXAPI_API_KEY=lex_your_key -- npx -y @lexapi/mcp
Claude Desktop, Cursor and other stdio clients take the same command as JSON:
mcpServers config{
"mcpServers": {
"lexapi": {
"command": "npx",
"args": ["-y", "@lexapi/mcp"],
"env": { "LEXAPI_API_KEY": "lex_your_key" }
}
}
}For an agent that should only read, set LEXAPI_MCP_READ_ONLY=true in the package’s environment. It hides the tools that write: lex_extract_citations, lex_create_webhook, lex_update_webhook, lex_delete_webhook, lex_test_webhook.
Find, read, cite.
These tools cover the loop an agent runs to answer from EU law. Each wraps one REST route and is billed like it.
| Tool | What it does | REST route | Credits |
|---|---|---|---|
lex_semantic_legislation | Find articles of EU legislation by meaning | POST /legislation/semantic | 5 |
lex_semantic_case_law | Find Court of Justice case law by meaning | POST /search/semantic | 5 |
lex_resolve | Turn an ECLI, an ELI or a EUR-Lex link into a CELEX number | POST /resolve | 1 |
lex_get_document | Read a document, or one article of it | POST /documentContent | 1 / 4 / 5 |
lex_cited_by | List what cites, amends or corrects a document | GET /citations/cited-by/:celexNumber | 1 |
lex_cites | List what a document cites | GET /citations/cites/:celexNumber | 1 |
lex_info | Check the plan and the credits left | GET /info | 0 |
A document read costs 1 credit when LexAPI already holds the document, 4 or 5 when it is fetched from the source first.
Prompts to try
- Using LexAPI, find the GDPR article on the right to erasure, quote it and cite it by CELEX number and article.Typically uses
lex_semantic_legislation,lex_get_document. - Using LexAPI, find Court of Justice judgments on transfers of personal data to third countries and give each case number, ECLI and CELEX number.Typically uses
lex_semantic_case_law,lex_resolve. - Using LexAPI, list what has corrected or amended Regulation (EU) 2016/679 since it was published.Typically uses
lex_cited_by.
Your own tool loop.
An agent that defines its own tools calls the same routes directly, with the key in the x-api-key header. This call is free: it returns your plan and the credits left, so an agent can check its budget before it starts.
curl "https://lex-api.com/api/v1/info" \ -H "x-api-key: lex_your_key"
{
"service": "LexAPI",
"subscription": { "tier": "PROFESSIONAL", "pricingMode": "credits", … },
"credits": { "operation_weight": 0, "remaining": 149898, "resetsAt": "2026-12-17T18:09:15.340Z", … },
…
}- On a credit plan the response to a metered call carries
credits.operation_weight, what the call cost, andcredits.remaining. - A pool that cannot cover a call answers 402; more requests in a minute than the plan allows (15 on the free plan) answer 429 with a
Retry-Afterheader. - The official SDKs wrap the same routes:
pip install lexapi-clientfor Python andnpm install @lexapi/clientfor TypeScript.
Worked requests, with curl, Python and TypeScript: European legal RAG, GDPR API and European case law API.
Your framework, your AI app.
One account and a single credit pool cover all of these. Every call is billed like the REST call it makes.
| Where | How |
|---|---|
| Claude (claude.ai, Desktop, mobile) | Listed in Claude’s Connectors Directory: connect it and sign in to LexAPI. |
| Claude Code, Cursor, VS Code | The hosted MCP server, or the npm package over stdio. |
| LangChain and LangGraph | langchain-lexapi: retrievers and agent tools. |
| LlamaIndex | Retrievers and a tool spec for agents. |
| Your own tool loop | The REST API, or the Python client. |
Asked & answered.
N° 01How do I connect Claude or Cursor to EU law?+
N° 02How does the LexAPI MCP server authenticate?+
N° 03Can I stop an agent from creating or deleting webhooks?+
N° 04Does an agent need MCP to use LexAPI?+
Keep building.
- GDPR APIRead the GDPR by article or recital, cite it, and list what corrects or amends it.
- European case law APISearch Court of Justice case law by meaning, resolve an ECLI, read the judgment.
- European legal RAGSemantic search to article text with provenance, citations and the text for a date.
- QuickstartA first request by curl, MCP, Python and TypeScript.
- API referenceEvery endpoint, parameter, response field and error.
- MCP serverSetup for Claude, Cursor and VS Code, and the tool list.
- PricingPlans, credit pools and what each call costs.
LexAPI returns source texts and their identifiers. It does not assess compliance and gives no legal advice.