fedlex-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fedlex_mcp-0.1.0/.github/workflows/ci.yml +44 -0
- fedlex_mcp-0.1.0/.github/workflows/publish.yml +54 -0
- fedlex_mcp-0.1.0/LICENSE +21 -0
- fedlex_mcp-0.1.0/PKG-INFO +242 -0
- fedlex_mcp-0.1.0/README.md +194 -0
- fedlex_mcp-0.1.0/pyproject.toml +56 -0
- fedlex_mcp-0.1.0/src/fedlex_mcp/__init__.py +1 -0
- fedlex_mcp-0.1.0/src/fedlex_mcp/server.py +889 -0
- fedlex_mcp-0.1.0/tests/__init__.py +1 -0
- fedlex_mcp-0.1.0/tests/test_server.py +27 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v5
|
|
21
|
+
|
|
22
|
+
- name: Python ${{ matrix.python-version }} einrichten
|
|
23
|
+
uses: actions/setup-python@v6
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Abhaengigkeiten installieren
|
|
28
|
+
run: pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Linting mit ruff
|
|
31
|
+
run: python -m ruff check src/
|
|
32
|
+
|
|
33
|
+
- name: Format-Check
|
|
34
|
+
run: python -m ruff format --check src/
|
|
35
|
+
|
|
36
|
+
- name: Import-Test
|
|
37
|
+
run: python -c "from fedlex_mcp.server import main; print('Import OK')"
|
|
38
|
+
env:
|
|
39
|
+
PYTHONPATH: src
|
|
40
|
+
|
|
41
|
+
- name: Unit-Tests (ohne Live-Tests)
|
|
42
|
+
run: python -m pytest tests/ -m "not live" -v
|
|
43
|
+
env:
|
|
44
|
+
PYTHONPATH: src
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
name: Build distribution
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v5
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v6
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
|
|
26
|
+
- name: Install build tools
|
|
27
|
+
run: pip install build
|
|
28
|
+
|
|
29
|
+
- name: Build package
|
|
30
|
+
run: python -m build
|
|
31
|
+
|
|
32
|
+
- name: Upload build artifacts
|
|
33
|
+
uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: dist
|
|
36
|
+
path: dist/
|
|
37
|
+
|
|
38
|
+
publish:
|
|
39
|
+
name: Publish to PyPI
|
|
40
|
+
needs: build
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
environment:
|
|
43
|
+
name: pypi
|
|
44
|
+
url: https://pypi.org/project/fedlex-mcp/
|
|
45
|
+
|
|
46
|
+
steps:
|
|
47
|
+
- name: Download build artifacts
|
|
48
|
+
uses: actions/download-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: dist
|
|
51
|
+
path: dist/
|
|
52
|
+
|
|
53
|
+
- name: Publish to PyPI
|
|
54
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
fedlex_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hayal Isik
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fedlex-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for Swiss federal law via the Fedlex SPARQL endpoint
|
|
5
|
+
Project-URL: Homepage, https://github.com/malkreide/fedlex-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/malkreide/fedlex-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/malkreide/fedlex-mcp/issues
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026 Hayal Isik
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Keywords: claude,fedlex,llm,mcp,model-context-protocol,sparql,swiss-law
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
38
|
+
Requires-Python: >=3.11
|
|
39
|
+
Requires-Dist: httpx>=0.27.0
|
|
40
|
+
Requires-Dist: mcp[cli]>=1.3.0
|
|
41
|
+
Requires-Dist: pydantic>=2.0.0
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
|
|
49
|
+
# Fedlex MCP Server
|
|
50
|
+
|
|
51
|
+
**Zugriff auf das Schweizer Bundesrecht via Claude Desktop oder Claude.ai**
|
|
52
|
+
|
|
53
|
+
[](https://www.python.org/)
|
|
54
|
+
[](https://modelcontextprotocol.io/)
|
|
55
|
+
[](LICENSE)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Was ist das?
|
|
60
|
+
|
|
61
|
+
Dieser MCP-Server verbindet KI-Assistenten (Claude) mit dem **Fedlex SPARQL-Endpoint** der Schweizerischen Bundeskanzlei. Damit können KI-Agenten direkt im Gespräch Schweizer Bundesrecht nachschlagen, Rechtsänderungen überwachen und Gesetze analysieren — ohne manuelle Recherche auf fedlex.admin.ch.
|
|
62
|
+
|
|
63
|
+
**Metapher:** USB-C für Bundesrecht. Einmal angeschlossen, kann Claude jederzeit in die Systematische Rechtssammlung «greifen».
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Tools (7)
|
|
68
|
+
|
|
69
|
+
| Tool | Beschreibung |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `fedlex_search_laws` | Erlasse der SR nach Stichwort im Titel suchen |
|
|
72
|
+
| `fedlex_get_law_by_sr` | Erlass nach SR-Nummer abrufen (z.B. `235.1` = DSG) |
|
|
73
|
+
| `fedlex_get_recent_publications` | Neueste Publikationen der Amtlichen Sammlung (AS) |
|
|
74
|
+
| `fedlex_get_upcoming_changes` | Erlasse, die bald in Kraft treten (Rechtsmonitoring) |
|
|
75
|
+
| `fedlex_search_gazette` | Im Bundesblatt (BBl) suchen |
|
|
76
|
+
| `fedlex_get_law_history` | Alle Fassungen eines Erlasses (Versionsgeschichte) |
|
|
77
|
+
| `fedlex_search_treaties` | Staatsverträge (SR-Nummern beginnen mit `0.`) |
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Anwendungsbeispiele
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
"Zeig mir alle gültigen Bundesgesetze zur Berufsbildung"
|
|
85
|
+
→ fedlex_search_laws(keywords="Berufsbildung")
|
|
86
|
+
|
|
87
|
+
"Was steht im Datenschutzgesetz? Ist es noch in Kraft?"
|
|
88
|
+
→ fedlex_get_law_by_sr(sr_number="235.1")
|
|
89
|
+
|
|
90
|
+
"Welche Bundesgesetze treten in den nächsten 3 Monaten in Kraft?"
|
|
91
|
+
→ fedlex_get_upcoming_changes(days_ahead=90)
|
|
92
|
+
|
|
93
|
+
"Was hat der Bundesrat diese Woche im Bundesblatt publiziert?"
|
|
94
|
+
→ fedlex_get_recent_publications(days=7)
|
|
95
|
+
|
|
96
|
+
"Zeig mir die Versionsgeschichte des DSG — wann trat die Revision in Kraft?"
|
|
97
|
+
→ fedlex_get_law_history(sr_number="235.1")
|
|
98
|
+
|
|
99
|
+
"Welche Bildungsabkommen hat die Schweiz mit der EU?"
|
|
100
|
+
→ fedlex_search_treaties(keywords="Bildung")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Installation
|
|
106
|
+
|
|
107
|
+
### Voraussetzungen
|
|
108
|
+
- Python 3.11+
|
|
109
|
+
- `uv` oder `pip`
|
|
110
|
+
|
|
111
|
+
### Lokal (Claude Desktop)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# 1. Repository klonen
|
|
115
|
+
git clone https://github.com/malkreide/fedlex-mcp.git
|
|
116
|
+
cd fedlex-mcp
|
|
117
|
+
|
|
118
|
+
# 2. Abhängigkeiten installieren
|
|
119
|
+
pip install -r requirements.txt
|
|
120
|
+
|
|
121
|
+
# 3. Direkt testen
|
|
122
|
+
python server.py
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Claude Desktop Konfiguration
|
|
126
|
+
|
|
127
|
+
Datei öffnen:
|
|
128
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
129
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
130
|
+
|
|
131
|
+
Eintrag hinzufügen:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"mcpServers": {
|
|
136
|
+
"fedlex": {
|
|
137
|
+
"command": "python",
|
|
138
|
+
"args": ["/absoluter/pfad/zu/fedlex-mcp/server.py"]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Mit `uvx` (empfohlen, kein manuelles Install):
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"mcpServers": {
|
|
149
|
+
"fedlex": {
|
|
150
|
+
"command": "uvx",
|
|
151
|
+
"args": ["--from", "git+https://github.com/malkreide/fedlex-mcp", "fedlex-mcp"]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Claude Desktop neu starten. Im Chat erscheinen danach 7 neue Tools (Hammer-Icon).
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Cloud-Deployment (Render.com / SSE)
|
|
162
|
+
|
|
163
|
+
Für Zugriff via Browser oder ohne lokale Installation:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Server starten (SSE-Transport)
|
|
167
|
+
MCP_TRANSPORT=sse PORT=8000 python server.py
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
`render.yaml` Beispiel:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
services:
|
|
174
|
+
- type: web
|
|
175
|
+
name: fedlex-mcp
|
|
176
|
+
runtime: python
|
|
177
|
+
buildCommand: pip install -r requirements.txt
|
|
178
|
+
startCommand: python server.py
|
|
179
|
+
envVars:
|
|
180
|
+
- key: MCP_TRANSPORT
|
|
181
|
+
value: sse
|
|
182
|
+
- key: PORT
|
|
183
|
+
value: 10000
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Datenmodell (JOLux-Ontologie)
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
jolux:ConsolidationAbstract ← SR-Eintrag
|
|
192
|
+
└─ jolux:isRealizedBy → jolux:Expression (URI endet auf /de, /fr, /it, /rm)
|
|
193
|
+
├─ jolux:title "Bundesgesetz vom 19. Juni 1992 über den Datenschutz"
|
|
194
|
+
├─ jolux:titleShort "DSG"
|
|
195
|
+
└─ jolux:historicalLegalId "235.1"
|
|
196
|
+
|
|
197
|
+
jolux:inForceStatus:
|
|
198
|
+
.../0 ✅ In Kraft
|
|
199
|
+
.../1 ⚠️ Nicht mehr in SR publiziert
|
|
200
|
+
.../3 ❌ Nicht mehr in Kraft
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**SPARQL-Endpoint:** `https://fedlex.data.admin.ch/sparqlendpoint`
|
|
204
|
+
**Lizenz:** Freie Wiederverwendung (kommerziell und andere Zwecke) gemäss [fedlex.admin.ch/de/broadcasters](https://www.fedlex.admin.ch/de/broadcasters)
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Sprachen
|
|
209
|
+
|
|
210
|
+
| Code | Sprache |
|
|
211
|
+
|---|---|
|
|
212
|
+
| `de` | Deutsch (Standard, vollständigste Abdeckung) |
|
|
213
|
+
| `fr` | Français |
|
|
214
|
+
| `it` | Italiano |
|
|
215
|
+
| `rm` | Rumantsch |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Sicherheitshinweise
|
|
220
|
+
|
|
221
|
+
- Dieser Server ist **read-only** — keine schreibenden Operationen
|
|
222
|
+
- Alle Abfragen gehen direkt an den öffentlichen Fedlex-Endpoint
|
|
223
|
+
- Keine API-Keys oder Authentifizierung erforderlich
|
|
224
|
+
- Datensouveränität: Keine Daten werden an Dritte übertragen
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Verwandte Projekte
|
|
229
|
+
|
|
230
|
+
- [Zurich Open Data MCP](https://github.com/malkreide/zurich-opendata-mcp) — Daten der Stadt Zürich
|
|
231
|
+
- [Swiss Transport MCP](https://github.com/malkreide/swiss-transport-mcp) — Öffentlicher Verkehr CH
|
|
232
|
+
- [Patent Research MCP](https://github.com/malkreide/patent-mcp) — EPO/IGE Patentdatenbanken
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Entwickelt von
|
|
237
|
+
|
|
238
|
+
Hayal Hayal | GitHub: [@malkreide](https://github.com/malkreide)
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
*English summary: MCP server providing access to Swiss federal law via the Fedlex SPARQL endpoint. 7 tools covering the Systematic Compilation (SR), Official Gazette, Federal Bulletin, version history, and international treaties. Read-only, no authentication required, dual transport (stdio + SSE).*
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Fedlex MCP Server
|
|
2
|
+
|
|
3
|
+
**Zugriff auf das Schweizer Bundesrecht via Claude Desktop oder Claude.ai**
|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/)
|
|
6
|
+
[](https://modelcontextprotocol.io/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Was ist das?
|
|
12
|
+
|
|
13
|
+
Dieser MCP-Server verbindet KI-Assistenten (Claude) mit dem **Fedlex SPARQL-Endpoint** der Schweizerischen Bundeskanzlei. Damit können KI-Agenten direkt im Gespräch Schweizer Bundesrecht nachschlagen, Rechtsänderungen überwachen und Gesetze analysieren — ohne manuelle Recherche auf fedlex.admin.ch.
|
|
14
|
+
|
|
15
|
+
**Metapher:** USB-C für Bundesrecht. Einmal angeschlossen, kann Claude jederzeit in die Systematische Rechtssammlung «greifen».
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Tools (7)
|
|
20
|
+
|
|
21
|
+
| Tool | Beschreibung |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `fedlex_search_laws` | Erlasse der SR nach Stichwort im Titel suchen |
|
|
24
|
+
| `fedlex_get_law_by_sr` | Erlass nach SR-Nummer abrufen (z.B. `235.1` = DSG) |
|
|
25
|
+
| `fedlex_get_recent_publications` | Neueste Publikationen der Amtlichen Sammlung (AS) |
|
|
26
|
+
| `fedlex_get_upcoming_changes` | Erlasse, die bald in Kraft treten (Rechtsmonitoring) |
|
|
27
|
+
| `fedlex_search_gazette` | Im Bundesblatt (BBl) suchen |
|
|
28
|
+
| `fedlex_get_law_history` | Alle Fassungen eines Erlasses (Versionsgeschichte) |
|
|
29
|
+
| `fedlex_search_treaties` | Staatsverträge (SR-Nummern beginnen mit `0.`) |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Anwendungsbeispiele
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
"Zeig mir alle gültigen Bundesgesetze zur Berufsbildung"
|
|
37
|
+
→ fedlex_search_laws(keywords="Berufsbildung")
|
|
38
|
+
|
|
39
|
+
"Was steht im Datenschutzgesetz? Ist es noch in Kraft?"
|
|
40
|
+
→ fedlex_get_law_by_sr(sr_number="235.1")
|
|
41
|
+
|
|
42
|
+
"Welche Bundesgesetze treten in den nächsten 3 Monaten in Kraft?"
|
|
43
|
+
→ fedlex_get_upcoming_changes(days_ahead=90)
|
|
44
|
+
|
|
45
|
+
"Was hat der Bundesrat diese Woche im Bundesblatt publiziert?"
|
|
46
|
+
→ fedlex_get_recent_publications(days=7)
|
|
47
|
+
|
|
48
|
+
"Zeig mir die Versionsgeschichte des DSG — wann trat die Revision in Kraft?"
|
|
49
|
+
→ fedlex_get_law_history(sr_number="235.1")
|
|
50
|
+
|
|
51
|
+
"Welche Bildungsabkommen hat die Schweiz mit der EU?"
|
|
52
|
+
→ fedlex_search_treaties(keywords="Bildung")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
### Voraussetzungen
|
|
60
|
+
- Python 3.11+
|
|
61
|
+
- `uv` oder `pip`
|
|
62
|
+
|
|
63
|
+
### Lokal (Claude Desktop)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 1. Repository klonen
|
|
67
|
+
git clone https://github.com/malkreide/fedlex-mcp.git
|
|
68
|
+
cd fedlex-mcp
|
|
69
|
+
|
|
70
|
+
# 2. Abhängigkeiten installieren
|
|
71
|
+
pip install -r requirements.txt
|
|
72
|
+
|
|
73
|
+
# 3. Direkt testen
|
|
74
|
+
python server.py
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Claude Desktop Konfiguration
|
|
78
|
+
|
|
79
|
+
Datei öffnen:
|
|
80
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
81
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
82
|
+
|
|
83
|
+
Eintrag hinzufügen:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"fedlex": {
|
|
89
|
+
"command": "python",
|
|
90
|
+
"args": ["/absoluter/pfad/zu/fedlex-mcp/server.py"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Mit `uvx` (empfohlen, kein manuelles Install):
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"fedlex": {
|
|
102
|
+
"command": "uvx",
|
|
103
|
+
"args": ["--from", "git+https://github.com/malkreide/fedlex-mcp", "fedlex-mcp"]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Claude Desktop neu starten. Im Chat erscheinen danach 7 neue Tools (Hammer-Icon).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Cloud-Deployment (Render.com / SSE)
|
|
114
|
+
|
|
115
|
+
Für Zugriff via Browser oder ohne lokale Installation:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Server starten (SSE-Transport)
|
|
119
|
+
MCP_TRANSPORT=sse PORT=8000 python server.py
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`render.yaml` Beispiel:
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
services:
|
|
126
|
+
- type: web
|
|
127
|
+
name: fedlex-mcp
|
|
128
|
+
runtime: python
|
|
129
|
+
buildCommand: pip install -r requirements.txt
|
|
130
|
+
startCommand: python server.py
|
|
131
|
+
envVars:
|
|
132
|
+
- key: MCP_TRANSPORT
|
|
133
|
+
value: sse
|
|
134
|
+
- key: PORT
|
|
135
|
+
value: 10000
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Datenmodell (JOLux-Ontologie)
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
jolux:ConsolidationAbstract ← SR-Eintrag
|
|
144
|
+
└─ jolux:isRealizedBy → jolux:Expression (URI endet auf /de, /fr, /it, /rm)
|
|
145
|
+
├─ jolux:title "Bundesgesetz vom 19. Juni 1992 über den Datenschutz"
|
|
146
|
+
├─ jolux:titleShort "DSG"
|
|
147
|
+
└─ jolux:historicalLegalId "235.1"
|
|
148
|
+
|
|
149
|
+
jolux:inForceStatus:
|
|
150
|
+
.../0 ✅ In Kraft
|
|
151
|
+
.../1 ⚠️ Nicht mehr in SR publiziert
|
|
152
|
+
.../3 ❌ Nicht mehr in Kraft
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**SPARQL-Endpoint:** `https://fedlex.data.admin.ch/sparqlendpoint`
|
|
156
|
+
**Lizenz:** Freie Wiederverwendung (kommerziell und andere Zwecke) gemäss [fedlex.admin.ch/de/broadcasters](https://www.fedlex.admin.ch/de/broadcasters)
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Sprachen
|
|
161
|
+
|
|
162
|
+
| Code | Sprache |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `de` | Deutsch (Standard, vollständigste Abdeckung) |
|
|
165
|
+
| `fr` | Français |
|
|
166
|
+
| `it` | Italiano |
|
|
167
|
+
| `rm` | Rumantsch |
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Sicherheitshinweise
|
|
172
|
+
|
|
173
|
+
- Dieser Server ist **read-only** — keine schreibenden Operationen
|
|
174
|
+
- Alle Abfragen gehen direkt an den öffentlichen Fedlex-Endpoint
|
|
175
|
+
- Keine API-Keys oder Authentifizierung erforderlich
|
|
176
|
+
- Datensouveränität: Keine Daten werden an Dritte übertragen
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Verwandte Projekte
|
|
181
|
+
|
|
182
|
+
- [Zurich Open Data MCP](https://github.com/malkreide/zurich-opendata-mcp) — Daten der Stadt Zürich
|
|
183
|
+
- [Swiss Transport MCP](https://github.com/malkreide/swiss-transport-mcp) — Öffentlicher Verkehr CH
|
|
184
|
+
- [Patent Research MCP](https://github.com/malkreide/patent-mcp) — EPO/IGE Patentdatenbanken
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Entwickelt von
|
|
189
|
+
|
|
190
|
+
Hayal Hayal | GitHub: [@malkreide](https://github.com/malkreide)
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
*English summary: MCP server providing access to Swiss federal law via the Fedlex SPARQL endpoint. 7 tools covering the Systematic Compilation (SR), Official Gazette, Federal Bulletin, version history, and international treaties. Read-only, no authentication required, dual transport (stdio + SSE).*
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fedlex-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for Swiss federal law via the Fedlex SPARQL endpoint"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
keywords = ["mcp", "model-context-protocol", "fedlex", "swiss-law", "sparql", "claude", "llm"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"mcp[cli]>=1.3.0",
|
|
24
|
+
"httpx>=0.27.0",
|
|
25
|
+
"pydantic>=2.0.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dev = [
|
|
30
|
+
"pytest>=8.0.0",
|
|
31
|
+
"pytest-asyncio>=0.23.0",
|
|
32
|
+
"respx>=0.21.0",
|
|
33
|
+
"ruff>=0.4.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
fedlex-mcp = "fedlex_mcp.server:main"
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://github.com/malkreide/fedlex-mcp"
|
|
41
|
+
Repository = "https://github.com/malkreide/fedlex-mcp"
|
|
42
|
+
Issues = "https://github.com/malkreide/fedlex-mcp/issues"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/fedlex_mcp"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
markers = ["live: Tests die echte API-Aufrufe machen (deselect mit -m 'not live')"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
line-length = 100
|
|
52
|
+
target-version = "py311"
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint]
|
|
55
|
+
select = ["E", "F", "I", "UP"]
|
|
56
|
+
ignore = ["E501"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""fedlex-mcp: MCP server for Swiss federal law via the Fedlex SPARQL endpoint."""
|