Fedlex Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Fedlex Mcp (Agent Skill) and scored it 82/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 2 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 2 flagged
The text {match} is the classic direct prompt-injection phrasing. Placed in a skill body that the agent reads as trusted instructions, it tries to make the agent abandon its prior rules and follow whatever comes next — a full system-prompt override.
ignore/disregard/forget … previous instructions sentence.The text {match} is the classic direct prompt-injection phrasing. Placed in a skill body that the agent reads as trusted instructions, it tries to make the agent abandon its prior rules and follow whatever comes next — a full system-prompt override.
ignore/disregard/forget … previous instructions sentence.Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
:switzerland: Part of the [Swiss Public Data MCP Portfolio](https://github.com/malkreide)
MCP Server for Swiss federal law — search the SR, monitor legal changes, and query BBl/treaties via Claude Desktop or Claude.ai
fedlex-mcp connects AI assistants (Claude) with the Fedlex SPARQL endpoint of the Swiss Federal Chancellery. This enables AI agents to look up Swiss federal law, monitor legal changes, and analyse legislation directly in conversation — without manual research on fedlex.admin.ch.
Metaphor: USB-C for federal law. Once connected, Claude can reach into the Systematic Compilation at any time.
# 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):
uvx fedlex-mcp# stdio (for Claude Desktop)
python -m fedlex_mcp.server
# Streamable HTTP (port 8000)
python -m fedlex_mcp.server --http --port 8000Try 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 federal laws enter into force in the next 3 months?"
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"fedlex": {
"command": "python",
"args": ["-m", "fedlex_mcp.server"]
}
}
}Or with uvx:
{
"mcpServers": {
"fedlex": {
"command": "uvx",
"args": ["fedlex-mcp"]
}
}
}Config file locations:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonFor use via claude.ai in the browser (e.g. on managed workstations without local software):
Render.com (recommended):
python -m fedlex_mcp.server --http --port 8000https://your-app.onrender.com/sse"stdio for the developer laptop, SSE for the browser."
Demo: Claude using fedlex_search_laws
| Tool | Description |
|---|---|
fedlex_search_laws | Search the Systematic Compilation (SR) by keyword in title |
fedlex_get_law_by_sr | Get a law by its SR number (e.g. 235.1 = Data Protection Act) |
fedlex_get_recent_publications | Latest publications from the Official Compilation (AS) |
fedlex_get_upcoming_changes | Laws entering into force soon (legal monitoring) |
fedlex_search_gazette | Search the Federal Gazette (BBl) |
fedlex_get_law_history | All versions of a law (version history) |
fedlex_search_treaties | International treaties (SR numbers starting with 0.) |
| 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 |
| "What did the Federal Council publish this week?" | fedlex_get_recent_publications |
| "Show me the version history of the DSG" | fedlex_get_law_history |
| "Which education treaties does Switzerland have with the EU?" | fedlex_search_treaties |
→ More use cases by audience →
+-------------------+ +------------------------------+ +--------------------------+
| Claude / AI |---->| Fedlex MCP |---->| Fedlex SPARQL Endpoint |
| (MCP Host) |<----| (MCP Server) |<----| (Swiss Federal |
+-------------------+ | | | Chancellery) |
| 7 Tools . 2 Resources | +--------------------------+
| Stdio | SSE |
| |
| No authentication required |
+------------------------------+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.1"
jolux:inForceStatus:
.../0 In force
.../1 No longer published in the SR
.../3 No longer in forceSPARQL Endpoint: https://fedlex.data.admin.ch/sparqlendpoint Licence: Free reuse (commercial and other purposes) per fedlex.admin.ch
| Code | Language |
|---|---|
de | German (default, most complete coverage) |
fr | French |
it | Italian |
rm | Romansh |
fedlex-mcp/
+-- src/fedlex_mcp/
| +-- __init__.py # Package
| +-- server.py # 7 tools, 2 resources
+-- tests/
| +-- test_server.py # Unit tests (mocked)
+-- .github/workflows/ci.yml # GitHub Actions (Python 3.11/3.12/3.13)
+-- pyproject.toml
+-- CHANGELOG.md
+-- CONTRIBUTING.md # Contributing guide (English)
+-- CONTRIBUTING.de.md # Contributing guide (German)
+-- SECURITY.md # Security policy (English)
+-- SECURITY.de.md # Security policy (German)
+-- LICENSE
+-- README.md # This file (English)
+-- README.de.md # German versionThis server is in Phase 1 (read-only). All tools are annotated readOnlyHint: true / destructiveHint: false and only ever query the public Fedlex SPARQL endpoint — there are no write, send, or filesystem capabilities.
| Phase | Scope | Status |
|---|---|---|
| 1 — Read-only | Query SR/AS/BBl/treaties | ✅ current |
| 2 — Write-capable | (none planned) | — |
| 3 — Multi-agent | (none planned) | — |
A transition to a later phase would require an audit re-run and the human-in-the-loop controls described in the audit catalog before any write-capable tool is added.
The protocol version is negotiated at the initialize handshake by the mcp Python SDK (pinned to >=1.3.0 in pyproject.toml). The SDK is kept current via monthly Dependabot PRs (.github/dependabot.yml); protocol-relevant bumps are noted in CHANGELOG.md.
# Unit tests (no API key required)
PYTHONPATH=src pytest tests/ -m "not live"
# Integration tests (live API calls)
pytest tests/ -m "live"limit parameters conservatively. The server enforces a 45s timeout per request.See CHANGELOG.md
See SECURITY.md for the security posture, hardening controls, and how to report a vulnerability.
See CONTRIBUTING.md
MIT License — see LICENSE
Hayal Oezkan . malkreide
<!-- mcp-name: io.github.malkreide/fedlex-mcp -->
<!-- BEGIN GENERATED: install -->
Run via 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):
{
"mcpServers": {
"fedlex-mcp": {
"command": "uvx",
"args": [
"fedlex-mcp"
]
}
}
}<!-- END GENERATED: install -->
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.