Fedlex MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Fedlex MCP Server — Swiss Federal Law for Claude
An MCP server that gives Claude access to Swiss federal law via the Fedlex platform.
What it does
The server exposes 5 tools:
Tool | What it does | Data source |
| Find laws by keyword in their title | SPARQL → metadata |
| Get detailed info about a specific law | SPARQL → metadata |
| Fetch the actual text (or a specific article) | SPARQL → URL → HTTP fetch HTML |
| Show version history of a law | SPARQL → metadata |
| Navigate the SR classification tree | SPARQL → vocabulary |
How the Fedlex API works (the two layers)
┌─────────────────────────────────────────────────────────────┐
│ Layer 1: SPARQL endpoint │
│ https://fedlex.data.admin.ch/sparqlendpoint │
│ │
│ Contains: METADATA │
│ - Which laws exist (ConsolidationAbstract) │
│ - Titles, SR numbers, dates, taxonomy │
│ - Links between acts (amendments, basic acts) │
│ - Version history (Consolidation entries) │
│ - FRBR chain → URLs to actual documents │
│ │
│ Does NOT contain: the actual law text │
└──────────────────────┬──────────────────────────────────────┘
│ follow URL from metadata
▼
┌─────────────────────────────────────────────────────────────┐
│ Layer 2: Document files │
│ https://www.fedlex.admin.ch/eli/cc/... │
│ │
│ Contains: ACTUAL TEXT │
│ - HTML, PDF, XML (Akoma Ntoso) versions │
│ - The real law content │
└─────────────────────────────────────────────────────────────┘The search_laws and get_law_metadata tools only use Layer 1.
The get_law_text tool uses both: first SPARQL to find the URL, then HTTP to fetch the text.
Related MCP server: Swiss Case Law Open Dataset MCP
Setup
1. Install dependencies
cd fedlex-mcp
pip install -r requirements.txt2. Test it works
python -c "
from fedlex_client import search_laws
results = search_laws('Raumplanung')
for r in results:
print(f\"{r['title']} — {r['url']}\")
"3. Add to Claude Desktop
Edit your claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"fedlex": {
"command": "python3",
"args": ["/ABSOLUTE/PATH/TO/fedlex-mcp/server.py"]
}
}
}Replace /ABSOLUTE/PATH/TO/ with the actual path on your machine.
Restart Claude Desktop. You should see the Fedlex tools in the connector menu.
4. (Optional) Run as remote server for Cowork
If you want to share this with your team or use it via Cowork as a remote connector:
python server.py --transport sseThen add the URL (e.g. http://localhost:8000/sse) in Claude Desktop under
Settings → Connectors → Add custom connector.
Note: For remote/Cowork, you'll want to deploy this behind HTTPS (e.g. on Cloud Run, Fly.io, or a simple VPS with nginx + Let's Encrypt).
Example conversations
Once connected, you can ask Claude things like:
"Welche Gesetze gibt es zur Raumplanung?"
"Was sagt Art. 22 des Raumplanungsgesetzes?"
"Wann wurde das Umweltschutzgesetz zuletzt geändert?"
"Zeig mir die SR-Klassifikation für Baurecht"
"What does the Swiss federal constitution say about property rights?"
Architecture
Claude ←→ MCP Protocol ←→ server.py ←→ fedlex_client.py
│
├→ SPARQL queries → fedlex.data.admin.ch
└→ HTTP fetch → www.fedlex.admin.chThe MCP server (server.py) defines the tools. The client (fedlex_client.py) handles
the actual SPARQL queries and HTML fetching. This separation makes it easy to test
the client independently or reuse it in other contexts.
Data model (JOLux ontology)
The SPARQL data follows the JOLux ontology with FRBR abstraction levels:
ConsolidationAbstract (= a law in the SR, e.g. "RPG")
│
├── Expression (title in DE/FR/IT/EN)
│
└── Consolidation (= a specific version at a point in time)
│
├── Expression (text in DE/FR/IT/EN)
│ │
│ └── Manifestation (HTML / PDF / XML format)
│ │
│ └── URL (the actual file)
│
└── dateApplicability (when this version applies)Full documentation: https://swiss.github.io/fedlex-jolux/
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Swiss federal law (Fedlex) and political data (LINDAS) for agents, every answer with sources
Search Swiss federal legislation: laws, articles, amendments via the Fedlex SPARQL endpoint.
Temporal search and comparison for official Luxembourg and reviewed EU law, with provenance.
Search U.S. case law, fetch opinions, and ask matter-aware legal questions over your documents.
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP Server for Swiss federal law — search the SR, monitor legal changes, and query BBl/treaties via Claude Desktop or Claude.ai.128,924 PyPI7MIT
- AlicenseNot gradedqualityAmaintenanceEnables LLMs to search and analyze Swiss case law, legislation, and citation networks with 43 tools for decision search, statute lookup, citation graphs, legislative history, and exam question generation.81MIT
- AlicenseAqualityBmaintenanceA connector that gives Claude direct access to the official text of Swiss federal legislation on Fedlex, covering all acts in the Classified Compilation in German, French, and Italian.48MIT
- AlicenseBqualityBmaintenanceProvides read-only access to Swiss legislation and multi-tier court decisions, enabling searches, full-text retrieval as Markdown, court hierarchy listing, and statutory or case-law citation verification across official registries.6MIT