Skip to main content

MCP server for the Swiss Parliament (Curia Vista OData API)

Project description

๐Ÿ›๏ธ 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.

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 debate transcripts โ€“ with no API key required (Phase 1 โ€“ No-Auth-First).


๐ŸŽฏ Anchor Demo Query

"Welche Vorstรถsse zu KI in der Schule sind hรคngig?" โ†’ parlament_search_business(keyword="KI", keyword2="Schule", status="Eingereicht")

โ†’ More use cases by audience โ†’

Perfect for the KI-Fachgruppe Stadtverwaltung Zรผrich: find pending motions on AI in education, digitisation initiatives, or any policy topic โ€“ instantly.

Demo: Claude queries pending AI motions via MCP tool call


๐Ÿ”ง Tools

Tool Description
parlament_search_business Search Vorstรถsse by keyword, type, status, council, date
parlament_get_business Full details of a single business (texts, FC response)
parlament_search_members Find councillors by canton (e.g. ZH), party, council
parlament_get_votes Parliamentary votes with Ja/Nein meaning
parlament_get_sessions List recent sessions with IDs for follow-up queries
parlament_get_transcripts Debate excerpts by keyword or speaker (Amtliches Bulletin)

๐Ÿ—๏ธ 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 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚ HTTPS / OData v3
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ws.parlament.ch / odata.svc     โ”‚
โ”‚  Curia Vista โ€“ No Auth Required  โ”‚
โ”‚                                  โ”‚
โ”‚  Business ยท Vote ยท MemberCouncil โ”‚
โ”‚  Session ยท Transcript ยท ParlGroupโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Installation

Claude Desktop (stdio)

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

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

Local development

git clone https://github.com/malkreide/parlament-mcp
cd parlament-mcp
pip install -e .
python -m parlament_mcp.server

Cloud / Railway (SSE)

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:

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

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 Server Combination
fedlex-mcp Law text โ†” parliamentary debate that created it
zurich-opendata-mcp City policy โ†” cantonal/federal motions
swiss-statistics-mcp Data 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 and transcripts
  • Update cycle: Real-time (official government data)

๐Ÿ“œ Data sources & licenses

Source License Attribution
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

Tested/targeted against MCP spec 2025-06-18 (pinned as PROTOCOL_VERSION in src/parlament_mcp/config.py). SDK updates are proposed monthly via Dependabot; spec-version bumps are recorded in CHANGELOG.md.

๐Ÿงฑ 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:

Tool readOnly destructive idempotent openWorld
parlament_search_business โœ… โ€” โœ… โœ…
parlament_get_business โœ… โ€” โœ… โœ…
parlament_search_members โœ… โ€” โœ… โœ…
parlament_get_votes โœ… โ€” โœ… โœ…
parlament_get_sessions โœ… โ€” โœ… โœ…
parlament_get_transcripts โœ… โ€” โœ… โœ…

๐Ÿ“ˆ 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

Aspect Details
Access Read-only (readOnlyHint: true) โ€” the server cannot modify or delete any data
Personal data Parliamentary businesses are public record by law (BGร–). No private data is accessed or stored.
Rate limits Built-in per-query caps: max. 100 results (businesses/members), 50 (votes/transcripts), 10 (sessions)
Timeout 20 seconds per API call
Authentication No API keys required โ€” Curia Vista is publicly accessible
Data source Official Swiss federal government data (Schweizerische Parlamentsdienste)
Terms of Service Subject to ToS of ws.parlament.ch โ€” Schweizerische Parlamentsdienste

Known Limitations

  • OData substringof() filter is case-sensitive for some fields
  • Transcript text search can be slow for very broad queries (use limit to control)
  • Session names may be null in the API for very recent sessions โ€“ use session ID
  • Language filter is mandatory; currently only DE is fully tested (FR, IT available)

Contributing

See CONTRIBUTING.md.


License

MIT malkreide

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parlament_mcp-0.3.0.tar.gz (69.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parlament_mcp-0.3.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file parlament_mcp-0.3.0.tar.gz.

File metadata

  • Download URL: parlament_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for parlament_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ca17d924efdeaf345ab0e979033bab09279088651e5bf19d3e2967c7c395d989
MD5 1adae70e89c5d0a9a5fdcd05ab952aee
BLAKE2b-256 2bd32ae62dcf062bb2c33b2242f960e4df24bc6a551752e236959bc0048c1d2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for parlament_mcp-0.3.0.tar.gz:

Publisher: publish.yml on malkreide/parlament-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parlament_mcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: parlament_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for parlament_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e364070adf4be9c0e7f444c7fa60aad211b4ab9f7d773a8d61f32c8b8d6727
MD5 a2e8a196ad10ce76d6c4eb041742a0d0
BLAKE2b-256 3f44594cbbda043dfd3e508529645971c9e1d3ee08c2b452b2e1b1e8666030f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for parlament_mcp-0.3.0-py3-none-any.whl:

Publisher: publish.yml on malkreide/parlament-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page