MCP server for the Lobbywatch.ch lobby database โ conflicts of interest of Swiss parliamentarians
Project description
๐๏ธ lobbywatch-mcp
An MCP server that connects AI models to Lobbywatch.ch, the largest lobby database of the Swiss Federal Parliament โ conflicts of interest, lobby groups, access badges, and transparency scores.
Part of the Swiss Public Data MCP Portfolio โ connecting AI models to Swiss public data sources.
๐ฏ Anchor Demo Query
"Welche Mitglieder der WBK-N haben Interessenbindungen zu Bildungsverlagen oder privaten Bildungstrรคgern, und wie ist ihre Transparenz-Bewertung?"
Which members of the National Council's Education Commission have declared conflicts of interest with educational publishers or private education providers, and how does their compensation transparency score compare?
โ More use cases by audience โ
Overview
Lobbywatch.ch maintains the largest public database on Swiss federal parliamentarians and their connections to lobby organisations: 245 parliamentarians, ~7'800 interessenbindungen (declared mandates), 139 lobby groups, 368 access-badge holders, updated weekly, licensed CC BY-SA 4.0.
lobbywatch-mcp exposes this data to Large Language Models via the Model Context Protocol. It is designed to be used alongside parlament-mcp (the official Swiss Parliament's Curia Vista data): the pair makes it possible to ask what a parliamentarian did officially and who they are connected to โ in a single conversation.
Features
- Dump-first, API-fallback architecture. The weekly JSON dump is the primary source (stable, verified in production); the live
dataIFREST API is used only where it returns reliable data (lobby groups, search). - Seven Phase 1 tools โ parliamentarian lookup, conflict-of-interest listing, branche search, lobby group fetch, rankings, transparency quota, cache control.
- CC BY-SA 4.0 attribution baked into every response via Pydantic envelopes.
- Dual transport โ
stdiofor Claude Desktop,streamable-http/ssefor cloud deployments. - Fuzzy name matching via rapidfuzz for natural LLM input like "Jositsch" or "Wehrli".
- No authentication required (Phase 1 โ No-Auth-First).
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
LLM client โ LobbywatchClient โ
(Claude Desktop, โ โ
Inspector, โฆ) โ โโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ Dump cache โ โ cms.lobbywatch.ch
โ MCP โ โ (24 h TTL, โ โ โโโโโโโโโโโโโโโโโโโโ
โผ stdio / โ โ ~80 MB resident)โโโโโโโผโโโโโโบโ weekly JSON โ
โโโโโโโโโโโ HTTP โ โโโโโโโโโโโโโโโโโโโโโ โ โ export (~17 MB) โ
โ FastMCP โโโโโโโบโ โ โโโโโโโโโโโโโโโโโโโโ
โ server โ โ โโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโ โ โ dataIF REST โโโโโโโผโโโโโโบโ /interface/v1/ โ
โ โ (live fallback) โ โ โ json/โฆ โ
โ โโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Outbound HTTP runs through a single httpx.AsyncClient with follow_redirects=False, an SSRF guard that blocks RFC1918 / link-local / metadata IPs, and an httpx event hook that re-resolves on every request. The dump path is the primary source of truth for parliamentarian queries; dataIF is only used for lobby group lookups and the search endpoint.
Prerequisites
- Python 3.11 or newer
- Internet access to download the weekly Lobbywatch JSON export (~17 MB zipped)
Installation
From PyPI (after first release):
pip install lobbywatch-mcp
From source:
git clone https://github.com/malkreide/lobbywatch-mcp.git
cd lobbywatch-mcp
pip install -e ".[dev]"
Usage
Standalone
lobbywatch-mcp
This starts the server in stdio mode. For HTTP:
LOBBYWATCH_MCP_TRANSPORT=http LOBBYWATCH_MCP_PORT=8000 lobbywatch-mcp
Container
A hardened multi-stage Dockerfile ships with the repo (non-root,
read-only-rootfs compatible). See docs/deployment.md
and deploy/docker-compose.example.yml
for resource limits, sticky-LB guidance and egress hardening.
docker build -t lobbywatch-mcp:0.2.0 .
docker run --rm -p 127.0.0.1:8000:8000 lobbywatch-mcp:0.2.0
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"lobbywatch": {
"command": "uvx",
"args": ["lobbywatch-mcp"]
}
}
}
A full example is provided in claude_desktop_config.json.
Example Queries
Once connected, try prompts such as:
- "Give me the top 10 parliamentarians by number of interessenbindungen in the SP party."
- "Which WBK-N members have mandates in the publishing or education industry?"
- "Look up the lobby group 'economiesuisse' and list its connected parliamentarians."
- "What is the compensation-transparency score distribution for the finance commission (FK-N)?"
Tools
All tool names use the lobbywatch_ namespace prefix (since 0.2.0) to
avoid collisions with sibling portfolio servers.
| Tool | Purpose | Source |
|---|---|---|
lobbywatch_get_parlamentarier(name_or_id) |
Full profile + all conflicts of interest | Dump |
lobbywatch_list_interessenbindungen(name_or_id, nur_hauptberuflich, nur_aktiv) |
Filtered mandate list | Dump |
lobbywatch_search_parlamentarier_nach_branche(branche_query, kommission, limit) |
Cross-filter by industry and commission | Dump |
lobbywatch_get_lobbygruppe(name_or_id) |
Lobby group with connected MPs and organisations | Live dataIF |
lobbywatch_get_ranking(kriterium, kommission, partei, limit) |
Top-N by criterion | Dump |
lobbywatch_get_transparenzquote(kommission) |
Distribution of compensation transparency labels | Dump |
lobbywatch_refresh_dump() / lobbywatch_dump_status() |
Cache control | Dump |
Configuration
All behaviour is controlled via environment variables:
| Variable | Default | Purpose |
|---|---|---|
LOBBYWATCH_MCP_TRANSPORT |
stdio |
Transport (stdio, http, sse) |
LOBBYWATCH_MCP_HOST |
127.0.0.1 |
HTTP bind host (set to 0.0.0.0 only behind an auth gateway) |
LOBBYWATCH_MCP_PORT |
8000 |
HTTP bind port |
LOBBYWATCH_MCP_CACHE_DIR |
~/.cache/lobbywatch-mcp |
Dump cache location |
LOBBYWATCH_MCP_CACHE_TTL |
86400 (24h) |
Cache time-to-live in seconds |
LOBBYWATCH_MCP_HTTP_TIMEOUT |
60 |
HTTP timeout in seconds |
LOBBYWATCH_MCP_CORS_ORIGINS |
(unset) | Comma-separated origin allow-list for HTTP/SSE; when set, exposes Mcp-Session-Id to browsers |
LOBBYWATCH_MCP_LOG_FORMAT |
text |
text (stdlib formatter) or json (structured via structlog) |
LOBBYWATCH_MCP_LOG_LEVEL |
INFO |
DEBUG / INFO / WARNING / ERROR |
LOBBYWATCH_MCP_OTEL_ENABLED |
0 |
Set to 1 to enable OpenTelemetry tracing (requires pip install 'lobbywatch-mcp[obs]') |
LOBBYWATCH_MCP_OTEL_ENDPOINT |
(unset) | OTLP/HTTP collector endpoint (e.g. http://localhost:4318/v1/traces) |
Project Structure
lobbywatch-mcp/
โโโ src/lobbywatch_mcp/
โ โโโ __init__.py
โ โโโ __main__.py # CLI + transport selection
โ โโโ config.py # URLs, cache paths, attribution
โ โโโ client.py # Dump download + dataIF client
โ โโโ models.py # Pydantic v2 response envelopes
โ โโโ server.py # FastMCP tool registrations
โโโ tests/
โ โโโ conftest.py # Fixture parliamentarians
โ โโโ test_client.py # Respx-mocked unit tests
โ โโโ test_server.py # Tool integration tests
โ โโโ test_live.py # @pytest.mark.live โ excluded from CI
โโโ .github/workflows/
โ โโโ ci.yml # Test matrix + ruff
โ โโโ publish.yml # PyPI OIDC Trusted Publisher
โโโ claude_desktop_config.json
โโโ pyproject.toml
โโโ ...
Data License & Attribution
The code is released under the MIT License.
The data served through this MCP is ยฉ Lobbywatch.ch and licensed under CC BY-SA 4.0. Every response envelope includes the attribution string. Downstream users must:
- Credit Lobbywatch.ch as the data source.
- Share derivative datasets under the same CC BY-SA 4.0 terms.
- Understand that Lobbywatch is a community-researched database โ not an official register. It is authoritative for transparency research but should not be confused with the Federal Parliament's own declarations.
Known Limitations
- The upstream
/table/parlamentarier/...dataIFREST endpoint currently returns empty result sets. The server works around this by using the weekly JSON dump instead. zutrittsberechtigungen(access badges) are not populated in the "essential" dump variant used here. A future release will add a dedicated tool using the non-essential dump.
Contributing
See CONTRIBUTING.md.
Changelog
See CHANGELOG.md.
License
MIT License โ see LICENSE. Data CC BY-SA 4.0 โ see LICENSE ยง Data notice.
Author
malkreide ยท GitHub
Part of the Swiss Public Data MCP Portfolio.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lobbywatch_mcp-0.3.0.tar.gz.
File metadata
- Download URL: lobbywatch_mcp-0.3.0.tar.gz
- Upload date:
- Size: 76.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c976a8737c269e59022886e58944f0f08306cbafb29ee5f15d14438d423ad25f
|
|
| MD5 |
39413d12b110de74b8e612fffdb47e8f
|
|
| BLAKE2b-256 |
c6038f9fecbaaa7f1b9818838306e1e6e625a6aa9cac18e6b9c5027b7e0c066d
|
Provenance
The following attestation bundles were made for lobbywatch_mcp-0.3.0.tar.gz:
Publisher:
publish.yml on malkreide/lobbywatch-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lobbywatch_mcp-0.3.0.tar.gz -
Subject digest:
c976a8737c269e59022886e58944f0f08306cbafb29ee5f15d14438d423ad25f - Sigstore transparency entry: 1490828070
- Sigstore integration time:
-
Permalink:
malkreide/lobbywatch-mcp@9aa397cd9d836a3cb0cfdb92eaaecde7de9410b0 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/malkreide
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9aa397cd9d836a3cb0cfdb92eaaecde7de9410b0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lobbywatch_mcp-0.3.0-py3-none-any.whl.
File metadata
- Download URL: lobbywatch_mcp-0.3.0-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eac83ed6e951a512bf00cdb8024c23d8fd74bf3fbc1e16c5b70311e7ca155552
|
|
| MD5 |
a1e8eae21fde2995c3e1ec4816b43e9c
|
|
| BLAKE2b-256 |
068b73c8a531b04592e83edaff19cbeca386679688505e52f6efb0346993c599
|
Provenance
The following attestation bundles were made for lobbywatch_mcp-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on malkreide/lobbywatch-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lobbywatch_mcp-0.3.0-py3-none-any.whl -
Subject digest:
eac83ed6e951a512bf00cdb8024c23d8fd74bf3fbc1e16c5b70311e7ca155552 - Sigstore transparency entry: 1490828230
- Sigstore integration time:
-
Permalink:
malkreide/lobbywatch-mcp@9aa397cd9d836a3cb0cfdb92eaaecde7de9410b0 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/malkreide
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9aa397cd9d836a3cb0cfdb92eaaecde7de9410b0 -
Trigger Event:
push
-
Statement type: