amtsblatt-mcp

amtsblatt-mcp

MCP server for amtsblattportal.ch β€” the Swiss official gazette portal (SHAB + 27 cantonal gazettes). Public procurement and official notices, person-data rubrics excluded by design.

Category
Visit Server

README

πŸ‡¨πŸ‡­ Part of the Swiss Public Data MCP Portfolio

πŸ“° amtsblatt-mcp

Version License: MIT Python 3.11+ MCP No Auth Required CI

MCP server for amtsblattportal.ch β€” the Swiss official gazette portal (SHAB + 27 cantonal gazettes). Public procurement and official notices, person-data rubrics excluded by design.

πŸ‡©πŸ‡ͺ Deutsche Version

Overview

The Amtsblattportal publishes roughly 2.79 million official notices: public procurement, cantonal and communal announcements, enactments, spatial planning β€” and also bankruptcies, debt collection, inheritance calls and civil-status records naming natural persons.

This server exposes only the first group. Rubrics carrying systematic natural-person data are not queryable, and no tool accepts a person's name, birth date or address. That is a deliberate data-protection decision, explained in Data Protection & Scope.

Anchor demo query: "Which public IT tenders were published in canton Basel-Stadt in the last three months?" β†’ search_procurement(canton="BS", keyword="Informatik") β†’ get_publication(id=…)

Features

  • Fail-closed green allow-list β€” 49 released rubrics out of 152; everything else is blocked by default, including rubrics the upstream adds later
  • Explanatory refusals β€” a blocked rubric returns why, never a silent empty result and never a workaround hint
  • Procurement-aware β€” knows that only AR, BS, TI, ZG publish tenders here and that ZH routes them through simap.ch, so it explains instead of returning nothing
  • Deadline arithmetic in Europe/Zurich, the legally relevant timezone
  • Language deduplication β€” a notice published in de/fr/it counts once
  • Defensive XML parsing β€” the schema is per-sub-rubric; no rubric-specific path is hard-coded, and entity-escaped HTML bodies are unescaped and stripped
  • Egress allow-list, retry with backoff, structured JSON logging
  • Markdown or JSON output with per-response attribution + provenance

Prerequisites

  • Python 3.11+
  • No API key. The read API of amtsblattportal.ch is freely accessible.

Installation

pip install amtsblatt-mcp
# or, without installing:
uvx amtsblatt-mcp

From source:

git clone https://github.com/malkreide/amtsblatt-mcp
cd amtsblatt-mcp
pip install -e ".[dev]"

Configuration

Claude Desktop

{
  "mcpServers": {
    "amtsblatt": {
      "command": "uvx",
      "args": ["amtsblatt-mcp"]
    }
  }
}

Cloud deployment (SSE)

export MCP_TRANSPORT=sse
export MCP_API_KEY="$(openssl rand -hex 32)"   # mandatory β€” fails loud if unset
export PORT=8000
amtsblatt-mcp
Variable Default Purpose
MCP_TRANSPORT stdio stdio or sse
MCP_HOST 127.0.0.1 SSE bind address. Defaults to loopback; set 0.0.0.0 to expose on all interfaces (the Docker image does this deliberately).
MCP_API_KEY β€” Bearer token; required for SSE
MCP_RATE_LIMIT / MCP_RATE_WINDOW 60 / 60 Sliding-window rate limit
MCP_ALLOWED_HOSTS amtsblattportal.ch,www.amtsblattportal.ch Egress allow-list. An override replaces the default entirely.
RUBRICS_TTL 86400 Taxonomy cache TTL (seconds)
LOG_LEVEL INFO Structured JSON logs to stderr

Available Tools

