Lobbywatch Mcp

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

Lobbywatch.ch transparency data on parliamentarians, interests, access badges

已驗證STDIO僅桌面知識與記憶資料與分析

概覽

AI 產生的概覽

本機 MCP 伺服器,提供 Lobbywatch.ch 關於瑞士聯邦議員、申報利益關係、遊說團體與透明度評分的資料。

可以做什麼
依姓名或 ID 模糊查詢議員,查看完整檔案及所有申報利益衝突,可只篩選主要職業或仍有效的委託。依產業領域與委員會交叉檢索議員,並取得遊說團體及其關聯議員與組織。依準則、政黨或委員會取得排名前列名單,以及各委員會的報酬透明度評分分布。透過重新整理工具與狀態工具管理本機每週資料匯出檔。
適用情境
適合研究瑞士聯邦政治:議員與委員會的利益衝突、遊說關係、產業委託或報酬透明度。可搭配官方議會紀錄,回答某議員正式職務內容及其關聯對象的問題。
執行需求
需要 Python 3.11 或更新版本,透過 uvx 或 pip 在本機執行;需要網路連線下載每週 Lobbywatch JSON 匯出檔(壓縮後約 17 MB)。無需驗證或 API 金鑰。選用環境變數可控制傳輸方式、主機、連接埠、快取目錄與有效期、過期快取時限、逾時、CORS 來源、日誌與 OpenTelemetry。
安裝前請注意
會在本機下載並快取約 17 MB 的公開資料集,並連線 Lobbywatch.ch 端點;回應可能來自最長 7 天的快取並標示為過期。資料採 CC BY-SA 4.0 授權,需標示出處。僅建議在驗證閘道後方將 HTTP 綁定主機設為 0.0.0.0。目前匯出檔未包含出入證資料。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

🏛️ lobbywatch-mcp

[CI] [PyPI version] [Python] [License: MIT] [Data: CC BY-SA 4.0] [Swiss Public Data MCP Portfolio]

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.

🇩🇪 Deutsche Version

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 →

Demo

[Demo: Claude using lobbywatch_search_parlamentarier_nach_branche and lobbywatch_get_transparenzquote]


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 dataIF REST API is used only where it returns reliable data (lobby groups, search).
  • Stale-cache fallback, never silent. If the dump cannot be refreshed, a cached copy up to 7 days old answers instead, and every dump-backed response then carries a stale block with its download time, age and the reason the refresh failed. The source is retried every 15 minutes; lobbywatch_refresh_dump never falls back.
  • 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 — stdio for Claude Desktop, streamable-http / sse for 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):

bash
pip install lobbywatch-mcp

From source:

bash
git clone https://github.com/malkreide/lobbywatch-mcp.gitcd lobbywatch-mcppip install -e ".[dev]"

Usage

Standalone

bash
lobbywatch-mcp

This starts the server in stdio mode. For HTTP:

bash
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.

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

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.

ToolPurposeSource
lobbywatch_get_parlamentarier(name_or_id)Full profile + all conflicts of interestDump
lobbywatch_list_interessenbindungen(name_or_id, nur_hauptberuflich, nur_aktiv)Filtered mandate listDump
lobbywatch_search_parlamentarier_nach_branche(branche_query, kommission, limit)Cross-filter by industry and commissionDump
lobbywatch_get_lobbygruppe(name_or_id)Lobby group with connected MPs and organisationsLive dataIF
lobbywatch_get_ranking(kriterium, kommission, partei, limit)Top-N by criterionDump
lobbywatch_get_transparenzquote(kommission)Distribution of compensation transparency labelsDump
lobbywatch_refresh_dump() / lobbywatch_dump_status()Cache controlDump

Configuration

All behaviour is controlled via environment variables:

VariableDefaultPurpose
LOBBYWATCH_MCP_TRANSPORTstdioTransport (stdio, http, sse)
LOBBYWATCH_MCP_HOST127.0.0.1HTTP bind host (set to 0.0.0.0 only behind an auth gateway)
LOBBYWATCH_MCP_PORT8000HTTP bind port
LOBBYWATCH_MCP_CACHE_DIR~/.cache/lobbywatch-mcpDump cache location
LOBBYWATCH_MCP_CACHE_TTL86400 (24h)Cache time-to-live in seconds
LOBBYWATCH_MCP_STALE_MAX_AGE604800 (7 days)Oldest cached dump that may answer when the refresh fails, in seconds; 0 disables the fallback
LOBBYWATCH_MCP_HTTP_TIMEOUT60HTTP 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_FORMATtexttext (stdlib formatter) or json (structured via structlog)
LOBBYWATCH_MCP_LOG_LEVELINFODEBUG / INFO / WARNING / ERROR
LOBBYWATCH_MCP_OTEL_ENABLED0Set 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:

  1. Credit Lobbywatch.ch as the data source.
  2. Share derivative datasets under the same CC BY-SA 4.0 terms.
  3. 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/... dataIF REST 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.

Security

See SECURITY.md for the security posture, accepted-risk decisions, and how to report a vulnerability.

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 constants alone are the weaker form, so tests/test_spec_2026_07_28.py measures both eras through the assembled ASGI app: server/discover without a session, an initialize asking for a future revision capped at 2025-11-25, and every tool called over a 2026-07-28 connection with SDK deprecations raised as errors.

Native to 2026-07-28. lobbywatch_refresh_dump reports its progress as notifications/progress, which both eras deliver to any client that sends a progressToken. It used to log via notifications/message; logging is deprecated in 2026-07-28 (SEP-2577) and only delivered on requests that opt in with a log level, so modern clients silently received nothing. serverInfo now carries the package version — under 2026-07-28 it is stamped into the _meta of every response.

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.

Changelog

See CHANGELOG.md.

License

MIT License — see LICENSE. Data CC BY-SA 4.0 — see NOTICE.md.

Author

malkreide · GitHub


Part of the Swiss Public Data MCP Portfolio.

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": {    "lobbywatch-mcp": {      "command": "uvx",      "args": [        "lobbywatch-mcp"      ]    }  }}

來源:README.md,提交 5219951

工具

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

版本歷史

3
  1. v0.3.8最新Oct 14, 2026
  2. v0.3.7Sep 27, 2026
  3. v0.3.6Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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