swiss-democracy-mcp
This server lets you query Swiss direct democracy data β federal votes since 1848, elections since 1900, and real-time results β through MCP tools.
Search and filter all federal popular votes since 1848 by keyword, date range, legal form, result, or policy domain.
Get full vote details: official title, parliamentary positions, national result, and signatures.
View party positions (FDP, SP, SVP, Die Mitte, GPS, GLP, etc.) and campaign finance links for a vote.
Retrieve results for all 26 cantons, including yes percentage, turnout, and accepted flags.
List all voting dates with the number of proposals per date.
Access BFS real-time or archived vote results (since 1981) at national, cantonal, or municipality level.
Query SRGSSR Polis historical votations and elections since 1900, optionally with municipal-level detail (requires API key).
All operations are read-only; Swissvotes and BFS tools work without any authentication, while Polis tools need optional SRGSSR credentials.
Provides access to historical votations and elections since 1900 with municipality-level detail using the SRGSSR Polis API (requires OAuth2 key).
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@swiss-democracy-mcp search for votes on climate change since 2020"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π³οΈ swiss-democracy-mcp
π¨π Part of the Swiss Public Data MCP Portfolio β connecting AI models to Swiss institutional data sources.
π English | π©πͺ Deutsche Version
An MCP server providing access to Swiss direct democracy data, covering all federal popular votes since 1848 and elections since 1900.
Demo Query
Β«Wie hat der Kanton ZΓΌrich bei der AHV 21 Initiative 2022 abgestimmt,
und welche Parteien unterstΓΌtzten die Vorlage?Β»β democracy_search_votes(keyword="AHV 21", year_from=2022)
β democracy_get_cantonal_results(vote_number="551")
β democracy_get_party_positions(vote_number="551")
β More use cases by audience β
Related MCP server: parlament-mcp
Data Sources
Source | Coverage | Auth |
Swissvotes (Uni Bern) | All federal votes since 1848 Β· 874 columns Β· party positions Β· cantonal results | None β |
Real-time & archive (since 1981) Β· municipality level | None β | |
Votes & elections since 1900 Β· municipality detail | OAuth2 key |
Tools
Phase 1 β Swissvotes (No Auth Required)
Tool | Description |
| Search all federal popular votes since 1848 by keyword, date range, legal form, outcome, policy domain |
| Full details for a specific vote: official title, parliamentary positions, national result, signatures |
| Party recommendations (FDP, SP, SVP, Die Mitte, GPS, GLP, β¦) with campaign finance data |
| Results for all 26 cantons: yes%, turnout, accepted flag |
| List all voting dates with number of proposals per date |
Phase 2 β BFS Real-Time (No Auth Required)
Tool | Description |
| List all BFS voting dates (archive + current) |
| Real-time or archived results at national, cantonal, or municipality level |
Phase 3 β SRGSSR Polis (API Key Required)
Tool | Description |
| Historical votations since 1900 with municipality-level data |
| Full Polis detail, optionally with all municipality results |
| National Council, Council of States, and cantonal elections since 1900 |
Installation
Claude Desktop (stdio)
Add to claude_desktop_config.json:
{
"mcpServers": {
"swiss-democracy": {
"command": "uvx",
"args": ["swiss-democracy-mcp"],
"env": {
"SRGSSR_CONSUMER_KEY": "your_key_here",
"SRGSSR_CONSUMER_SECRET": "your_secret_here"
}
}
}
}The
SRGSSR_*variables are optional. Without them, all Swissvotes and BFS tools remain fully functional. Only the Polis tools require credentials.
Cloud / Render.com (Streamable HTTP)
pip install swiss-democracy-mcp
# Bind to all interfaces ONLY inside a container/cloud environment:
MCP_TRANSPORT=streamable_http MCP_HOST=0.0.0.0 MCP_PORT=8000 python -m swiss_democracy_mcp.serverMCP_HOST defaults to 127.0.0.1 (loopback). Set MCP_HOST=0.0.0.0 only
inside a sandboxed container/cloud deployment β never on a local machine, where
it would expose the server to your whole network.
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββ
β Claude / LLM Host β
ββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β MCP (stdio / Streamable HTTP)
ββββββββββββββββΌβββββββββββββββββββββββββββββββ
β swiss-democracy-mcp β
β β
β βββββββββββββββββββββββββββββββββββββββ β
β β Swissvotes CSV Cache (24h TTL) β β
β β All 874 columns, since 1848 β β
β ββββββββββββββββ¬βββββββββββββββββββββββ β
β β β
β ββββββββββββββββΌβββββββββββββββββββββββ β
β β BFS / opendata.swiss (no auth) β β
β β Real-time & archive since 1981 β β
β ββββββββββββββββ¬βββββββββββββββββββββββ β
β β β
β ββββββββββββββββΌβββββββββββββββββββββββ β
β β SRGSSR Polis (OAuth2, optional) β β
β β Votes & elections since 1900 β β
β βββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββTransport: stdio for Claude Desktop Β· Streamable HTTP for cloud/Render.com
Auth pattern: No-Auth-First β Swissvotes & BFS work without any credentials
Cache: Swissvotes CSV is loaded once at startup and cached for 24 hours
Configuration
All configuration is via environment variables (see .env.example):
Variable | Default | Purpose |
|
|
|
|
| HTTP bind address β set |
|
| HTTP port |
|
| structured JSON logs go to stderr |
| β | comma-separated CORS allow-origins for the HTTP transport. Empty means no browser client is permitted; |
| β | comma-separated inbound |
| β | optional, only for |
Secrets are held as SecretStr and never logged. See
docs/secret-management.md and
docs/security.md.
MCP Primitives
This server intentionally exposes Tools only (no Resources or Prompts). It is
a Phase-1 read-only data wrapper (see docs/roadmap.md); the
tool surface is small (10 use-case-oriented tools) and every response is
self-contained with source provenance. Resources (e.g. vote://{anr}) are a
candidate for a later phase once the URI scheme stabilises.
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.
Era | Revision | Who reaches it |
|
| What today's clients speak. The server answers with the revision asked for, or with the |
Per-request envelope |
| A request carrying the |
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. Next to them,
tests/test_server_identity.py sends real
requests through the assembled ASGI app: a per-request envelope is answered
with the tool list, and an initialize that offers the modern revision still
gets the handshake ceiling back. The constants say which revisions the SDK
knows; the measurement says which ones this server serves.
Server identity. Under the handshake era serverInfo is named once, in the
initialize reply. The modern era has no handshake and stamps the identity
onto every response instead, as
_meta["io.modelcontextprotocol/serverInfo"]. Implementation.version is a
required schema field that the SDK pre-fills with "" when the constructor
omits it, so an unset version is not a gap but a value on the wire β and one
that a green test suite will not show you. This server passes its distribution
version explicitly; test_server_identity.py measures it on both wires, with a
bare MCPServer as the negative control.
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.
Portfolio Synergy
Combine with other servers in the Swiss Public Data MCP portfolio:
zurich-opendata-mcp β add Zurich city-level statistics to vote analysis
swiss-statistics-mcp β enrich with BFS demographic data by canton
srgssr-mcp β link SRF news archive content to specific vote dates
Example multi-server query:
Β«Vergleiche die Abstimmungsresultate zur AHV-Reform mit der Altersstruktur der KantoneΒ»
β swiss-democracy-mcp + swiss-statistics-mcp
Safety & Limits
Read-only: All tools perform HTTP GET requests only β no data is written, modified, or deleted upstream.
Egress allow-list (SSRF protection): Outbound requests are restricted to a fixed allow-list of trusted hosts (
swissvotes.ch,opendata.swiss,*.bfs.admin.ch,api.srgssr.ch), HTTPS only. Caller-supplied URLs (the BFSresult_url) are additionally resolved and rejected if they point at private, loopback or cloud-metadata IP ranges.No personal data: Swissvotes, BFS and SRGSSR Polis expose aggregate democratic data (vote results, party positions, cantonal/municipality tallies). No personally identifiable information (PII) is processed or stored by this server.
Rate limits: Swissvotes is a single CSV downloaded once per 24h and cached in memory. BFS / opendata.swiss and SRGSSR Polis are public APIs without documented rate limits β keep
limitand date ranges conservative. The server enforces a 30s timeout per request.Data freshness: Real-time BFS results reflect the upstream feed at query time (no local caching). Swissvotes is refreshed every 24h from the Uni Bern mirror.
Terms of service: Data is subject to the ToS of each source β swissvotes.ch (CC BY 4.0, Uni Bern), opendata.swiss (mostly CC-BY / Open by Default), SRGSSR Polis (free tier, non-commercial use only). Always cite the upstream source in downstream products.
No guarantees: This server is a community project, not affiliated with the University of Bern, the Federal Statistical Office, or SRG SSR. Availability depends on upstream APIs.
Known Limitations
Swissvotes coverage: Cantonal-level results are available since 1848; municipality-level results only via SRGSSR Polis (since ~1990s depending on the vote).
BFS archive: Real-time service covers federal votes since 1981 only.
Polis tools: Require free registration at developer.srgssr.ch. Non-commercial use only.
CSV cache: The Swissvotes dataset is ~several MB and is cached in memory for 24 hours. Memory footprint is accordingly higher than API-only servers.
Testing
# Unit tests (no network required)
PYTHONPATH=src pytest tests/ -m "not live" -v
# Live tests (require network access)
PYTHONPATH=src pytest tests/ -m "live" -vWhere the test data comes from
The fixtures under tests/fixtures/ are recorded from the live sources and
dated. Source, retrieval date, selection rule and SHA-256 for every file:
tests/fixtures/PROVENANCE.md.
python scripts/record_fixtures.py # re-recordThe selection rule is the point here. The Swissvotes dataset has 714 rows
and 874 columns, and the recorded rows are chosen by property, not by
position. "The first N rows" would cut away exactly the cells the fixture
exists for: the placeholders 9999 ("no information") and . ("not
applicable"), which appear in 667 of the 714 votes. A fixture without them
would look clean and prove nothing β which is precisely why nobody noticed the
tools were passing them through as if they were values.
The byte-order mark stays in the file too, because the source sets one and the server strips it explicitly. Without it the fixture could not show that it has to.
SRGSSR Polis needs OAuth credentials and is listed under NOT RECORDED in
PROVENANCE.md rather than given a date it never had.
Contributing
See CONTRIBUTING.md (π©πͺ Deutsch).
Security
See SECURITY.md (π©πͺ Deutsch) for the security posture and vulnerability reporting.
License
MIT β see LICENSE.
Data licenses:
Swissvotes: Creative Commons BY 4.0
BFS / opendata.swiss: Open use
SRGSSR Polis: Non-commercial use only β see developer.srgssr.ch
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):
{
"mcpServers": {
"swiss-democracy-mcp": {
"command": "uvx",
"args": [
"swiss-democracy-mcp"
]
}
}
}Available Tools
10 toolsdemocracy_bfs_get_vote_resultsARead-onlyIdempotent
Ruft Echtzeit- oder Archiv-Abstimmungsresultate vom BFS ab.
<use_case>Resultate auf Gemeinde-/Kantons-/Bundesebene, v.a. am Abstimmungssonntag.</use_case>
Nutzt die direkte JSON-URL eines Abstimmungsdatums (aus democracy_bfs_list_vote_dates). Gibt Resultate pro Vorlage auf nationaler, kantonaler oder Gemeindeebene zurΓΌck. Am Abstimmungssonntag werden die Daten laufend aktualisiert.
Args: params (BfsVoteResultInput): EnthΓ€lt: - result_url (str): URL aus democracy_bfs_list_vote_dates - level (str): 'national', 'cantonal' oder 'municipality'
Returns: str: JSON mit Abstimmungsresultaten pro Vorlage
Inputs: params (required). Returns: result
democracy_bfs_list_vote_datesARead-onlyIdempotent
Listet alle verfΓΌgbaren eidgenΓΆssischen Abstimmungsdaten im BFS-Echtzeit-Webservice auf.
<use_case>Einstieg in BFS-Echtzeit-/Archivdaten; liefert die Ressourcen-URLs fΓΌr democracy_bfs_get_vote_results.</use_case>
Die Daten werden am Abstimmungssonntag ab 12:00 Uhr laufend aktualisiert. Das Archiv enthΓ€lt eidgenΓΆssische Abstimmungen seit 1981.
Returns: str: JSON mit verfΓΌgbaren Abstimmungsdaten und deren Ressource-URLs
Inputs: no named parameters. Returns: result
democracy_get_cantonal_resultsARead-onlyIdempotent
Gibt die Abstimmungsresultate aller 26 Kantone fΓΌr eine eidgenΓΆssische Volksabstimmung zurΓΌck.
<use_case>Kantonsvergleich und StΓ€ndemehr-Analyse zu einer Vorlage.</use_case>
Inkl. Stimmberechtigte, abgegebene Stimmen, gΓΌltige Stimmen, Ja- und Nein-Stimmen, Ja-Prozent und ob der Kanton angenommen hat (fΓΌr StΓ€ndemehr-ZΓ€hlung).
Args: params (VoteDetailInput): EnthΓ€lt: - vote_number (str): Abstimmungsnummer (anr)
Returns: str: JSON mit kantonalen Resultaten (26 Kantone), nationalem Total und Stimmenmehr/StΓ€ndemehr-Γbersicht
Inputs: params (required). Returns: result
democracy_get_party_positionsARead-onlyIdempotent
Gibt die Parteiparolen der grossen Schweizer Parteien zu einer Volksabstimmung zurΓΌck.
<use_case>Analyse von Parteilinien und Kampagnen-Finanzierung zu einer Vorlage.</use_case>
Dekodiert die numerischen Parolen-Codes aus Swissvotes in lesbare Labels: 1=Ja, 2=Nein, 3=Stimmfreigabe, 4=Nein zum Gegenentwurf, 5=Ja zum Gegenentwurf, 66=Keine Parole gefasst, 9=Unbekannt.
Args: params (VoteDetailInput): EnthΓ€lt: - vote_number (str): Abstimmungsnummer (anr)
Returns: str: JSON mit Parteiparolen und Links zu Ja-/Nein-Komitees
Inputs: params (required). Returns: result
democracy_get_vote_detailARead-onlyIdempotent
Gibt vollstΓ€ndige Details zu einer eidgenΓΆssischen Volksabstimmung zurΓΌck.
<use_case>Vertiefung zu einer konkreten Vorlage (Parlamentsempfehlungen, Resultat, Beteiligung).</use_case>
Inkl. offiziellem Titel, Rechtsform, Parlamentsempfehlungen (NR, SR, Bundesrat), Abstimmungsresultat (national und kantonal), Beteiligung, Finanzierungsdaten und Link zur Swissvotes-Seite.
Args: params (VoteDetailInput): EnthΓ€lt: - vote_number (str): Abstimmungsnummer (anr) aus democracy_search_votes
Returns: str: JSON mit vollstΓ€ndigen Vote-Details oder Fehlermeldung
Inputs: params (required). Returns: result
democracy_list_vote_datesARead-onlyIdempotent
Listet alle eidgenΓΆssischen Abstimmungsdaten auf, an denen Vorlagen zur Abstimmung kamen.
<use_case>Orientierung/Navigation vor einer Detailabfrage.</use_case>
Gibt fΓΌr jedes Datum die Anzahl Vorlagen zurΓΌck. NΓΌtzlich zur Orientierung vor einer Detailabfrage.
Args: params (ListDatesInput): Optionaler Zeitraumfilter (year_from, year_to)
Returns: str: JSON mit Liste von Abstimmungsdaten und Anzahl Vorlagen pro Datum
Inputs: params (required). Returns: result
democracy_polis_get_votation_detailARead-onlyIdempotent
Gibt detaillierte Polis-Daten zu einer Volksabstimmung zurΓΌck.
<use_case>Gemeindescharfe Detailanalyse einer historischen Abstimmung.</use_case>
Optional mit Gemeinde-Resultaten β ideal fΓΌr Fragen wie Β«Wie hat die Stadt ZΓΌrich bei der AHV-Reform abgestimmt?Β». BenΓΆtigt SRGSSR_CONSUMER_KEY und SRGSSR_CONSUMER_SECRET.
Args: params (PolisVotationDetailInput): EnthΓ€lt: - votation_id (str): Polis-ID aus democracy_polis_list_votations - lang (str): Ausgabesprache - include_municipalities (bool): Gemeinderesultate einschliessen
Returns: str: JSON mit Polis-Abstimmungsdetails, kantonalen und optionalen Gemeindedaten
Inputs: params (required). Returns: result
democracy_polis_list_electionsARead-onlyIdempotent
Ruft historische Wahlen (National-/StΓ€nderat, Regierungsrat) aus Polis ab.
<use_case>Wahlanalysen (Kandidierende, Parteistimmen) seit 1900.</use_case>
Polis enthΓ€lt Wahlresultate seit 1900, inkl. Kandidatinnen- und Parteistimmen. BenΓΆtigt SRGSSR_CONSUMER_KEY und SRGSSR_CONSUMER_SECRET.
Args: params (PolisElectionInput): EnthΓ€lt: - year_from/year_to (int): Zeitraumfilter - lang (str): Ausgabesprache - limit (int): Max. Resultate
Returns: str: JSON mit Wahlliste oder Hinweis zur Registrierung
Inputs: params (required). Returns: result
democracy_polis_list_votationsARead-onlyIdempotent
Ruft historische Volksabstimmungen aus dem SRGSSR Polis-System ab (seit 1900).
<use_case>Historische Analysen mit Gemeinde-GranularitΓ€t.</use_case>
Polis enthΓ€lt Resultate auf Gemeinde-Ebene, was fΓΌr historische Analysen besonders wertvoll ist. BenΓΆtigt SRGSSR_CONSUMER_KEY und SRGSSR_CONSUMER_SECRET.
Args: params (PolisListInput): EnthΓ€lt: - year_from/year_to (int): Zeitraumfilter - lang (str): Sprache ('de', 'fr', 'it', 'rm', 'en') - limit/offset (int): Pagination
Returns: str: JSON mit Polis-Abstimmungsliste oder Hinweis zur Registrierung
Inputs: params (required). Returns: result
democracy_search_votesARead-onlyIdempotent
Durchsucht alle eidgenΓΆssischen Volksabstimmungen seit 1848 (Swissvotes-Datenbank).
<use_case>Politische/journalistische Recherche: Vorlagen nach Thema, Zeitraum oder Ergebnis finden.</use_case>
Filtert nach Stichwort, Zeitraum, Rechtsform, Ergebnis und Politikbereich. Gibt Titel, Datum, Rechtsform, Ja-Anteil, Beteiligung und Bundesratsempfehlung zurΓΌck.
Args: params (VoteSearchInput): Suchparameter mit optionalen Feldern: - keyword (str): Freitextsuche im Titel (DE/EN) - year_from/year_to (int): Zeitraumfilter - legal_form (str): 'initiative', 'obligatorisch', 'fakultativ' - result (str): 'angenommen' oder 'abgelehnt' - policy_domain (str): Politikbereich-Stichwort - limit (int): Max. Resultate (Standard: 20) - offset (int): Pagination-Offset
Returns: str: JSON mit 'total', 'count', 'offset', 'has_more', 'votes' (Liste von Vote-Objekten mit vote_number, date, title_de, legal_form, accepted, yes_percent, turnout_percent, federal_council_position)
Inputs: params (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 10 tools
Most tools are cleanly separated by data source and action: search, detail, party positions, and cantonal results are distinct views of a vote, while the bfs and polis prefixes identify alternative sources. The main potential confusion is between the two date-listing tools and between Swissvotes and Polis for historical vote lookup, but the descriptions clarify the source and purpose.
Names follow a consistent democracy_<source>_<verb>_<object> pattern using list, get, and search verbs. Minor inconsistencies exist: 'vote' and 'votation' are used interchangeably, and the BFS tools place the source prefix differently, but the overall pattern is predictable.
Ten tools is well-scoped for a server covering three Swiss democracy data sources: Swissvotes, BFS realtime results, and SRGSSR Polis. Each tool serves a distinct query or detail need, and the count is neither bloated nor too thin.
The Swissvotes side covers search, detail, party positions, and cantonal results, while BFS covers recent/real-time results and Polis covers historical votes with municipality detail and election lists. The main gap is that Polis elections lack a detail/drill-down tool, and there is no direct cross-linking between Swissvotes and BFS result URLs, but core research workflows are supported.
Maintenance
Related MCP Connectors
opendata.swiss MCP β Switzerland's federal open-data portal (CKAN catalogue).
MCP server for Brazilian Federal Senate open data (legislative, administrative, e-Cidadania).
An MCP server that provides congressional transcripts
Abgeordnetenwatch MCP β German federal & state parliament data.
Related MCP Servers
- AlicenseBqualityBmaintenanceSwiss open data MCP server β transport, weather, geodata, companies, etc,. Zero API keys.5424 npm28MIT
- AlicenseAqualityBmaintenanceAn MCP server connecting AI models to the Swiss Federal Parliament via the Curia Vista OData API, enabling queries of motions, votes, members, sessions, and debate transcripts without authentication.754 PyPI2MIT
- AlicenseAqualityDmaintenanceAn unofficial MCP server for accessing Swiss Federal Statistical Office (BFS) data.81MIT

entscheidsuche-mcpofficial
AlicenseNot gradedqualityCmaintenanceMCP server for Swiss court decisions, enabling full-text search and retrieval of published decisions from all Swiss federal and cantonal courts in German, French, and Italian.4MIT