Parlament Mcp

io.github.malkreide由 GitHub 帳號 malkreide 發布v0.4.1更新於 Oct 24, 2026

Swiss Federal Parliament Curia Vista OData API

概覽

AI 產生的概覽

唯讀 MCP 伺服器,讓助理檢索瑞士聯邦議會資料:動議、表決、議員、會期以及逐字辯論紀錄。

可以做什麼
依關鍵字、類型、狀態、議會或日期檢索議會事務(動議、質詢),並查看單一事務的完整詳情與文本。依州、黨派或議會尋找議員,並列出近期會期及其編號。查詢議會表決結果及贊成與反對的含義。檢索辯論紀錄,回傳附 AB 引註與來源連結的可引用摘錄,再依編號取得單篇發言的逐字全文,支援分頁並標示是否截斷。
適用情境
適合研究瑞士聯邦政治:尋找某議題上待決或已處理的動議、查看某位議員的表決立場,或引用議會中確切發言並附可查證的引註。它只涵蓋聯邦層級;州與市鎮議會由另一個伺服器負責。
執行需求
透過 stdio 在本機執行,通常以 uvx 從 parlament-mcp 的 PyPI 套件啟動(需要 Python)。不需 API 金鑰或帳號。需要能透過 HTTPS 存取 ws.parlament.ch 的 Curia Vista OData 介面。也可透過 MCP_TRANSPORT、MCP_HOST、MCP_BEARER_TOKENS 等環境變數以 HTTP/SSE 方式架設。
安裝前請注意
所有工具皆為唯讀,無法修改或刪除資料。資料來自瑞士議會官方服務,受其服務條款約束;結果帶有來源與授權資訊。逐字紀錄僅涵蓋 1999-12-06 之後,更早的辯論未包含在內。關鍵字加發言人的自由文字檢索可能耗時約 40 秒。若以 HTTP 架設,預設為開放存取,除非設定 MCP_BEARER_TOKENS;在容器外綁定 0.0.0.0 會暴露到本機網路。

安裝

在 SourceWeft 中

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

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

🇩🇪 Deutsche Version

🏛️ parlament-mcp

[CI] [PyPI version] [License: MIT] [Swiss Public Data MCP Portfolio]

Part of the Swiss Public Data MCP Portfolio – connecting AI models to Swiss public data sources.

Note: This server covers the federal level (Curia Vista). This repo additionally hosts a self-contained subproject under openparldata-mcp/ — the subnational counterpart for the 26 cantons and ~70 municipal parliaments (OpenParlData.ch). The two are independent servers.

An MCP server that connects AI models to the Swiss Federal Parliament via the Curia Vista OData API (ws.parlament.ch). Access motions, interpellations, votes, members, sessions, and the verbatim debate transcripts of the Amtliches Bulletin – with no API key required (Phase 1 – No-Auth-First).


🎯 Anchor Demo Queries

Metadata layer:

"Welche Vorstösse zu KI in der Schule sind hängig?" → parlament_search_business(keyword="KI", keyword2="Schule", status="Eingereicht")

Verbatim transcripts (Amtliches Bulletin):

"What did National Councillor Munz say in the 2024 spring session about the Volksschule? Give me the exact wording with a correct AB citation." → parlament_search_transcripts(speaker_name="Munz", session_id=5202, keyword="Volksschule") → then parlament_get_transcript(transcript_id=…) for the full wording.

Returns short, citable excerpts (AB 2024 N, 2024-03-13, Munz Martina) with a stable source URL; the verbatim text is fetched on demand, never in bulk.

→ More use cases by audience →

Perfect for the KI-Fachgruppe Stadtverwaltung Zürich: find pending motions on AI in education, or quote what was actually said in the chamber – instantly.

[Demo: Claude queries pending AI motions via MCP tool call]


🔧 Tools

ToolDescription
parlament_search_businessSearch Vorstösse by keyword, type, status, council, date
parlament_get_businessFull details of a single business (texts, FC response)
parlament_search_membersFind councillors by canton (e.g. ZH), party, council
parlament_get_votesParliamentary votes with Ja/Nein meaning
parlament_get_sessionsList recent sessions with IDs for follow-up queries
parlament_search_transcriptsSearch debate transcripts → citable excerpts with AB citation + source URL (speaker / session / business / date filters)
parlament_get_transcriptFetch the verbatim full text of a single speech by ID (capped, paginated, is_excerpt flagged)

🏗️ Architecture

┌──────────────────────────────────┐│     MCP Host (Claude Desktop /    ││     Claude API / IDE)             │└─────────────┬─────────────────────┘              │ MCP Protocol (JSON-RPC 2.0)              │ Transport: stdio (local) / SSE (cloud)┌─────────────▼─────────────────────┐│          parlament-mcp            ││   FastMCP · Python · Pydantic v2  ││                                   ││  ┌── metadata layer (server.py) ──┐│  │  search_business · get_business ││  │  search_members · get_votes     ││  │  get_sessions                   ││  └─────────────────────────────────┘│  ┌── transcript layer ────────────┐  ← separate module (transcripts.py)│  │  search_transcripts (excerpts) │    · Language='DE' dedups editions│  │  get_transcript (verbatim)     │    · Type=1 = real speeches only│  └─────────────────────────────────┘    · retry + 45s read timeout└─────────────┬─────────────────────┘              │ HTTPS / OData v3┌─────────────▼─────────────────────┐│  ws.parlament.ch / odata.svc      ││  Curia Vista – No Auth Required   ││                                   ││  Business · Vote · MemberCouncil  │   metadata path│  Session ─< Meeting ─< Subject ─< Transcript   transcript path└───────────────────────────────────┘