Tool Signature Notes
search_publications (keyword?, rubric?, sub_rubric?, canton?, date_start?, date_end?, limit=20, page=0, language='de') Green rubrics enforced. Without rubric, all green rubrics are injected β€” a keyword-only query can never reach a blocked one.
search_procurement (keyword?, canton?, date_start?, date_end?, include_inactive=False, limit=20, page=0) OB-* only. A canton without an OB-* rubric gets a simap.ch explainer and no HTTP call. No CPV β€” the source has none.
get_publication (id, response_format='markdown') Full official text from XML. Re-checks the rubric after fetching; content from a blocked rubric is discarded.
list_rubrics (language='de', rubric_class='green', response_format='markdown') rubric_class='all' shows the full taxonomy with traffic-light classes and reasons β€” listed β‰  queryable.
source_status (response_format='markdown') Reachability, latency, cache age, scope metrics.

All tools are readOnlyHint=True.

Example use cases

Question Tool chain
IT tenders in Basel-Stadt this quarter search_procurement(canton="BS", keyword="Informatik")
What is even queryable here? list_rubrics()
Why can't I search bankruptcies? list_rubrics(rubric_class="all")
Zoning changes in Zurich search_publications(rubric="RP-ZH")
Full text of a notice get_publication(id="fbf0ff9e-…")
Everything published about one company β†’ use register-mcp

Data Protection & Scope

The Amtsblattportal systematically publishes personal data of natural persons. Those publications are public β€” but making them systematically queryable by name through an AI agent is a repurposing the publication never intended, and a profiling instrument under the revised Swiss FADP (revDSG).

Four rules follow, and they are enforced in code, not in documentation:

  1. Allow-list, never block-list. Not explicitly green β‡’ not queryable. New upstream rubrics are closed by default.
  2. No person-based search entry in any tool signature.
  3. No persistence. Publications have statutory deletion periods; a cache outliving them would actively undermine them. Only the taxonomy is cached.
  4. Blocked β‡’ explained. Never a silent empty result, never a hint at circumvention.

What is excluded

πŸ”΄ Konkurse (KK), Schuldbetreibungen (SB), Schuldenrufe (LS, SR), Nachlass (NA), Erbschaft/Testament/Ableben (ES, TE-*, VA-*), Familie & Zivilstand (FZ-*, BV-*, BU-*), gerichtliche Vorladungen (UV, GB-*, GE-*, SJ-BE), Baugesuche (BP-*), Grundbuch (GR-*), Meldungskatalog GR (AA-GR).

🟑 Deferred: Steuerwesen, Anzeigen, Bewilligungen, Bildungs- und Kirchenwesen and the general catch-all rubrics.

The full audit trail β€” including three documented extensions to the source specification β€” is in docs/rubric-classification.md.

The boundary with register-mcp

For publications about a specific company, use register-mcp. It keeps full rubric access β€” including a firm's own bankruptcy β€” but only ever keyed on a company UID. A firm's insolvency is corporate data, not natural-person profiling, and UID scoping makes name-based enumeration impossible.

amtsblatt-mcp has the opposite shape: broad search, narrow rubrics. It does not expose the upstream uids parameter at all.

Architecture

   Claude / MCP client
            β”‚
      amtsblatt-mcp
            β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  green gate     β”‚  ← rubrics.py: fail-closed allow-list
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     (checked at the tool AND at the query builder)
            β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  param allow-   β”‚  ← Silent Ignore guard
   β”‚  list + quirks  β”‚  ← Silent Empty guard (taxonomy validation)
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  ← plausibility guard (corpus-size check)
            β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ egress allow-   β”‚
   β”‚ list (httpx)    β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
  amtsblattportal.ch/api/v1
   /publications Β· /publications/{id}/xml Β· /rubrics Β· /tenants

Architecture A (live-API-only). The endpoints answer stably without authentication, so no bulk dump is maintained.

Verified upstream quirks (live-checked 2026-07-20)

