Sweden Parliament Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.1.2更新於 Nov 2, 2026

Search Swedish parliamentary documents, speeches, votes, members, and statutes.

已驗證Streamable HTTP可網頁執行網頁搜尋與抓取知識與記憶

概覽

AI 產生的概覽

檢索並讀取瑞典議會公開資料中的文件、演說、表決、議員資料與合併版 SFS 法規。

可以做什麼
  • 查詢文件類型、委員會、政黨、選區、會期與識別碼慣例等官方參考表
  • 依關鍵字、類型、會期、委員會、政黨、議員或日期檢索議會文件與合併版 SFS 法規,並讀取中繼資料、決定、保留意見、連結與分頁正文
  • 依會期、標題、議員或政黨檢索演說,並讀取完整演說內容
  • 讀取報告決定、政黨主表決分組、單一議題的個人投票,或某位議員在會期內的主表決紀錄
  • 依姓名、政黨、選區與服務狀態尋找議員與部長,並讀取其任期經歷
適用情境
適合需要研究瑞典立法資料的情境:追蹤提案與委員會報告、掌握已公布的決定與表決、引用演說內容,或核對議員任期與法規文本。適用於依賴瑞典議會官方開放資料的研究、新聞與政策工作。
執行需求
可使用公開託管端點,或以 npx(Node.js)、Docker、原始碼建置(Bun 1.4.0+ 或 Node.js 24+)在本機執行。不需要 API 金鑰或帳號。選用設定包括 MCP_TRANSPORT_TYPE、MCP_HTTP_PORT、MCP_AUTH_MODE、MCP_LOG_LEVEL 以及儲存與 OpenTelemetry 選項。需要能連線至瑞典議會開放資料的網路。
安裝前請注意
七個工具皆為唯讀,不會寫入、傳送或刪除資料。回傳內容包含標題、姓名、決定等來源資料,伺服器要求助理將其視為資料而非指令。SFS 文本為已公布的合併版本,可能包含尚未生效的條文,並非某一時點的法律版本;表決資料僅涵蓋已公布的主表決。此服務為獨立第三方,未獲瑞典議會背書。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Sweden Parliament Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.cyanheads%2Fsweden-parliament-mcp-server/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "sweden-parliament": {
      "type": "http",
      "url": "https://sweden-parliament.caseyjhand.com/mcp"
    }
  }
}

README

@cyanheads/sweden-parliament-mcp-server

Search Swedish parliamentary documents, speeches, votes, members, and statutes via MCP. STDIO or Streamable HTTP.

7 Tools


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

ToolDescription
riksdag_list_referenceBrowse official document types, committees, parties, constituencies, sessions, and identifier and coverage guidance
riksdag_search_documentsSearch parliamentary documents and consolidated SFS statutes by words, type, session, committee, party, member, or dates
riksdag_get_documentRead publication metadata, decisions, reservations, activities, links, and paginated text
riksdag_search_speechesFind speeches within a session by debate heading, member, or party; retrieve full text through get mode
riksdag_get_votesRead report decisions, party main-vote totals, individual ballots for a point, or one member's session main votes
riksdag_search_membersFind register entries by name, party, constituency, and source service classification
riksdag_get_memberRead an exact member IID and its published assignment history

Capability reference

riksdag_list_reference tool

  • topic: document_types, committees, parties, constituencies, speech_types, sessions, identifiers, or coverage
  • Dated 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 accepted
  • Sessions accept YYYY/YY, consecutive YYYY/YYYY, or a historical calendar year; 1999/00 retains the published 1999/2000 form
  • offset pagination; limit defaults to 20, clamped to 100, with totalCount and nextCall

riksdag_search_documents tool

  • Optional query, documentType, session, committee, party, memberId, dateFrom, and dateTo; dates use YYYY-MM-DD, and codes or exact reference labels are accepted. memberId selects source-linked participants, without inferring authorship
  • sort is relevance for a nonblank query and date otherwise; either can be selected explicitly. Source subtitles include available author and SFS consolidation labels
  • Remote page starts at 1; pageSize defaults to 10 and is clamped to 50. Large pages split into whole-row responses with offset and revision; follow nextCall to finish that remote page before advancing, keeping pageSize fixed
  • Use documentType: "sfs" for consolidated statutes; narrow slow full-text searches with session or documentType

