MCP server for Swedish statutes (SFS) via the Riksdagen open-data API — fetch consolidated acts with persistent identifiers and verifiable citations.
Project description
se-eli-mcp
An MCP server for Swedish statutes (SFS, Svensk författningssamling), served as open data
by the Riksdagen (parliament) at data.riksdagen.se (keyless). It gives an AI agent the
consolidated text of an act with a verifiable citation: a persistent identifier, a
human-readable citation, and a link to the official source.
Part of the eu-legal-mcp line by MateMatic — one connector per EU member state, the same citation contract everywhere.
On ELI. Sweden does not publish native ELI (
/eli/) URIs. To keep the line's contract honest,eli_uricarries the official persistent document identifier instead — thedata.riksdagen.se/dokumentURI (e.g.https://data.riksdagen.se/dokument/sfs-2018-218). The SFS number (2018:218) is the canonical Swedish citation. The connector never fabricates an/eli/URI and says so in its tool instructions. SeeDISCOVERY.md.
Tools
| Tool | What it does |
|---|---|
se_search(query) |
Free-text search over SFS statutes (title and full text). Returns acts, each with the citation contract. |
se_get_act(sfs_number) |
Metadata for one act by its SFS number (e.g. 2018:218) — title, authority, date, consolidation marker. |
se_get_text(sfs_number) |
The full consolidated plain text of one act. |
Every response carries the citation contract:
eli_uri— the official persistent identifier (document URI; see the ELI note above).human_readable_citation— the act title, which embeds the SFS number, e.g. Lag (2018:218) med kompletterande bestämmelser till EU:s dataskyddsförordning.source_url— the browsabledata.riksdagen.sepage for the act.consolidated_through— the last amendment folded into the text (the "ändrad t.o.m." marker).
Install
pip install -e ".[dev]"
Register it with your MCP client (see .mcp.json.example):
{
"mcpServers": {
"se-eli-mcp": {
"command": "se-eli-mcp",
"env": {
"SE_ELI_BASE_URL": "https://data.riksdagen.se",
"SE_ELI_CACHE_DIR": "~/.matematic/cache/se-eli",
"SE_ELI_AUDIT_DIR": "~/.matematic/audit"
}
}
}
}
Design
- Public data only. Read-only against the keyless Riksdagen open-data API; nothing is sent beyond the query / SFS number.
- Audit log. Every call appends one JSON line to
~/.matematic/audit/se-eli-mcp.jsonl(AI Act art. 12 record-keeping). - Vendor-neutral. No LLM provider, no telemetry; own backoff + on-disk cache.
- No fabrication. Identifiers and titles are parsed from the source record. If Riksdagen's schema changes, the connector fails loudly rather than returning stale or invented data.
See CONSTITUTION.md (the 4 principles) and DISCOVERY.md (how the source was mapped).
Tests
pytest tests/test_instructions_drift.py tests/test_parse.py # offline
pytest tests/test_smoke.py # live Riksdagen API
Licence
Apache-2.0. The Swedish legislation served is official public data of the Kingdom of Sweden; this connector adds no rights over it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file se_eli_mcp-0.1.0.tar.gz.
File metadata
- Download URL: se_eli_mcp-0.1.0.tar.gz
- Upload date:
- Size: 31.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2640a63350f7bbd916adfd379a7d37f01668904731a01e452feec4b1b9b01480
|
|
| MD5 |
b907c94197085f47e999cdd4b4b71462
|
|
| BLAKE2b-256 |
10c280cc252b62599e3bd5a385564beaf9cccad56c476ae77470447969eee510
|
Provenance
The following attestation bundles were made for se_eli_mcp-0.1.0.tar.gz:
Publisher:
release.yml on matematicsolutions/se-eli-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
se_eli_mcp-0.1.0.tar.gz -
Subject digest:
2640a63350f7bbd916adfd379a7d37f01668904731a01e452feec4b1b9b01480 - Sigstore transparency entry: 1950138505
- Sigstore integration time:
-
Permalink:
matematicsolutions/se-eli-mcp@12d2ca8080a5ba0f2402ca70df72c2724534ea54 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/matematicsolutions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12d2ca8080a5ba0f2402ca70df72c2724534ea54 -
Trigger Event:
push
-
Statement type:
File details
Details for the file se_eli_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: se_eli_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
156f0e95e41c2a51275b22947c906985a99dfb507be90615663c4df93be8df59
|
|
| MD5 |
8c3eb8c4e9fa7be4cc7aef5b103d218e
|
|
| BLAKE2b-256 |
41c44bbe3143894f65ccb0ef8dc3e9f3f975224555c2e6f30bfa6515f2c17930
|
Provenance
The following attestation bundles were made for se_eli_mcp-0.1.0-py3-none-any.whl:
Publisher:
release.yml on matematicsolutions/se-eli-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
se_eli_mcp-0.1.0-py3-none-any.whl -
Subject digest:
156f0e95e41c2a51275b22947c906985a99dfb507be90615663c4df93be8df59 - Sigstore transparency entry: 1950138671
- Sigstore integration time:
-
Permalink:
matematicsolutions/se-eli-mcp@12d2ca8080a5ba0f2402ca70df72c2724534ea54 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/matematicsolutions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12d2ca8080a5ba0f2402ca70df72c2724534ea54 -
Trigger Event:
push
-
Statement type: