Skip to main content

MCP server for querying the Swiss Zefix company register (Handelsregister)

Project description

mcp-server-zefix

Look up any Swiss company directly from Claude.

PyPI License: MIT Tests

An MCP server that connects Claude to Zefix, Switzerland's official company register (Handelsregister). Zefix is operated by the Federal Office of Justice and provides authoritative data from all 26 cantonal commercial registers -- company details, legal forms, audit firms, corporate history, and official gazette publications.

What you can ask

  • "Search for Novartis on Zefix"
  • "Find all foundations in Basel"
  • "Who audits Novartis AG?"
  • "What companies has Novartis taken over?"
  • "Show me all branches of KIBAG Bauleistungen AG"
  • "Get the corporate structure for CHE-467.005.033"
  • "Show me the corporate history of Huber Baustoffe AG"
  • "What capital changes has cohaga AG had recently?"
  • "Find all GmbHs in Zurich"
  • "List all Swiss legal forms in German"

Quick Start

Hosted (no installation)

Connect directly -- works in any MCP-compatible client.

Claude Code:

claude mcp add --transport http zefix https://mcp-server-zefix.contextfor.ai/mcp \
  --header "Authorization: Bearer <your-api-key>"

Claude Desktop:

Settings > Customize > Connectors > Add custom connector:

  • URL: https://mcp-server-zefix.contextfor.ai/mcp

Request an API key at zefix@contextfor.ai.

Local (self-hosted)

claude mcp add zefix -- uvx mcp-server-zefix

Or add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

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

No API key or credentials needed for local usage.

Tools

Tool Description
search_companies Search by name (wildcards supported), filter by canton and legal form
get_company_by_uid Full company profile: address, purpose, audit firm, takeover history, branch offices, previous names
get_company_by_chid Same as above, using the CH-ID identifier
get_company_structure Head office and all branch offices in a table with full addresses. Works from any branch UID.
get_company_publications SHAB timeline: board changes, capital changes, mergers, address changes, and more
list_legal_forms All Swiss legal forms (AG, GmbH, Stiftung, etc.) with IDs for filtering

All tools accept a language parameter (de, fr, it, en). Output labels use official Zefix terminology in the selected language.

What you get

A company lookup returns:

  • Identifiers -- name, UID, CH-ID, status, legal form
  • Location -- registered office, full address
  • Purpose -- the company's stated business purpose
  • Audit firm -- name and UID of the auditor
  • Corporate history -- companies absorbed, acquisitions, previous names
  • Corporate structure -- head office and all branch offices with addresses, displayed as a table
  • Branch offices -- all registered branch locations
  • SHAB publications -- timeline of legally significant events from the Swiss Official Gazette (board changes, capital changes, mergers, purpose changes)
  • Cantonal register link -- direct link to the full excerpt with board members and signatories

Configuration

Works with zero configuration using the public Zefix API. For the official authenticated API, set these environment variables:

Variable Default Description
ZEFIX_BASE_URL https://www.zefix.ch/ZefixREST/api/v1 API base URL
ZEFIX_USERNAME (none) Username for ZefixPublicREST API
ZEFIX_PASSWORD (none) Password for ZefixPublicREST API

To use the official API, request credentials from zefix@bj.admin.ch, then:

{
  "mcpServers": {
    "zefix": {
      "command": "uvx",
      "args": ["mcp-server-zefix"],
      "env": {
        "ZEFIX_BASE_URL": "https://www.zefix.admin.ch/ZefixPublicREST/api/v1",
        "ZEFIX_USERNAME": "your-username",
        "ZEFIX_PASSWORD": "your-password"
      }
    }
  }
}

Development

git clone https://github.com/johnphilipp/mcp-server-zefix.git
cd mcp-server-zefix
uv sync --all-extras

uv run ruff check .           # lint
uv run pytest tests/ -v       # test (68 tests, all use fakes, no network)
npx @modelcontextprotocol/inspector uv --directory . run mcp-server-zefix  # interactive

Architecture

Follows Architecture Patterns with Python (Percival & Gregory):

  • Domain models (models.py) -- frozen dataclasses (Company, LegalForm, ShabPublication), domain exceptions, no infrastructure imports
  • Port + adapter (zefix_client.py) -- AbstractZefixClient protocol; HttpZefixClient translates HTTP to domain objects and httpx exceptions to domain exceptions
  • Service layer (server.py) -- handle_* functions accept the abstract client, never import httpx
  • Localization (i18n.py) -- centralized label translations (de/fr/it/en) using official Zefix terminology
  • Fakes over mocks -- tests use FakeZefixClient, a working in-memory implementation; test files never import httpx

Self-hosting

The server supports remote deployment via Streamable HTTP transport. See Dockerfile, docker-compose.prod.yml, and Caddyfile for a Docker + Caddy setup with auto-HTTPS and API key authentication.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_zefix-0.4.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_zefix-0.4.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_zefix-0.4.0.tar.gz.

File metadata

  • Download URL: mcp_server_zefix-0.4.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_server_zefix-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ed31f65ed618e9d3ec11dd20f0baad4c4b07d9f1aa7f1465425aa11c92cc28b8
MD5 31ed0c83327eade957eb06b3947f4a08
BLAKE2b-256 fc8c8c3b49a874c4bee2ed76d920f663d2c6daf15f21000aa9430316840a870e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_server_zefix-0.4.0.tar.gz:

Publisher: publish.yml on johnphilipp/mcp-server-zefix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_server_zefix-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_zefix-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3dee8b0a9938ec9fc903a746b1247c2a7629aab5d219391ef4741efbbda71b3b
MD5 449dfc325f7dd4b5694677f2183e1e31
BLAKE2b-256 6a853a5b138ff78437bfe0cc12a7dd415c8938fd848517b20fd72f7b020232f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_server_zefix-0.4.0-py3-none-any.whl:

Publisher: publish.yml on johnphilipp/mcp-server-zefix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page