riksdag_get_document tool

  • Required documentId from search, or an SFS identifier (1974:152, SFS 1974:152, sfs-1974-152); misses return found: false. Omit sections for metadata, the outline, and the first text page, or select from metadata, decisions, reservations, activities, properties, attachments, references, stakeholders, text, source_html
  • Text and HTML page by Unicode code point (textOffset / textLength, htmlOffset / htmlLength), starting at 8,000 by default and fitting the complete response. Explicit lengths are honored. Array sections use sectionOffset / sectionLimit (default 20, clamped to 100). Follow nextTextCall, nextHtmlCall, or sectionPages[].nextCall with revision; a changed record fails with revision_changed
  • Decisions 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) requires session; optional memberId, party, speechType: "all" | "speech" (speech excludes replies), and headingContains, which matches all tokens in headings and subheadings, never body text. limit defaults to 5 (max 20); textCount defaults to 1 (max 5, 0 for metadata only)
  • mode: "get" reads one speechId copied from a search item (not sourceSpeechId) and pages the body with textOffset / textLength and nextTextCall. Default text pages start at 8,000 code points and fit the complete response; explicit lengths are honored
  • textState is included, not_requested, unavailable, or failed, with recovery details on transient failures; retain revision on continuations
  • A missing detail, including an exact zero-byte HTTP 200 source response, returns found: false in get mode or textState: "unavailable" during search hydration

riksdag_get_votes tool

  • Required mode and session. mode: "report" takes report (FiU20 or 2024/25:FiU20) or a report documentId, plus one point or pointOffset / pointLimit (default 5, max 10); mode: "member" takes memberId, optional party, and offset / limit (default 20, max 500)
  • Report points carry the authoritative decision and party aggregates separated by source avser; rollCallState is available, acclamation, not_published, or unknown, and acclamation requires explicit decision evidence, never just empty vote rows. Incomplete groups retain unknown counts and observed labels; extra vote labels land in otherVotes
  • With an explicit report point, ballots: true adds individual votes and independent ballotPage pagination using offset / limit. Follow ballotPage.nextCall with both revision and ballotRevision; report-point counts keep their existing meaning
  • Published main votes only, not every ballot round; follow nextCall with revision for 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 timeout
  • Optional nameContains matches all tokens as substrings, ignoring case and diacritics. party and constituency accept codes or exact labels. sitting: "all" | "serving" | "not_serving" (default all) filters source service labels, including serving substitutes, without establishing elected membership
  • offset pagination; limit defaults to 20, clamped to 100. Returns actual candidateCount, filtered totalCount, sourceReportedCount, revision, and nextCall. Source-reported hits can differ from returned all-register records; a notice discloses this, and neither count is an independent historical census
  • memberId keeps leading zeros. Entries without an IID return detailAvailable: false; their sourceRecordId is a different identifier and can't be passed to riksdag_get_member

riksdag_get_member tool

  • Required numeric-string memberId, leading zeros included; copy it from a member search result with detailAvailable: true. Misses return found: false with guidance
  • Register metadata and assignments in source order; assignmentOffset / assignmentLimit default to 0 / 20 (max 100), with assignmentTotal, nextCall, and revision
  • Assignment 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[] and structuredContent
  • Complete continuation calls for rows, sections, and text, with revision checks on local continuations; a changing remote document search is not a frozen snapshot
  • Explicit misses, unavailable text, unknown counts, and source service classifications; candidate saturation fails as candidate_limit_reached instead of returning an incomplete traversal

Getting started

Connect to the hosted instance, no install:

sh
claude mcp add --transport http sweden-parliament-mcp-server https://sweden-parliament.caseyjhand.com/mcp

Or run it locally:

sh
claude mcp add sweden-parliament-mcp-server -- npx -y @cyanheads/sweden-parliament-mcp-server

For other MCP clients, add this to your configuration:

