MCP server for Swiss federal law (Fedlex) — search the SR, monitor legal changes, and query BBl/treaties via Claude Desktop or Claude.ai
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
claude mcp add fedlex-mcp -- uvx fedlex-mcp{
"mcpServers": {
"fedlex-mcp": {
"command": "uvx",
"args": ["fedlex-mcp"]
}
}
}MCP Servers overview
> :switzerland: **Part of the [Swiss Public Data MCP Portfolio](https://github.com/malkreide)**
# :balance_scale: fedlex-mcp

[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
[](https://modelcontextprotocol.io/)
[](https://github.com/malkreide/fedlex-mcp)

> MCP Server for Swiss federal law, consultations & official terminology — search the SR, monitor consultation deadlines, and translate terms across the national languages via Claude Desktop or Claude.ai
[:de: Deutsche Version](README.de.md)
---
## Overview
`fedlex-mcp` connects AI assistants (Claude) with three official Swiss SPARQL data sources:
1. **Federal law** via the **Fedlex SPARQL endpoint** — the Systematic Compilation (SR), Official Compilation (AS), Federal Gazette (BBl) and treaties.
2. **Consultations (Vernehmlassungen)** via the *same* Fedlex endpoint (`jolux:Consultation`) — the pre-parliamentary phase in which anyone can comment on a draft.
3. **TERMDAT**, the Federal Chancellery's terminology database, via the **LINDAS SPARQL endpoint** — official term equivalents across de/fr/it/rm/en.
All three are SPARQL-based, which is exactly why they live in one server rather than three: no new technology stack, only new queries against known patterns.
**Metaphor:** USB-C for federal law. *Fedlex tells you what you have to respond to. TERMDAT tells you what it is called in the other national languages.*
---
## Features
- :balance_scale: **12 tools, 2 resources** across federal law, consultations and terminology
- :mag: **SPARQL-powered** — two isolated endpoints (Fedlex + LINDAS), no shared failure mode
- :globe_with_meridians: **5 languages** — German, French, Italian, Romansh, plus English for terminology
- :unlock: **No API key required** — all data under open reuse licences
- :cloud: **Dual transport** — stdio (Claude Desktop) + Streamable HTTP (cloud)
---
## Anchor demo query
> *"Which education-related consultations are currently open, until when does the deadline run, which office is in charge — and what are the key technical terms in French and Italian for the response?"*
A single conversation chains three tools across two endpoints:
```
fedlex_get_open_consultations(topic="education")
→ fedlex_get_consultation(event_id="proj/2026/71/cons_1")
→ termdat_lookup_term(term="Volksschule", target_languages=["fr","it"])
```
Every open consultation carries `deadline`, `days_remaining` (computed at
request time in Europe/Zurich, `0` = deadline is today) and a **derived**
`status` — an expired consultation never shows up as running. Fedlex says
*what* you must respond to and *by when*; TERMDAT says *how to name it* in the
other national languages.
> **Use `topic="education"`, not `keyword="Volksschule"`.** Fedlex consultations
> have no subject taxonomy — filtering is free-text over the title, and the word
> "Volksschule" appears in **zero** consultation titles. The `topic` filter
> expands to a disclosed keyword union (Bildung, Schule, Berufsbildung,
> Hochschule, …) and reports exactly which terms it searched.
---
## Prerequisites
- Python 3.11+
- [uv](https://github.com/astral-sh/uv) (recommended) or pip
---
<!-- BEGIN GENERATED: install -->
## Installation
Run via [`uv`](https://docs.astral.sh/uv/)'s `uvx` — no clone or manual install needed. Add to your MCP client config (`mcpServers` for Claude Desktop, Cursor and Windsurf; use a top-level `servers` key for VS Code in `.vscode/mcp.json`):
```json
{
"mcpServers": {
"fedlex-mcp": {
"command": "uvx",
"args": [
"fedlex-mcp"
]
}
}
}
```
<!-- END GENERATED: install -->
---
## Installation from source
```bash
# Clone the repository
git clone https://github.com/malkreide/fedlex-mcp.git
cd fedlex-mcp
# Install
pip install -e .
# or with uv:
uv pip install -e .
```
Or with `uvx` (no permanent installation):
```bash
uvx fedlex-mcp
```
---
## Quickstart
```bash
# stdio (for Claude Desktop)
python -m fedlex_mcp.server
# Streamable HTTP (port 8000)
python -m fedlex_mcp.server --http --port 8000
```
Try it immediately in Claude Desktop:
> *"Show me all valid federal laws on vocational training"*
> *"What does the Data Protection Act say? Is it still in force?"*
> *"Which consultations on education are open right now, and until when?"*
> *"What is 'Volksschule' called in French and Italian in official terminology?"*
---
## Configuration
### Claude Desktop
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
```json
{
"mcpServers": {
"fedlex": {
"command": "python",
"args": ["-m", "fedlex_mcp.server"]
}
}
}
```
Or with `uvx`:
```json
{
"mcpServers": {
"fedlex": {
"command": "uvx",
"args": ["fedlex-mcp"]
}
}
}
```
**Config file locations:**
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
### Cloud Deployment (SSE for browser access)
For use via **claude.ai in the browser** (e.g. on managed workstations without local software):
**Render.com (recommended):**
1. Push/fork the repository to GitHub
2. On [render.com](https://render.com): New Web Service -> connect GitHub repo
3. Set start command: `python -m fedlex_mcp.server --http --port 8000`
4. In claude.ai under Settings -> MCP Servers, add: `https://your-app.onrender.com/sse`
> *"stdio for the developer laptop, SSE for the browser."*
---
## Demo

---
## Available Tools
| # | Tool | Source | Description |
|---|------|--------|-------------|
| 1 | `fedlex_search_laws` | Fedlex | Search the Systematic Compilation (SR) by keyword in title |
| 2 | `fedlex_get_law_by_sr` | Fedlex | Get a law by its SR number (e.g. `235.1` = Data Protection Act) |
| 3 | `fedlex_get_recent_publications` | Fedlex | Latest publications from the Official Compilation (AS) |
| 4 | `fedlex_get_upcoming_changes` | Fedlex | Laws entering into force soon (legal monitoring) |
| 5 | `fedlex_search_gazette` | Fedlex | Search the Federal Gazette (BBl) |
| 6 | `fedlex_get_law_history` | Fedlex | All versions of a law (version history) |
| 7 | `fedlex_search_treaties` | Fedlex | International treaties (SR numbers starting with `0.`) |
| 8 | `fedlex_get_open_consultations` | Fedlex | **Deadline monitoring** — open consultations (`eventEndDate >= today`, Europe/Zurich); each with `days_remaining` + derived `status`, sorted by shortest deadline; optional `topic`/`keyword` |
| 9 | `fedlex_search_consultations` | Fedlex | Full-text search over consultation title/description, with filters (topic, status, deadline range, office) |
| 10 | `fedlex_get_consultation` | Fedlex | Detail for one `eventId`: deadline, `days_remaining`, office, derived status, documents |
| 11 | `termdat_lookup_term` | LINDAS | Term → equivalents in de/fr/it/rm/en incl. definition |
| 12 | `termdat_get_concept` | LINDAS | Full TERMDAT entry for a URI or ID |
### Example Use Cases
| Query | Tool |
|-------|------|
| *"Show me all valid federal laws on vocational training"* | `fedlex_search_laws` |
| *"What does the Data Protection Act say?"* | `fedlex_get_law_by_sr` |
| *"Which laws enter into force in the next 3 months?"* | `fedlex_get_upcoming_changes` |
| *"Show me the version history of the DSG"* | `fedlex_get_law_history` |
| *"Which consultations on education are open, and until when?"* | `fedlex_get_open_consultations` |
| *"Find closed consultations about the language act"* | `fedlex_search_consultations` |
| *"Give me the full detail and documents for consultation proj/2026/71/cons_1"* | `fedlex_get_consultation` |
| *"What is 'Volksschule' called in French and Italian?"* | `termdat_lookup_term` |
| *"Show the full TERMDAT entry 40109"* | `termdat_get_concept` |
→ More use cases by audience →
---
## Architecture
Two isolated SPARQL endpoints behind one server. Separate httpx clients and
timeouts mean a LINDAS outage never breaks the `fedlex_*` tools, and vice versa.
```
+-------------------+ +------------------------------+ +--------------------------+
| Claude / AI |---->| Fedlex MCP |---->| Fedlex SPARQL Endpoint |
| (MCP Host) |<----| (MCP Server) |<----| fedlex.data.admin.ch |
+-------------------+ | | | (law + consultations) |
| 12 Tools . 2 Resources | +--------------------------+
| Stdio | SSE |
| | +--------------------------+
| Isolated clients: |---->| LINDAS SPARQL Endpoint |
| - Fedlex (law + cons.) |<----| lindas.admin.ch/query |
| - LINDAS (TERMDAT) | | (fch/termdat, TERMDAT) |
| | +--------------------------+
| No authentication required |
+------------------------------+
```
### Data Model
**JOLux Ontology — federal law (Fedlex)**
```
jolux:ConsolidationAbstract <- SR entry
+-- jolux:isRealizedBy -> jolux:Expression (URI ends in /de, /fr, /it, /rm)
+-- jolux:title "Federal Act of 19 June 1992 on Data Protection"
+-- jolux:titleShort "DSG"
+-- jolux:historicalLegalId "235.What people ask about fedlex-mcp
What is malkreide/fedlex-mcp?
+
malkreide/fedlex-mcp is mcp servers for the Claude AI ecosystem. MCP server for Swiss federal law (Fedlex) — search the SR, monitor legal changes, and query BBl/treaties via Claude Desktop or Claude.ai It has 2 GitHub stars and was last updated today.
How do I install fedlex-mcp?
+
You can install fedlex-mcp by cloning the repository (https://github.com/malkreide/fedlex-mcp) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is malkreide/fedlex-mcp safe to use?
+
Our security agent has analyzed malkreide/fedlex-mcp and assigned a Trust Score of 87/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains malkreide/fedlex-mcp?
+
malkreide/fedlex-mcp is maintained by malkreide. The last recorded GitHub activity is from today, with 0 open issues.
Are there alternatives to fedlex-mcp?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy fedlex-mcp to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/malkreide-fedlex-mcp)<a href="https://claudewave.com/repo/malkreide-fedlex-mcp"><img src="https://claudewave.com/api/badge/malkreide-fedlex-mcp" alt="Featured on ClaudeWave: malkreide/fedlex-mcp" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!