Quirk Behaviour Defence
Silent Ignore An unknown parameter name returns HTTP 200 and the full corpus. canton=ZH (singular typo) silently drops the filter. Query params built exclusively from ALLOWED_GAZETTE_PARAMS; plausibility guard rejects results > 2 000 000.
Silent Empty An unknown rubric value returns HTTP 200 with total: 0 β€” indistinguishable from a real no-hit. Every code validated against the taxonomy before the call.
Metadata only The list endpoint and GET /publications/{id} both return content: null. Full text only via /publications/{id}/xml.
Sorting ignored pageRequest.sortOrders is accepted with 200 but has no effect; sortOrders comes back []. Sorted client-side.
Missing publicationStates Returns 401, not 400 β€” it does not mean credentials are required. Always injected; the 401 message says so.
No page-size cap pageRequest.size=2000 returns 2000 items. Client-side cap of 100.
Inconsistent plurals rubrics/cantons/subRubrics are plural, keyword/tenant singular. Exact spellings encoded, not a pluralisation rule.

Known Limitations

  • Uneven cantonal coverage. Only 16 of 29 mandates expose their own rubric taxonomy; AG, FR, GE, GL, JU, LU, NE, UR are still incomplete.
  • Deletion periods. Publications drop out of the API over time β€” hence pass-through only.
  • Procurement boundary. Most cantons, including ZΓΌrich, route tenders through simap.ch, outside this portal. There is no OB-ZH, and no CPV classification exists here.
  • No push. Polling only; no subscription or webhook mechanism.
  • Legally binding text is the signed PDF, not this API.

Testing

pip install -e ".[dev]"
PYTHONPATH=src pytest tests/ -m "not live"   # 75 tests, no network
PYTHONPATH=src pytest tests/ -m live         # hits the real API
ruff check src/ tests/

The suite covers the mandatory portfolio set: green-rubric search with source URL, blocked rubric β†’ explanation with zero HTTP calls, canton filtering, Europe/Zurich deadline arithmetic against a fixed "today", pagination across a page boundary, language deduplication, boolean normalisation, and API-unreachable handling. Fixtures are shortened real responses, consistently anonymised β€” no real personal data.

Project Structure

amtsblatt-mcp/
β”œβ”€β”€ src/amtsblatt_mcp/
β”‚   β”œβ”€β”€ rubrics.py       # Fail-closed green allow-list β€” the scope decision
β”‚   β”œβ”€β”€ server.py        # FastMCP server, 5 tools, quirk guards, XML parsing
β”‚   β”œβ”€β”€ _log.py          # Structured JSON logging + per-tool call events
β”‚   β”œβ”€β”€ _middleware.py   # Bearer auth + sliding-window rate limit (SSE only)
β”‚   └── _otel.py         # Optional OpenTelemetry wiring
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_allowlist.py    # Data-protection invariants (own CI job)
β”‚   β”œβ”€β”€ test_search.py       # Search, procurement, pagination, dedup, errors
β”‚   β”œβ”€β”€ test_publication.py  # XML parsing, deadlines, egress allow-list
β”‚   └── fixtures.py          # Anonymised real responses
β”œβ”€β”€ docs/
β”‚   └── rubric-classification.md   # Why each of the 152 rubrics is open/closed
β”œβ”€β”€ Dockerfile Β· compose.yaml      # Hardened, non-root, read-only container
└── server.json                    # MCP registry manifest

Changelog

See CHANGELOG.md.

Contributing

See CONTRIBUTING.md. Changes to src/amtsblatt_mcp/rubrics.py require an explicit rationale in the PR description: releasing a rubric is a data-protection decision, not a feature.

Security

See SECURITY.md for reporting and operator hardening notes.

License

MIT β€” see LICENSE.

Data source: amtsblattportal.ch, operated by SECO / State Secretariat for Economic Affairs on behalf of the Swiss Confederation. Freely usable, but without warranty of completeness or accuracy. Only the signed PDF of a publication is legally binding.

Author

Hayal Oezkan Β· malkreide

Credits & Related Projects

Part of the Swiss Public Data MCP Portfolio:

  • register-mcp β€” Zefix commercial register with a company-UID join to the gazettes

<!-- mcp-name: io.github.malkreide/amtsblatt-mcp -->

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured