Sweden Parliament MCP Server
Public Hosted Server: https://sweden-parliament.caseyjhand.com/mcp
Overview
Swedish parliamentary records from Riksdagen Open Data. Find proposals and committee reports, follow published decisions and main votes, read speeches, explore member assignments, and retrieve consolidated SFS statutes. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above; no API key required.
Source: The Swedish Parliament. This independent service is not operated or endorsed by Sveriges riksdag. Swedish titles, labels, decisions, and text retain their source wording; English labels appear only where the source supplies them.
Tools
Tool | Description |
| Browse official document types, committees, parties, constituencies, sessions, and identifier and coverage guidance |
| Search parliamentary documents and consolidated SFS statutes by words, type, session, committee, party, member, or dates |
| Read publication metadata, decisions, reservations, activities, links, and paginated text |
| Find speeches within a session by debate heading, member, party, or related document; retrieve full text through get mode |
| Read report decisions, party main-vote totals, individual ballots for a point, or one member's session main votes, optionally narrowed to a report or point |
| Find register entries by name, party, constituency, and source service classification |
| Read an exact member IID and its published assignment history |
Related MCP server: mcp-riksdagen-se
Capability reference
riksdag_list_reference tool
topic:document_types,committees,parties,constituencies,speech_types,sessions,identifiers, orcoverageDated offline snapshot (
referenceVerifiedAt) with Swedish labels and source-supplied English labels; the session catalog can lag current sessions, and newer well-formed sessions are still acceptedSessions accept
YYYY/YY, consecutiveYYYY/YYYY, or a historical calendar year;1999/00retains the published1999/2000formoffsetpagination;limitdefaults to 20, clamped to 100, withtotalCountandnextCall
riksdag_search_documents tool
Optional
query,documentType,session,committee,party,memberId,dateFrom, anddateTo; dates useYYYY-MM-DD, and codes or exact reference labels are accepted.memberIdselects source-linked participants, without inferring authorshipsortisrelevancefor a nonblank query anddateotherwise; either can be selected explicitly. Source subtitles include available author and SFS consolidation labelsRemote
pagestarts at 1;pageSizedefaults to 10 and is clamped to 50. A call returns the whole fetched remote page andnextCalladvancespage; theoffsetandrevisioninputs still resolve within a page, and a changed page fails withrevision_changedUse
documentType: "sfs"for consolidated statutes (N-series numbers included) anddocumentType: "votering"for vote records; narrow slow full-text searches withsessionordocumentType
riksdag_get_document tool
Required
documentIdfrom search, an SFS identifier (1974:152,SFS 1974:152,sfs-1974-152; N-series numbers such asN2026:7resolve tosfs-N2026-7), or a vote-record ID (H6190118-1) from a member's vote row; misses returnfound: false. Ordinary IDs come back uppercase. Omitsectionsfor metadata, the outline, and the first text page, or select frommetadata,decisions,reservations,activities,properties,attachments,references,stakeholders,text,source_html;[]returns the outline onlyText and HTML page by Unicode code point (
textOffset/textLength,htmlOffset/htmlLength), 8,000 by default; explicit lengths are honored. Array sections usesectionOffset/sectionLimit(default 20, clamped to 100);truncatedis true when any selected section has more entries. FollownextTextCall,nextHtmlCall, orsectionPages[].nextCallwithrevision; a changed record fails withrevision_changedFor a committee report (
bet) or interpellation (ip) with a session,relatedSpeechesCallis a readyriksdag_search_speechescall for the speeches the source links to that document, whateversectionsselects. It can return none, and a debate resumed later in the protocol can carry the link on its first segment onlyDecisions and notice properties expose readable Markdown alongside original HTML. Published summary tables retain every table and its totals; stakeholders retain source names, parties, roles, order, and available numeric member IDs
SFS text is the published consolidation (
versionKind: "consolidated") and can include future-effective provisions; it is not an as-enacted or point-in-time version. Attachments are returned as links, never downloaded
riksdag_search_speeches tool
mode: "search"(default) requiressession; optionalmemberId,party,speechType: "all" | "speech"(speechexcludes replies),headingContains, which matches all tokens in headings and subheadings, never body text, andrelatedDocumentId, a report or interpellation document ID that keeps the speeches the source links to it (any element of a joint debate's list). Riksdagen links a speech to its debate's document only on the segment where the debate starts, so a debate interrupted and resumed later can return just its first segment; checkheadingContainswith the report title for the rest.limitdefaults to 5 (max 20);textCountdefaults to 1 (max 5,0for metadata only), and each hydrated speech returns a full default text pagemode: "get"reads onespeechIdcopied from a search item (notsourceSpeechId) and pages the body withtextOffset/textLengthandnextTextCall. Default text pages are 8,000 code points; explicit lengths are honoredtextStateisincluded,not_requested,unavailable, orfailed, with recovery details on transient failures; retainrevisionon continuationsA missing detail, including an exact zero-byte HTTP 200 source response, returns
found: falsein get mode ortextState: "unavailable"during search hydration
riksdag_get_votes tool
Required
modeandsession.mode: "report"takesreport(FiU20or2024/25:FiU20) or a reportdocumentId, plus onepointorpointOffset/pointLimit(default 5, max 10); adocumentIdthat names a non-report, another session's report, or a report other thanreportfails withinvalid_filter.mode: "member"takesmemberId, optionalparty,report, andpoint(only withreport), andoffset/limit(default 20, max 500). Report and point narrow the member's rows locally with no extra upstream request, and a match-free filter succeeds with a noticeMember rows come in source-record timestamp order (
systemDateascending, then report, point, avser,voteId), not vote-date order; the source publishes no vote date in bulk, so rows carry none. Reports return as published (FöU1) and document IDs uppercase; matching ignores caseReport points carry the authoritative decision and party aggregates separated by source
avser;rollCallStateisavailable,acclamation,not_published, orunknown, and acclamation requires explicit decision evidence, never just empty vote rows. Incomplete groups retain unknown counts and observed labels; extra vote labels land inotherVotesWith an explicit report
point,ballots: trueadds individualvotesand independentballotPagepagination usingoffset/limit. FollowballotPage.nextCallwith bothrevisionandballotRevision; report-point counts keep their existing meaningPublished main votes only, not every ballot round; follow
nextCallwithrevisionfor remaining points or rows
riksdag_search_members tool
register: "service"(default) searches current members plus recent former members, substitutes, and ministers;register: "all"includes earlier records. A cold all-register request is substantially larger and can reach the normal timeoutOptional
nameContainsmatches all tokens as substrings, ignoring case and diacritics.partyandconstituencyaccept codes or exact labels.sitting: "all" | "serving" | "not_serving"(defaultall) filters source service labels, including serving substitutes, without establishing elected membershipoffsetpagination;limitdefaults to 20, clamped to 100. Returns actualcandidateCount, filteredtotalCount,sourceReportedCount,revision, andnextCall. Source-reported hits can differ from returned all-register records; a notice discloses this, and neither count is an independent historical censusmemberIdkeeps leading zeros. Entries without an IID returndetailAvailable: false; theirsourceRecordIdis a different identifier and can't be passed toriksdag_get_member
riksdag_get_member tool
Required numeric-string
memberId, leading zeros included; copy it from a member search result withdetailAvailable: true. Misses returnfound: falsewith guidanceRegister metadata and assignments in source order;
assignmentOffset/assignmentLimitdefault to 0 / 20 (max 100), withassignmentTotal,nextCall, andrevisionAssignment dates keep source precision and don't establish historical sitting status; contact details and photographs are excluded
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Riksdag-specific:
Keyless access to official document, speech, vote, and member endpoints, plus dated official reference tables
Document text as canonical Markdown or SFS source text, with separately selectable original HTML
Shared upstream concurrency, bounded public-response caching, and one 55-second deadline across queueing, retries, and text hydration
Historical coverage varies by record type; speeches and votes start in 1993/94, with gaps in older vote data
Agent-friendly output:
Source attribution, retrieval time, effective filters, and source warnings on both
content[]andstructuredContentComplete continuation calls for rows, sections, and text, with revision checks on local continuations; a changing remote document search is not a frozen snapshot
Page size is the caller's
limit(up to each tool's documented maximum, clamped with a notice); the server applies no response-size budget, and an oversized row returns wholeExplicit misses, unavailable text, unknown counts, and source service classifications; candidate saturation fails as
candidate_limit_reachedinstead of returning an incomplete traversalIdentifier, session, and date inputs advertise JSON Schema patterns that admit raw untrimmed values; a malformed value fails at the schema with a message naming the field
Agent skill
The server publishes one skill, sweden-parliament-guide (skills/sweden-parliament-guide/SKILL.md), covering identifier chains and gates across the riksdag_* tools. MCP clients read it as skill://sweden-parliament-guide/SKILL.md from resources/list; it also ships in the npm package, the Docker image, plugin installs, and the .mcpb bundle.
Getting started
Connect to the hosted instance, no install:
claude mcp add --transport http sweden-parliament-mcp-server https://sweden-parliament.caseyjhand.com/mcpOr run it locally:
claude mcp add sweden-parliament-mcp-server -- npx -y @cyanheads/sweden-parliament-mcp-serverFor other MCP clients, add this to your configuration:
{
"mcpServers": {
"sweden-parliament-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/sweden-parliament-mcp-server"]
}
}
}Riksdagen Open Data requires no API key or account. For Docker or a source build, see Running the server.
Configuration
Variable | Description | Default |
| Transport: |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level ( |
|
| Directory for log files (Node.js only). |
|
| Storage backend: |
|
| Enable OpenTelemetry. |
|
See .env.example for every server setting and the common framework overrides.
Running the server
Local development
Requires Bun v1.4.4 or higher (or Node.js v24+).
git clone https://github.com/cyanheads/sweden-parliament-mcp-server.git
cd sweden-parliament-mcp-server && bun install
cp .env.example .envThe environment file is optional; edit it for transport, authentication, or logging overrides.
Build and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:http # or bun run start:stdioRun checks and tests:
bun run devcheck # Lints, formats, type-checks, and more bun run test # Runs the test suite
Docker
docker run --rm -p 3010:3010 ghcr.io/cyanheads/sweden-parliament-mcp-server:latestThe image uses stateless HTTP and writes logs to /var/log/sweden-parliament-mcp-server. For stdio, use docker run -i --rm -e MCP_TRANSPORT_TYPE=stdio ghcr.io/cyanheads/sweden-parliament-mcp-server:latest as the client launch command. Build locally with docker build -t sweden-parliament-mcp-server .; add --build-arg OTEL_ENABLED=false to omit the optional OpenTelemetry dependencies.
Project structure
Directory | Purpose |
| Registers seven tools, initializes the service, and selects stateless HTTP sessions. |
| Seven read-only tool definitions; no resources or prompts of its own. |
| The published |
| Riksdagen endpoint parsing, reference tables, transport, cache, text conversion, and continuation. |
| Unit and integration tests, mirroring the |
See docs/tree.md for the full file tree.
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor logging,ctx.statefor storageRegister new tools and resources in the
createApp()arrays insrc/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Riksdagen (Swedish Parliament) open data MCP.
Swedish public data as read-only tools: registries, statistics, domains, transport, energy.
Search Swiss parliamentary business, votes, debates, members, and declared interests.
Official EUR-Lex, UK, US, and gazette search, metadata fetch, and change-only watches.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to query and retrieve real-time open data, documents, protocols, and records from the Swedish Parliament (Riksdag) and Government Offices through 32 specialized MCP tools.32MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to query Swedish Parliament open data through natural language.95 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables tracking of Canadian federal parliamentary records by searching bills, members, House divisions, and indexed Hansard speeches, then retrieving detailed dossiers, profiles, tallies, and full speech text from official public sources. Runs over STDIO or Streamable HTTP with no API key required.146 npm1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables discovery and retrieval of European Parliament procedures, MEPs, plenary votes, documents, speeches, and questions from the Open Data API over STDIO or Streamable HTTP.382 npm1Apache 2.0