Fedlex Connector
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Fedlex Connectorwhat does art. 1 of the Swiss Civil Code say?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Fedlex Connector
Access Swiss Federal Law from Claude
A connector that gives Claude direct access to the official text of Swiss federal legislation on Fedlex, built on the Model Context Protocol (MCP). Covers all acts in the Classified Compilation (SR, RS) in German, French, and Italian.
Why This Exists
Swiss federal law is published exclusively on Fedlex, but the frontend is a JavaScript single-page application that Claude's built-in web tools cannot render. However, Fedlex exposes two machine-readable interfaces that work without JavaScript:
A SPARQL endpoint (
fedlex.data.admin.ch/sparqlendpoint) for metadata queriesA static HTML filestore (
fedlex.admin.ch/filestore/...) serving consolidated legislation
This MCP server bridges the gap: it queries SPARQL for metadata (RS numbers, consolidation dates, amendment history), fetches and parses the HTML for the actual legislative text, and returns it to Claude in a structured format. No proprietary database, no cache -- just a stateless bridge to Fedlex's open data infrastructure.
Related MCP server: Swiss Data Protection MCP
Setup
The server supports two transports: stdio for local use (Claude Code, Claude Desktop) and HTTP for remote use (claude.ai). You can use one or both.
The server is hosted at:
https://mcp.fedlex-connector.chclaude.ai / Claude Desktop:
Go to claude.ai
Click Customize (Anpassen / Personnaliser / Personalizza) in the sidebar
Click Connectors
Click + → Add connector
Click Add custom connector and paste the URL:
https://mcp.fedlex-connector.ch
We suggest naming it "Fedlex Connector".
Claude Code:
claude mcp add --transport http fedlex https://mcp.fedlex-connector.chOnce connected, Claude can answer questions like "What does art. 1 of the Swiss Civil Code say?" by pulling the text directly from Fedlex.
Deploying Your Own Instance
The server includes a Dockerfile for deploying to any cloud platform that supports Docker containers (Railway, Fly.io, Render, etc.). Set the PORT environment variable and the server runs in HTTP mode. Without PORT, it runs in stdio mode for local use.
Your MCP endpoint will be at https://your-domain. Verify with:
curl https://your-domain/healthTools
search_by_title
Search Swiss federal legislation titles in the Classified Compilation (RS/SR). Returns only acts currently in force.
Parameter | Type | Required | Description |
| string | Yes | Keywords to match against act titles |
|
| No | Language for results (default: |
Example: Find the RS number for the data protection act.
search_by_title(query="protection des données")
→ RS 235.1 — Loi fédérale sur la protection des données (LPD)get_article
Retrieve the official consolidated text of a specific article.
Parameter | Type | Required | Description |
| string | Yes | RS number (e.g. |
| string | Yes | Article number (e.g. |
|
| No | Language (default: |
| string | No | Consolidation date (YYYY-MM-DD); defaults to latest |
Example: Retrieve art. 1 CC in German.
get_article(rs_number="210", article="1", language="de")
→ Art. 1: Das Gesetz findet auf alle Rechtsfragen Anwendung...get_law_text
Retrieve the full text of an act or a specific title/chapter. This is the primary tool for reading and analysing legislation from the source.
Parameter | Type | Required | Description |
| string | Yes | RS number |
| string | No | Limit to a title/chapter (e.g. |
|
| No | Language (default: |
| number | No | Page for paginated results (default: 1) |
Large acts are paginated automatically (splitting at article boundaries). Each response includes the total page count.
Example: Retrieve Swiss tenancy law (CO, Title 8).
get_law_text(rs_number="220", section="Titre huitième", language="fr")
→ [Full text of tenancy provisions, art. 253 onwards]list_amendments
List recent amendments (consolidation versions) for a given act.
Parameter | Type | Required | Description |
| string | Yes | RS number |
| string | No | Start date, YYYY-MM-DD (default: 1 year ago) |
|
| No | Language for titles (default: |
Example: Check recent changes to the CO.
list_amendments(rs_number="220", since="2024-01-01")
→ 2026-01-01 — Version in force from 2026-01-01 (current)
2025-10-01 — Version in force from 2025-10-01 to 2025-12-31
...How It Works
Claude ──MCP──> Fedlex Connector ──SPARQL──> fedlex.data.admin.ch
──HTTP───> fedlex.admin.ch/filestore/...Metadata path (SPARQL): The server queries Fedlex's SPARQL endpoint (JOLux ontology) to resolve RS numbers to internal URIs, find the latest consolidation date, discover HTML file URLs, and list amendment history.
Text path (HTML filestore): Once the server knows which HTML file(s) to fetch, it retrieves them from the static filestore, parses the DOM with Cheerio, and extracts the requested article, section, or full text. Large acts (like the CO with 1,100+ articles) are split across multiple HTML files which the server discovers and stitches together automatically.
Data flow for a typical request:
Claude calls
get_article(rs_number="210", article="3")Server queries SPARQL: RS 210 → ConsolidationAbstract URI
Server queries SPARQL: latest consolidation date for that URI
Server queries SPARQL: HTML filestore URL(s) for that consolidation
Server fetches HTML, parses it, extracts art. 3
Server returns the article text to Claude with consolidation date and legal caveat
Every response includes a footer noting that only the Official Compilation (RO/AS) published by the Federal Chancellery is legally authoritative.
Development
Project Structure
src/
index.ts # Entry point: picks stdio or HTTP transport based on PORT env var
server.ts # MCP server factory: tool definitions and request handlers
types.ts # TypeScript interfaces, error types, constants
sparql.ts # SPARQL endpoint queries (metadata, RS resolution, amendments)
filestore.ts # HTML fetching, parsing, article/section extraction, pagination
build/ # Compiled JavaScript (generated by tsc)
Dockerfile # Container build for cloud deploymentScripts
Command | Description |
| Compile TypeScript to |
| Run the MCP server (stdio mode) |
| Run locally in HTTP mode on port 3000 |
| Watch mode (auto-recompile on changes) |
Dependencies
Package | Purpose |
| MCP server SDK (tool registration, stdio transport) |
| HTML parsing for extracting legislative text |
Error Codes
The server returns structured errors with codes and actionable suggestions:
Code | Meaning |
| RS number not found in the SPARQL graph |
| Article does not exist in the act (with nearby IDs listed) |
| SPARQL endpoint is down or returned an error |
| HTML file not found or fetch failed |
| Missing or malformed parameters |
| HTML parsing failure |
Known Limitations
Full act historical versions:
get_law_textonly retrieves full acts as they are currently in force and does not return past versions. For historical text, useget_article, which supports adateparameter.HTML availability: Fedlex generally only provides HTML for consolidations from 2021 onwards. Older versions are only available as PDF or DOC on the Fedlex platform. The server returns a clear error with guidance when HTML is unavailable for a requested date.
Rate limiting: The SPARQL endpoint and filestore are public Swiss government services. The server limits itself to 10 requests/second per endpoint to be a responsible client.
Section filtering: The
sectionparameter inget_law_textuses heading-text matching which works well for standard section names but may not match unusual headings. When filtering fails, the full act text is returned with a note.Language coverage: Supports French (FR), German (DE), and Italian (IT). Romansch is not available.
Scope: Covers federal law in the Classified Compilation only. Cantonal law, the Federal Gazette, and court decisions are out of scope.
License
MIT
Available Tools
4 toolsget_articleAInspect
Retrieve a single article when you already know the EXACT article number (e.g. from a cross-reference). Do NOT call this tool repeatedly to search for provisions — use get_law_text instead to fetch the full act or a section and locate relevant articles in the text.
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Consolidation date in YYYY-MM-DD format. Defaults to the latest available version. | |
| article | Yes | Article number (e.g. '3', '28a', '41') | |
| language | No | Language (default: de) | |
| rs_number | Yes | RS/SR number (e.g. '210' for CC, '220' for CO, '311.0' for CP) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool returns a single article and that repeated calls are inappropriate for searching. However, it does not describe the return format, error behavior for invalid article numbers, or versioning behavior beyond the date parameter's schema description. The description provides moderate behavioral context but leaves room for more.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, both earning their place. The first states the tool's purpose and the key precondition (exact article number), and the second provides critical usage prohibition and routing to the alternative. No fluff, perfectly front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple single-article retrieval tool with 100% schema coverage, the description covers the essential context: exact-number precondition, the search disincentive, and the alternative routing. The only gaps are the absence of any return-format or error-handling description, but for such a focused tool with a well-documented schema, this is a minor omission.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so all four parameters are documented in the schema itself. While the description doesn't add parameter-level detail beyond the schema, it provides essential semantic context: that 'article' must be an exact number from a cross-reference, which clarifies the precision requirement. This adds value beyond the schema's generic description of article as just 'Article number'.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves a single article when the exact article number is known, using a specific verb ('Retrieve') and resource. It also differentiates from the sibling tool get_law_text by explicitly stating what it is NOT for, which makes its purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives explicit when-to-use guidance ('when you already know the EXACT article number'), an explicit when-not-to-use instruction ('Do NOT call this tool repeatedly to search for provisions'), and names the alternative tool (get_law_text) with guidance on how to use it instead. This is exemplary usage guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_law_textAInspect
Retrieve the official consolidated text of a Swiss federal act (or a specific title/chapter) directly from Fedlex (fedlex.admin.ch). This is the PRIMARY tool for answering Swiss law questions — always start here. Fetch the full act or a specific section, then locate relevant provisions in the returned text. Prefer this over get_article unless you already know the exact article number.
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for paginated results (default: 1). Large acts are split across multiple pages. | |
| section | No | Limit to a specific title, chapter, or part (e.g. 'Titre huitième', 'Zweiter Teil'). If omitted, returns the full act. | |
| language | No | Language (default: de) | |
| rs_number | Yes | RS/SR number (e.g. '210' for CC, '220' for CO) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does well: it clarifies that the tool fetches official consolidated text, can target a full act or a section, and instructs the agent to 'locate relevant provisions in the returned text.' It does not describe error cases or rate limits, but this is a read-only retrieval tool and the core behavior is clearly disclosed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded with the core purpose. It contains a small amount of redundancy—'Fetch the full act or a specific section' partially repeats the first sentence and the schema—but each sentence still contributes useful usage or workflow context, so it earns a score above baseline.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given four parameters, a full schema, and no output schema, the description provides enough context to call the tool correctly: source, primary use case, section behavior, and how to process the returned text. It does not mention fallback to search_by_title when rs_number is unknown, but the schema and sibling list make this recoverable.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3; the schema already explains rs_number, section, language, and page with examples. The description adds minor reinforcement by mentioning 'specific title/chapter' and 'full act or a specific section,' but it does not materially extend the parameter meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb-resource pair: 'Retrieve the official consolidated text of a Swiss federal act' and names the exact source, Fedlex. It further distinguishes this tool from siblings by declaring itself the 'PRIMARY tool for answering Swiss law questions' and explicitly prefers it over get_article unless an exact article number is known.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives direct when-to-use guidance: 'always start here' for Swiss law questions, and states the condition for choosing get_article instead ('unless you already know the exact article number'). This is explicit enough for an agent to route correctly without opening other tool schemas.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_amendmentsAInspect
List consolidation version dates for a Swiss federal act. Returns the dates each consolidated version took effect.
| Name | Required | Description | Default |
|---|---|---|---|
| since | No | Start date in YYYY-MM-DD format (default: 1 year ago) | |
| language | No | Language for amendment titles (default: de) | |
| rs_number | Yes | RS/SR number |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the behavioral disclosure burden. It states the return nature (dates) but says nothing about read-only behavior, authorization requirements, pagination, or side effects. For a listing tool this is a moderate gap, not a critical one.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences with zero waste. The action and result are front-loaded, and every sentence contributes meaning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple list tool with one required parameter and no output schema, the description covers action, resource, and result. It lacks detail on output format and how language/since affect results, but those are documented in the schema, so the definition is largely sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Input schema already describes all three parameters with 100% coverage, so the baseline is 3. The description adds no parameter-specific semantics beyond the schema, though the phrase 'consolidated version dates' loosely contextualizes rs_number and since.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('List') and resource ('consolidation version dates for a Swiss federal act') and clarifies the output ('the dates each consolidated version took effect'). This clearly distinguishes it from siblings like search_by_title or get_article.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives, and no exclusions or conditions are provided. The intended use is only implied by the description's statement of what it returns.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_by_titleAInspect
Search Swiss federal legislation titles in the Classified Compilation (RS/SR) on Fedlex. Use to find the RS number of a law when you know its name but not its number. Searches titles only, not article content. Returns only acts currently in force.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Keywords to match against act titles (e.g. 'code civil', 'protection des données') | |
| language | No | Language for results (default: de) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses important behaviors beyond the bare operation: it matches titles only, excludes article content, and filters to acts currently in force. It does not describe result format or pagination, but for a simple search tool the core behavioral traits are well covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences with no fluff. It front-loads the action and domain, then adds the key differentiator and result filtering. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and no annotations, the description covers the main facts an agent needs: what is searched, why to use it, what is excluded, and the in-force filter. It could mention result fields or language behavior in more detail, but the tool is simple and the description is largely sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the input schema already explains both query and language parameters, including an example and the default language. The description adds no parameter-level semantics beyond what the schema provides, so the baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Search'), a specific resource ('Swiss federal legislation titles in the Classified Compilation (RS/SR) on Fedlex'), and a clear intended outcome ('find the RS number of a law'). It also distinguishes itself from content search by saying it searches titles only, which differentiates it from siblings like get_article.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says when to use it: when you know a law's name but not its RS number. It also states what it does not do ('Searches titles only, not article content') and that it returns only in-force acts, which are useful exclusions. It does not explicitly name alternative sibling tools, so it stops short of a perfect 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v1.0.0- First observed
get_article - First observed
get_law_text - First observed
list_amendments - First observed
search_by_title
TDQS
Each tool has a clear, distinct purpose: searching by title, listing version dates, fetching an exact article, and retrieving full law text. The descriptions explicitly steer agents away from using get_article when get_law_text is more appropriate.
list_amendments, get_article, and get_law_text all follow a clean verb_noun pattern. search_by_title is a minor deviation with the preposition 'by', but it remains predictable and readable.
Four tools is well-scoped for a legal retrieval connector: discover a law, fetch its text, fetch a specific article, and check amendment dates. Each tool earns its place with no redundant overlap.
The core Swiss law research workflow is covered: find an act by title, retrieve the consolidated text, get a specific article, and list version dates. Missing historical version text retrieval and full-text cross-law search are minor gaps rather than blocking issues.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Swiss federal law (Fedlex) and political data (LINDAS) for agents, every answer with sources
Resolve, search and verify legal citations against the official sources, with provenance.
Verified, citable German & EU law for any LLM. Daily updates from official sources, hosted in DE.
Verified, citable German & EU law for any LLM. Daily updates from official sources, hosted in DE.
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP Server for Swiss federal law — search the SR, monitor legal changes, and query BBl/treaties via Claude Desktop or Claude.ai.123MIT
- AlicenseAqualityFmaintenanceEnables querying Swiss data protection regulations, FDPIC/EDOB decisions, and guidelines directly from MCP-compatible clients like Claude.6Apache 2.0
- AlicenseAqualityAmaintenanceMCP server for Swiss federal legislation metadata via Fedlex, enabling search and retrieval of act details with ELI URIs, SR numbers, and multilingual support.3Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides AI assistants with citable access to Bernese laws (BSG) and administrative court rulings (Verwaltungsgericht Bern) via search, retrieval by number, and article extraction.MIT
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/JayTheSkier/fedlex-connector'
If you have feedback or need assistance with the MCP directory API, please join our Discord server