json
{  "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

VariableDescriptionDefault
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTHTTP server port.3010
MCP_SESSION_MODEHTTP session mode: stateless, stateful, or auto.stateless
MCP_AUTH_MODEAuthentication: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (debug, info, warning, error, etc.).info
LOGS_DIRDirectory for log files (Node.js only).<app-root>/logs
STORAGE_PROVIDER_TYPEStorage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1.in-memory
OTEL_ENABLEDEnable OpenTelemetry.false

See .env.example for every server setting and the common framework overrides.

Running the server

Local development

Requires Bun v1.4.0 or higher (or Node.js v24+).

sh
git clone https://github.com/cyanheads/sweden-parliament-mcp-server.gitcd sweden-parliament-mcp-server && bun installcp .env.example .env

The environment file is optional; edit it for transport, authentication, or logging overrides.

  • Build and run the production version:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:http# orbun run start:stdio
  • Run checks and tests:

    sh
    bun run devcheck  # Lints, formats, type-checks, and morebun run test      # Runs the test suite

Docker

sh
docker run --rm -p 3010:3010 ghcr.io/cyanheads/sweden-parliament-mcp-server:latest

The 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

DirectoryPurpose
src/index.tsRegisters seven tools, initializes the service, and selects stateless HTTP sessions.
src/mcp-server/tools/definitionsSeven read-only tool definitions; no resources or prompts.
src/services/riksdagRiksdagen endpoint parsing, reference tables, transport, cache, text conversion, and continuation.
tests/Unit and integration tests, mirroring the src/ structure.

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/catch in tool logic
  • Use ctx.log for logging, ctx.state for storage
  • Register new tools and resources in the createApp() arrays in src/index.ts
  • Wrap 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:

sh
bun run devcheckbun run test

License

Apache-2.0 — see LICENSE for details.

來源:README.md,提交 ce95779

工具

7

riksdag_list_reference

Riksdag List Reference

Look up official document types, committees, parties, constituencies, speech reply filters, sessions, identifier conventions and source coverage. The offline snapshot is dated; follow nextCall to read every entry. Document subtypes remain distinct from parent document-type codes, and the session catalog can lag current sessions.

輸入參數limittopic必填offset

riksdag_search_documents

Search parliamentary documents

Search Swedish parliamentary documents and consolidated SFS statutes by words, document type, session, committee, party, member IID or dates. Choose relevance or descending date ordering and follow complete continuation calls. Read document status and text with riksdag_get_document.

輸入參數pagesortpartyquerydateTooffsetsessiondateFrommemberIdpageSizerevisioncommittee另有 1 個

riksdag_get_document

Read parliamentary document

Read a document status, decisions, linked records and text. Select sections and follow complete continuation calls to read long reports or consolidated SFS statutes. SFS text is consolidated published text, not a point-in-time legal version.

輸入參數revisionsectionsdocumentId必填htmlLengthhtmlOffsettextLengthtextOffsetsectionLimitsectionOffset

riksdag_search_members

Search parliamentary members

Find members and ministers by name, party, constituency and service status. Defaults to the service register; register all includes earlier source records through a larger cold request that may time out. Use numeric memberId with riksdag_get_member for assignment history.

輸入參數limitpartyoffsetsittingregisterrevisionconstituencynameContains

riksdag_get_member

Read parliamentary member

Read one member register entry and assignment history by exact member ID. Assignment dates preserve source precision and do not establish historical sitting status.

輸入參數memberId必填revisionassignmentLimitassignmentOffset

riksdag_search_speeches

Search and read parliamentary speeches

Search speeches within a required parliamentary session, optionally by member, party, reply exclusion and heading tokens. Heading matching searches debate headings only, never body text. Search hydrates one text page by default; use get mode with an item speechId to read all remaining text and retain the returned revision for continuation.

輸入參數modelimitpartyoffsetsessionmemberIdrevisionspeechIdtextCountspeechTypetextLengthtextOffset另有 1 個

riksdag_get_votes

Read parliamentary main votes

Read authoritative report decisions and party main-vote groups separated by avser, or a member’s session main votes. Report mode requires report or documentId; ballots true with an explicit point adds individual member ballots and independent ballotPage continuation. Member mode requires memberId. Follow complete local continuation calls. Main votes do not include every ballot round; empty rows never prove acclamation.

輸入參數mode必填limitpartypointoffsetreportballotssession必填memberIdrevisiondocumentIdpointLimit另有 2 個

版本歷史

2
  1. v0.1.2最新Oct 26, 2026
  2. v0.1.1Oct 25, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分