🚀 Installation

Claude Desktop (stdio)

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{  "mcpServers": {    "parlament": {      "command": "uvx",      "args": ["parlament-mcp"]    }  }}

Local development

bash
git clone https://github.com/malkreide/parlament-mcpcd parlament-mcppip install -e .python -m parlament_mcp.server

Cloud / Railway (SSE)

bash
MCP_TRANSPORT=sse MCP_HOST=0.0.0.0 PORT=8080 python -m parlament_mcp.server# SSE endpoint: http://your-host:8080/sse

Network binding

By default the server binds to 127.0.0.1 (localhost only). Set MCP_HOST=0.0.0.0 only inside a container/cloud context (Docker, Railway, Render, Kubernetes). Never bind to 0.0.0.0 on a local dev machine – it exposes the server to your local network (NeighborJack risk); the server logs a warning if you do so outside a detected container.

Transport is selected via MCP_TRANSPORT (stdio default, or sse / streamable-http); --http is kept as an alias for streamable-http.

Authentication (optional)

The HTTP transport is open by default (public read-only data). To require a bearer token, serve via the CORS/auth app factory and set MCP_BEARER_TOKENS:

bash
MCP_BEARER_TOKENS="alice:tok_abc,bob:tok_def" MCP_ALLOWED_ORIGINS="https://claude.ai" \  uvicorn parlament_mcp.server:create_http_app --factory --host 0.0.0.0 --port 8080

Each request then needs Authorization: Bearer <token>; identity comes from the validated token, not a session header (see docs/security.md).

Docker

bash
docker compose up --build          # binds 127.0.0.1:8080 only# or build the hardened image directly (non-root, read-only FS):docker build -t parlament-mcp .

Kubernetes manifests (hardened securityContext, resource limits, egress NetworkPolicy, Mcp-Session-Id sticky routing) live in deploy/k8s/; an HAProxy stick-table example is in deploy/haproxy.cfg.


🔗 Synergies

Partner ServerCombination
openparldata-mcpFederal ↔ subnational — same question across cantons & municipalities
fedlex-mcpLaw text ↔ parliamentary debate that created it
zurich-opendata-mcpCity policy ↔ cantonal/federal motions
swiss-statistics-mcpData backing ↔ motions citing statistics

Power query example:

"Zeige mir alle Zürcher Motionen zu KI in der Bildung und verlinke die relevanten Bundesgesetze aus fedlex-mcp."

📊 Data Source

  • API: ws.parlament.ch/odata.svc
  • Authentication: None (Phase 1 – No-Auth-First)
  • Protocol: OData v3 / JSON
  • Coverage: All parliamentary businesses since 1978; votes since ~2000. Structured verbatim transcripts (Amtliches Bulletin) from 1999-12-06 onward (earlier years 1891–1999 exist only as archive scans — see Known Limitations).
  • Update cycle: Real-time (official government data)

Copyright — verbatim quotation is allowed

Official proceedings of Swiss authorities are excluded from copyright under Art. 5 para. 1 lit. a URG (Swiss Copyright Act). The verbatim wording of parliamentary debates in the Amtliches Bulletin may therefore be reproduced and quoted freely — which is exactly what the transcript tools return: the wording itself, never a summary standing in for it.


📜 Data sources & licenses

SourceLicenseAttribution
Curia Vista (ws.parlament.ch)CC BY 4.0© Schweizer Parlament, CC BY 4.0

Every tool returns a typed structured response (FastMCP exposes the output schema) carrying source, license, provenance, match_type and count alongside typed results. Data is passed through unmodified.

🧭 Phase

This server is in Phase 1 — Read-only Wrapper (all tools readOnlyHint: true, no writes). The full phase model and transition criteria are in docs/roadmap.md.

🔖 MCP Protocol Version

This server speaks two protocol eras over the same endpoint. The client's first request on a connection decides which one applies; a later claim from the other era is refused.

EraRevisionWho reaches it
initialize handshake2024-11-05 … 2025-11-25What today's clients speak. The server answers with the revision asked for, or with the 2025-11-25 ceiling when the request asks for something newer.
Per-request envelope2026-07-28A request carrying the 2026-07-28 _meta envelope opens a modern connection.

Both revisions are pinned in tests/test_protocol_version.py and asserted against the installed SDK, so a Dependabot bump of mcp cannot move either one silently. The same file also measures the negotiation: one real client connection per era against the registered server, reading the revision off the connection instead of inferring it from a constant.

