gribs_mcp
MCP server for gribs.net, the Grünen-intern platform, providing read-only access to search and browse Antragsbörse posts and fetch recent public posts, with source URLs and timestamps for traceability.
README
gribs_mcp
MCP server for gribs.net — the Grünen-intern (party-internal), login-pflichtige KPV-Bayern platform hosting the Antragsbörse (Musteranträge, Beschlüsse, Positionspapiere) and secondary sections like Wissenswert, Mitgliederbriefe, and Mitgliederversammlungen.
This server exposes gribs.net content to AI harnesses (OpenCode) via the Model Context Protocol, giving an AI assistant read-only access to search and browse Antragsbörse posts and fetch the newest public posts. It is read-only by design — no writing, no triage, no uploads — and only surfaces content the running user is already authorized to see (login is handled via the user's own gribs.net credentials, cached locally).
Every politically relevant result carries a source URL and retrieval timestamp (Quellenpflicht) so downstream tools can cite where a claim came from and when it was fetched.
Tools
All tools are async, annotated readOnlyHint=True, and clamp limit parameters to [1, MAX]. Every result model carries url: str and retrieved_at: datetime (UTC).
| Tool | Description | Returns |
|---|---|---|
search_antraege(query, category?, whole_word?, l1?, l2?, l3?, limit?) |
Full-text search across a gribs section (default: Antragsbörse). Up to 50 hits. Pass l1/l2/l3 to scope to a subcategory. |
list[SearchHit] — title, snippet, wp_id, url, retrieved_at |
get_antrag(post_id) |
Fetch a single post (antrag) in full detail. | PostDetail — title, date, view_count, share_url, category_breadcrumb, body_html, body_text, url, retrieved_at |
resolve_post_id(wp_id) |
Resolve a WordPress wp_id (from search_antraege) to the internal post_id required by get_antrag. |
PostIdRef — wp_id, post_id, url, retrieved_at |
list_categories(category?) |
Enumerate the top-level (L1) sub-categories within a section (e.g. Umwelt, Soziales, …). | CategoryNode — id, label, children (recursive) |
list_antraege_in_category(category?, l1?, l2?, l3?, limit?) |
Drill into the category tree without a search query. Returns subcategories for intermediate nodes; leaves return an empty expansion (use search_antraege with l1/l2/l3 to list posts in a leaf). |
StructureExpansion — subcategories (list[CategoryNode]) or posts (list[PostTeaser]) |
recent_posts(limit?) |
Fetch the newest posts from the public gribs.net homepage (no login required). Enrichment is concurrent. | list[PostTeaser] — post_id, title, date, url, retrieved_at |
extract_downloads(post_id) |
Extract download links (PDFs and download-looking anchors) from a post body. | list[Download] — url, link_text, filename, is_pdf, source_post_id, source_url, retrieved_at |
Quellenpflicht: every tool that returns politically relevant data includes url + retrieved_at on each item. This is enforced at the Pydantic model layer, not by convention.
Library stack
| Aufgabe | Library | Lizenz |
|---|---|---|
| MCP framework | mcp (FastMCP) |
MIT |
| HTTP client | httpx |
BSD-3-Clause |
| Output models | pydantic |
MIT |
| HTML parsing (structure) | selectolax |
MIT |
| Article body extraction | trafilatura |
Apache-2.0 |
| OS credential/cookie storage | keyring |
MIT |
No Playwright. gribs.net's simple form-POST login (no SSO, no JS handshake, no CSRF) does not require a browser — pure httpx is sufficient and dramatically simpler. There is no uv run playwright install step.
Setup
# 1. Install dependencies (uv manages a virtualenv automatically).
uv sync
# 2. Store your gribs.net credentials in the OS keyring.
# This prompts for email + password via getpass (password is not echoed)
# and optionally performs a test login to verify the credentials work.
uv run python -m gribs_mcp.auth
# 3. (Optional) Smoke-test the server over stdio.
uv run gribs-mcp
For CI / headless setups, fall back to environment variables (the keyring is checked first, then env vars):
export GRIBS_EMAIL="you@example.org"
export GRIBS_PASSWORD="…"
Cookies are cached in the OS keyring under service name gribs_mcp and are automatically refreshed when they expire (30-day TTL) or when the API returns 401/403. There is no browser profile to manage.
Configure in OpenCode
Register gribs-mcp as a stdio MCP server in your opencode.json (analog to allgaeuer_zeitung_mcp):
{
"mcp": {
"gribs_mcp": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/gribs_mcp", "gribs-mcp"],
"enabled": true
}
}
}
Replace /path/to/gribs_mcp with the absolute path to this checkout. The gribs-mcp script entry point is defined in pyproject.toml ([project.scripts]).
Development
uv sync # install dev deps
uv run ruff check # lint (E/F/I/UP/B/SIM ruleset)
uv run ruff format --check # format check
uv run mypy src/ # strict type check
uv run pytest # tests (deterministic, no live HTTP)
All four gates must pass before merging. Tests use HTML/JSON fixtures under tests/fixtures/ — no live gribs.net calls, so they run offline and deterministically.
Architecture
src/gribs_mcp/
├── __main__.py # main() -> mcp.run(transport="stdio")
├── server.py # FastMCP instance + 7 @mcp.tool definitions (read-only)
├── models.py # Pydantic v2 models (frozen) with Quellenpflicht fields
├── client.py # httpx.AsyncClient + cookie jar + auth retry (GribsClient)
├── parsers.py # Pure HTML/JSON parsers (selectolax + trafilatura)
└── auth.py # keyring credential + cookie cache (30-day TTL)
Key design decisions:
- httpx-only login — gribs.net uses a plain form-POST to
/users/ajax_loginwith no SSO, no JS handshake, no CSRF token. A browser (Playwright) would be pure overhead. The client does a singlehttpx.AsyncClient.postand captures theSet-Cookiesession cookie. - Keyring cookie cache — credentials and session cookies are persisted in the OS keyring (service
gribs_mcp), not on disk. A 30-day TTL plus per-cookieexpireschecks gate freshness; on 401/403 the client clears the cache and re-logs in (serialized by anasyncio.Lockto avoid concurrent-login races). - JSON vs HTML response handling — gribs is inconsistent:
/members/structure,/members/singlepost, and/members/expandStructurereturn JSON{error, ...}with HTML snippets inside;/members/searchand/post/recentpostsreturn raw HTML. The client has separate_post_form_json/_post_form_htmlpaths sharing one retry helper. - HTML-entity-encoded onclick args — the live
structexp(...)calls innavigationHTML encode their object's quotes as". Parsers callhtml.unescape()before parsing the JS object (shared_parse_js_objecthelper). - Concurrent enrichment —
recent_postsfetches the scaffold, then fires allpostWidgetFillenrichment calls concurrently viaasyncio.gather(3 parallel requests for the default 3 posts). Order is preserved (gather guarantees positional ordering). - Read-only tools + Quellenpflicht — every tool is annotated
readOnlyHint=True; every politically relevant output model carriesurl: str+retrieved_at: datetime(UTC) at the Pydantic schema level, so a missing source is a type error, not a convention violation.
Categories (live-verified)
The category parameter on search_antraege, list_categories, and list_antraege_in_category accepts these names:
| Category name | cat_id | Status |
|---|---|---|
Antragsbörse |
1 | verified |
Wissenswert |
2 | verified |
Arbeit im Rat |
5 | verified |
Mitgliederbriefe |
6 | verified |
DenkWerkstatt |
7 | verified |
Mitgliederversammlungen |
8 | verified |
Kommunalwahl |
9 | verified |
Known limitations / roadmap
list_antraege_in_categoryon leaf nodes returns an empty expansion — gribs.net's/members/expandStructurereturns a search form (not post listings) when called on a leaf subcategory. To list posts in a subcategory, callsearch_antraegewith the samel1/l2/l3ids and a broad query (e.g. 'a' or 'der' — gribs doesn't support an empty searchstring).extract_downloadskeyword heuristic — links are included if the URL ends in.pdfOR the anchor text contains a download keyword (download/pdf/antrag/vorlage/beschluss/musterantrag/herunterladen). This may produce false positives (e.g. a non-download link mentioning "antrag") or miss downloads with non-standard anchor text. Theis_pdfflag distinguishes confirmed PDFs.
Reverse-engineering notes
Key facts about the gribs.net API (verified live 2026-07-18):
- Login:
POST /users/ajax_loginwithemail,password,keep=true. No SSO, no CSRF. Returns a 15-byte non-JSON status; success is signalled bySet-Cookie. - API shape: all calls are POST
application/x-www-form-urlencodedwith headerX-Requested-With: XMLHttpRequest. Responses are either JSON{error, ...}with HTML snippets inside (structure, singlepost, expandStructure) or raw HTML (search, recentposts). - ID duality: posts have an internal
post_id(needed by/members/singlepost) AND a WordPresswp-ID (returned by/members/searchin?wp=<id>deep-links), plus an optional?h=<hash>share link. Useresolve_post_idto bridgewp_id→post_id. - wp_id → post_id resolution:
GET /?wp=<id>withfollow_redirects=Truereturns the member page at/members/home/wp-<id>, which contains"post_id":"<N>"in a JSON-ish JS blob. - Recent posts:
/post/recentpostsreturns only scaffolds (post_id + spinner); the browser lazy-loads each teaser via/members/postWidgetFillwithpost_id+caller. Therecent_poststool does this concurrently.
License
MIT (placeholder pending final decision).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。