abgeordnetenwatch-mcp

v0.13.1
@maschinenlesbar.org/abgeordnetenwatch-mcp Checked 3 days ago Published 11 days ago

MCP server for the open abgeordnetenwatch.de parliamentary data API: politicians, voting records, side jobs, polls and their results, for AI agents (stdio and…

Query Germany's parliamentary-monitoring data — politicians, mandates, votes, committees and disclosed side jobs — from your terminal. abgeordnetenwatch is a command-line tool and TypeScript client for the open abgeordnetenwatch.de API v2: list any of 18 entity collections, filter and sort them, fetch single records, count matches, and pipe the JSON straight into jq. This installs the abgeordnetenwatch command. Requires Node.js 22.12+.

Summary extracted from the README.

abgeordnetenwatch-cli

CI Release npm

Website: English · Deutsch — command reference, guides and API docs

Query Germany's parliamentary-monitoring data — politicians, mandates, votes, committees and disclosed side jobs — from your terminal. abgeordnetenwatch is a command-line tool and TypeScript client for the open abgeordnetenwatch.de API v2: list any of 18 entity collections, filter and sort them, fetch single records, count matches, and pipe the JSON straight into jq.

  • Works out of the box — no account, no API key, no configuration.
  • Clean JSON output — pretty-printed by default, --compact for scripting.
  • Four commands — list, get, count, entities.
  • Read-only, open data — the public API needs no credentials, and the data is CC0 1.0 (public domain); see DATA_LICENSE.md.

Want to use this as a TypeScript library or understand how it's built? See DEVELOPING.md. The full API reference lives in openapi.yaml.

Install

npm i -g @maschinenlesbar.org/abgeordnetenwatch-cli

This installs the abgeordnetenwatch command. Requires Node.js 22.12+.

abgeordnetenwatch --help
abgeordnetenwatch entities          # the 18 collections you can query

Docker

From 0.10.0 every release is also a container image for linux/amd64 and linux/arm64 on the GitHub Container Registry, made from the same tarball as the npm package. It needs no Node.js and no install:

docker run --rm --read-only --cap-drop ALL --security-opt no-new-privileges \
  ghcr.io/maschinenlesbar-org/abgeordnetenwatch-cli:latest list parties --range-end 3

The image's entrypoint is the program, so the command follows the image name directly; … abgeordnetenwatch-cli:latest abgeordnetenwatch list … works too.

In a container with a memory limit (--memory) the default --max-response-bytes is an eighth of that limit (at most the usual 100 MiB), so an oversized answer is refused with a clear error instead of the container being killed for memory. The CLI needs at least 12 processes and threads (--pids-limit 12): below that it refuses with an error, and with 4 or fewer Node.js itself hangs before the CLI can check.

latest is the newest release. For scripts, name a release and pin its digest, which the release notes give: …/abgeordnetenwatch-cli:0.10.0@sha256:<digest>. Each image carries signed build provenance; check it with

gh attestation verify oci://ghcr.io/maschinenlesbar-org/abgeordnetenwatch-cli:latest \
  --repo maschinenlesbar-org/abgeordnetenwatch-cli

MCP server

From 0.11.0 the same data is also an MCP server for AI agents, @maschinenlesbar.org/abgeordnetenwatch-mcp (command abgeordnetenwatch-mcp, image ghcr.io/maschinenlesbar-org/abgeordnetenwatch-mcp): eight read-only tools, among them a politician's voting record, side jobs and a poll's result fraction by fraction, on stdio or Streamable HTTP. Setup for Claude Code, Claude Desktop and VS Code: MCP.md.

npm i -g @maschinenlesbar.org/abgeordnetenwatch-mcp
claude mcp add abgeordnetenwatch -- abgeordnetenwatch-mcp

Quickstart

# How many female politicians are in the database?
abgeordnetenwatch count politicians sex=f

# Five politicians born after 1990, sorted by surname (A to Z; --sort-by alone sorts Z to A)
abgeordnetenwatch list politicians 'year_of_birth[gt]=1990' \
  --sort-by last_name --sort-direction asc --range-end 5 --data-only

# Fetch one party
abgeordnetenwatch get parties 2 --data-only

# Every individual vote in poll 6569 (the data array only)
abgeordnetenwatch list votes poll=6569 --data-only | jq '.[].vote' | sort | uniq -c

Commands

Command What it does
list <entity> [filters...] List a collection, with optional filters, --sort-by/--sort-direction, and --range-start/--range-end paging.
get <entity> <id> Fetch a single entity by id.
count <entity> [filters...] Print { entity, total } — the number of matches.
entities List the 18 available entity collections.

--data-only (on list/get) prints just the data payload instead of the full { meta, data } envelope.

New to terms like mandate, poll or fraction? The Glossary explains every entity, its key fields and the filter syntax.

Filtering

Add filters as key=value arguments after the entity:

  • Equality: sex=f, year_of_birth=1980

  • Related entity by id: politician=184945, poll=6569

  • Comparison operators — field[op]=value with op one of eq, ne, gt, gte, lt, lte, cn (contains), sw (starts-with): 'year_of_birth[gt]=1990', 'last_name[sw]=Mü'

    (Quote any filter containing [ ] so your shell doesn't glob it.)

A key is at most 100 characters (a field name and an operator are far shorter). Each filter key may appear once, and every option takes one value: giving one twice (sex=f sex=m, --range-end 5 --range-end 500) is a usage error, never "the last one wins". Text values are sent in composed Unicode (NFC), the only form the API matches: a Müller pasted with a combining umlaut finds the same records as one typed on the keyboard. Surrounding whitespace is dropped, since the API doesn't trim it: last_name='Scholz ' (a trailing space from a spreadsheet) finds the same records as last_name=Scholz, so a value can't start or end with a space. A value that holds a control character or an invisible one a paste brings along (a zero-width space, a soft hyphen, a bidi control), or nothing but such characters, is a usage error rather than a search that finds nothing; the error shows the character as an escape ("\u200bScholz"). --sort-by takes a field name (letters, digits and _), sent without surrounding whitespace: --sort-by 'last_name ' sorts by last_name, and --sort-by 'last_name[gt]' is a usage error.

Paging

--range-end is the page size (number of items). The API honours it up to 1000; a value above 1000 is ignored and the API falls back to its default page size of 100. Use --range-start to offset into the next page; count reports the true total.

Entities

parliaments, parliament-periods, politicians, candidacies-mandates, committees, committee-memberships, polls, votes, parties, fractions, election-program, electoral-lists, constituencies, sidejobs, sidejob-organizations, topics, cities, countries.

See openapi.yaml for every field of every entity.

Global options

--base-url <url>, --timeout <ms>, --user-agent <ua>, --max-retries <n> (transient 429/503 and reset connections, 0..10; each retry logs one WARN record of abgeordnetenwatch.http before it waits, HTTP 503 from host: retry 1 of 3 in 2 s), --max-response-bytes <n>, --log-format <format> (text or jsonl, see below), --compact.

Credentials in --base-url (https://user:pw@mirror.example, for a proxy or mirror; the API itself needs none) are sent as HTTP Basic auth and shown as *** in everything the CLI prints, usage errors included. A base URL is spelled http(s):// and the host, without a query, fragment or backslash; anything else is a usage error.

A base URL on plain http: to a host other than loopback (localhost, 127.0.0.0/8, ::1) works, but the CLI writes one warning record to stderr before the first request, e.g. … WARN [abgeordnetenwatch.http] requests to mirror.example are sent unencrypted (http:, not https:), or … WARN [abgeordnetenwatch.http] the base URL's credentials are sent unencrypted to mirror.example (http:, not https:) when the URL carries userinfo. stdout and the exit code are unchanged.

Every command prints JSON to stdout; errors, warnings and notes go to stderr, so piping stdout into jq stays clean. Each line on stderr is a log record: a timestamp (UTC), a level (ERROR, WARN, INFO) and a topic, the program and the area it comes from (abgeordnetenwatch.cli for usage errors, abgeordnetenwatch.api for the API's answers and their hints, a malformed one included, abgeordnetenwatch.http for the connection (the cleartext warning, and one WARN per retry), abgeordnetenwatch.output for output that fails: an answer nested too deeply or too large to print, a failed or cut-short write to stdout). By default it is written log4j style; --log-format jsonl writes one JSON object per line instead (ts, level, topic, msg). A record is always one line: a line break, a control character or a bidi control in a message is written as an escape (\n, \u001b, \u202e), so it can neither split a record nor forge another one, nor steer the terminal. A value you typed keeps every character, escaped; in a server's text (an error message, a Content-Type) the control characters other than tab and line break are removed before that, so what a server sends can't drive the terminal even inside an escape. A message longer than 4000 characters is cut and ends in … (N more characters):

2026-10-09T14:03:12.481Z WARN  [abgeordnetenwatch.http] requests to mirror.example are sent unencrypted (http:, not https:)
2026-10-09T14:03:12.902Z ERROR [abgeordnetenwatch.api] HTTP 500 for GET https://www.abgeordnetenwatch.de/api/v2/parties/999999: There is no party entity with id 999999
abgeordnetenwatch --log-format jsonl get parties 999999 2>log.jsonl   # {"ts":"…","level":"ERROR","topic":"abgeordnetenwatch.api","msg":"HTTP 500 …"}

Text in an answer is never changed silently: bytes that are not valid in its charset and half characters (lone surrogates) are replaced with U+FFFD, so the output stays readable for jq, and a WARN record of abgeordnetenwatch.api says how many. An answer too deep or too large to pretty-print says which of the two it is, and suggests --compact only when --compact prints that answer.

The service rate-limits bursts with HTTP 429; the client retries these automatically (up to --max-retries, default 2), backing off 1 s, 2 s, … or waiting the server's Retry-After when that is longer, up to 30 s. The error ends (after N retries) when they ran out (a reset connection too: GET <url> failed: socket hang up (after 2 retries)). Every network failure names the request this way, a timeout included (GET <url> failed: Request timed out after 500ms). When the server asks for a longer wait the CLI does not retry at all and says so (the server asked to retry after 120 s, longer than the 30 s the client waits; not retried): wait that long before trying again. Sending a descriptive --user-agent is appreciated by the provider.

Exit codes

0 success · 1 runtime/network/server error · 2 usage error (unknown entity, bad option/filter) · 4 HTTP 404 (unknown collection path).

A reader that stops early (abgeordnetenwatch list votes poll=6569 | head -c 100) is ordinary use: the CLI exits 0 quietly. If stderr's reader is gone (2>&1 | true), a failed run still exits with its own code.

Note: the API returns HTTP 500 (not 404) for a missing id; the CLI surfaces the reason from meta.status_message and exits 1.

Claude Code skills

Three Agent Skills teach Claude Code to use this CLI for real questions: summarise a politician's roll-call voting record (abgeordnetenwatch-voting-record), surface disclosed side income (abgeordnetenwatch-sidejobs), and show how each fraction voted on a named roll call (abgeordnetenwatch-poll-breakdown). Install them from the maschinenlesbar.org marketplace:

/plugin marketplace add maschinenlesbar-org/plugins
/plugin install abgeordnetenwatch@maschinenlesbar

See SKILLS.md for details.

License

Code: AGPL-3.0-or-later or a commercial license. Data: CC0 1.0 by abgeordnetenwatch.de — see DATA_LICENSE.md.