In the 2026-07-28 era there is no handshake to carry the server's identity; the SDK stamps io.modelcontextprotocol/serverInfo into the result _meta instead. The server passes its package version there (tests/test_server_info.py), so both eras report the same version.

Note that the SDK's LATEST_PROTOCOL_VERSION is an alias for the modern era, not for the handshake era — pinning against it alone would leave the era that current clients actually negotiate free to drift.

Update policy. When the gate fails, do not edit the constant blindly: read the spec changelog between the two revisions, verify the server still behaves, then move the constant, this section, README.de.md and CHANGELOG.md together.

🧱 MCP primitives

Phase 1 uses Tools only — rationale and the Phase-2 Resources plan are in docs/adr/ADR-003-mcp-primitives.md.

🏷️ Tool annotations

All tools declare explicit annotations consistent with their behaviour:

ToolreadOnlydestructiveidempotentopenWorld
parlament_search_business✅—✅✅
parlament_get_business✅—✅✅
parlament_search_members✅—✅✅
parlament_get_votes✅—✅✅
parlament_get_sessions✅—✅✅
parlament_search_transcripts✅—✅✅
parlament_get_transcript✅—✅✅

📈 Observability

Structured JSON logs go to stderr (stdout stays reserved for the stdio protocol). OpenTelemetry tracing wraps each tool call and auto-instruments outgoing HTTP; set OTEL_EXPORTER_OTLP_ENDPOINT (with the otel-export extra) to ship spans. See docs/security.md for the full security posture (Lethal-Trifecta assessment, egress allow-list, gateway hardening).


🛡️ Safety & Limits

AspectDetails
AccessRead-only (readOnlyHint: true) — the server cannot modify or delete any data
Personal dataParliamentary businesses are public record by law (BGÖ). No private data is accessed or stored.
Rate limitsBuilt-in per-query caps: max. 100 results (businesses/members), 50 (votes), 30 (transcript search), 10 (sessions). Transcript full text is capped per call and paginated — you never pull a whole session by accident.
Timeout20 seconds per metadata call; 45 seconds for transcript reads (verbatim search is heavier)
AuthenticationNo API keys required — Curia Vista is publicly accessible
Data sourceOfficial Swiss federal government data (Schweizerische Parlamentsdienste)
Terms of ServiceSubject to ToS of ws.parlament.ch — Schweizerische Parlamentsdienste

Known Limitations

General

  • OData substringof() filter is case-sensitive for some fields.
  • Session names may be null in the API for very recent sessions – use session ID.

Transcripts (Amtliches Bulletin) — verified live 2026-07-19:

  • Temporal coverage: from 1999-12-06 only. The structured Transcript entity reaches back to Dec 1999. Debates from 1891–1999 exist only as scanned archive documents (Bundesarchiv / Amtsdruckschriften) and are not connected here (no OCR in scope). A query whose whole date window predates coverage returns an explanatory error, not an empty result.
  • No page number in the source. The API carries no page/column field, so the classic AB <year> N <page> form cannot be built. We emit a stable, verifiable substitute — AB <year> <N|S>, <date>, <speaker> — plus the authoritative source_url (SubjectId) and the transcript_id. This is a documented, honest trade-off, not an omission.
  • Language behaviour (important). Language is the edition, not the spoken language. The tools filter Language eq 'DE' purely to deduplicate the three byte-identical editions (DE/FR/IT) down to one copy. Every speech is returned in its original wording; a French or Italian speech is not hidden — its real language is reported in the language field (de/fr/it). The response states this via language_note.
  • Truncation is explicit, never silent. Search returns short excerpts (snippet, ~320 chars) with is_excerpt, total_length_chars and a hint to fetch the full text. parlament_get_transcript caps output at max_chars; when it truncates it sets is_excerpt=True and returns a next_offset to continue.
  • Verbatim only, never summarised. The wording is the product; the tools never substitute a summary for the actual text.
  • Latency: a free-text keyword combined with a speaker_name is the slowest path (~40 s). Add a session_id, business_number or date window to keep reads around 1–2 s.

🧪 Testing

bash
pip install -e ".[dev]"
# Unit + mocked integration tests (no network), as run in CI:PYTHONPATH=src pytest tests/ -m "not live"
# Include live tests against the real ws.parlament.ch API:PYTHONPATH=src pytest tests/ -m live

HTTP is mocked with respx; network-dependent tests are marked @pytest.mark.live and excluded from CI via -m "not live". Tool definitions are pinned in tool-hashes.json (python -m parlament_mcp.tool_hashes --check).


Contributing

See CONTRIBUTING.md.


Security

See SECURITY.md for the security policy and posture (vulnerability reporting, Lethal-Trifecta assessment, accepted risks).


License

MIT © Hayal Oezkan — see LICENSE


Author

Hayal Oezkan · github.com/malkreide

Installation

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):

json
{  "mcpServers": {    "parlament-mcp": {      "command": "uvx",      "args": [        "parlament-mcp"      ]    }  }}

來源:README.md,提交 48a55f7

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v0.4.1最新Sep 27, 2026
  2. v0.3.5Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分