swiss-apis-mcp

swiss-apis-mcp

MCP server exposing all major Swiss official public APIs as native tools for any MCP-compatible AI agent.

Category
访问服务器

README

Swiss APIs MCP Server

MCP (Model Context Protocol) server exposing all major Swiss official public APIs as native tools for any MCP-compatible AI agent.

29 tools — 9 domains — 100% free APIs — zero configuration required for most tools.


What you can ask your AI

"What are the next trains from Geneva-Cornavin to Zurich?"
"What is the altitude of GPS coordinates 45.9763, 7.6586 (Matterhorn)?"
"Find all active companies named 'Nestlé' in the Swiss commercial register."
"Which canton and municipality contain coordinates 46.52, 6.63?"
"Search opendata.swiss for air quality datasets."
"What parliamentary motions on climate change were filed in 2024?"
"Convert LV95 coordinates 2600000, 1200000 to WGS84."
"Which API keys are configured? Set up my ZEFIX credentials."

Tools Reference

Setup (2 tools)

Tool Description Auth
swiss_check_setup Check which optional API keys are configured and which are missing None
swiss_set_api_key Store an API key persistently — takes effect immediately, no restart needed None

The agent calls swiss_check_setup first, then asks you for any missing keys and stores them via swiss_set_api_key. Keys are saved in ~/.swiss-apis-mcp/keys and survive server restarts.


Transport (4 tools)

Tool Description Auth
swiss_transport_stationboard Next departures from any Swiss station None
swiss_transport_connections Train/bus connections between two locations None
swiss_transport_station_search Search stations by name or GPS coordinates None
swiss_transport_gtfs_realtime GTFS-RT real-time feeds (delays, positions, alerts) OTD_API_KEY

API: transport.opendata.ch · opentransportdata.swiss


Geography (7 tools)

Tool Description Auth
swiss_geo_search_location Search addresses, communes, POIs, postal codes None
swiss_geo_get_elevation Terrain altitude in meters for any Swiss WGS84 coordinate None
swiss_geo_identify_canton Which canton contains a coordinate None
swiss_geo_identify_municipality Which commune contains a coordinate None
swiss_geo_convert_coordinates Convert WGS84 ↔ LV95 ↔ LV03 None
swiss_geo_get_wmts_tile_url Official swisstopo map tile URL None
swiss_geo_find_layer_features Search features in a GeoAdmin map layer None

API: GeoAdmin REST · swisstopo REFRAME · GeoAdmin Height


Health (3 tools)

Tool Description Auth
swiss_health_search_datasets Search BAG/OFSP datasets (diseases, mortality, vaccination) None
swiss_health_get_dataset Metadata and download URLs for a specific health dataset None
swiss_health_get_versorgungsatlas Swiss Health Atlas — 100+ cantonal health indicators None

API: opendata.swiss/BAG · versorgungsatlas.ch


Politics (3 tools)

Tool Description Auth
swiss_parliament_search Search motions, postulates, votes across 74+ parliaments None
swiss_parliament_persons Parliament members and their activity None
swiss_federal_law_search Search Swiss federal legislation via Fedlex SPARQL None

API: OpenParlData · Fedlex


Business (4 tools)

Tool Description Auth
swiss_company_search Search Swiss companies in ZEFIX (official commercial register) ZEFIX_USER + ZEFIX_PASS
swiss_company_by_uid Full company details by UID (CHE-xxx.xxx.xxx) ZEFIX_USER + ZEFIX_PASS
swiss_company_publications SOGC publications for a company (registrations, mergers) ZEFIX_USER + ZEFIX_PASS
swiss_opendata_search_datasets Search 14,000+ official Swiss government datasets None

API: ZEFIX REST · opendata.swiss CKAN


Energy (2 tools)

Tool Description Auth
swiss_energy_search_datasets SFOE datasets — solar, hydro, EV charging, consumption None
swiss_grid_energy_data Swissgrid — production mix, cross-border electricity flows None

API: SFOE/BFE · Swissgrid


Weather & Environment (3 tools)

Tool Description Auth
swiss_weather_search_meteoswiss MeteoSwiss OGD datasets (temperature, precipitation, climate) None
swiss_avalanche_data SLF avalanche warnings and snow data None
swiss_hydro_data BAFU river levels, flow rates, flood forecasts None

API: MeteoSwiss OGD · hydrodaten.admin.ch


Food (2 tools)

Tool Description Auth
swiss_food_search_products FoodRepo (EPFL) — barcoded Swiss food products + nutrients FOODREPO_API_KEY
swiss_food_nutrition_database Swiss Food Composition Database (FSVO/OSAV) None

API: FoodRepo · naehrwertdaten.ch


Statistics & Finance (4 tools)

Tool Description Auth
swiss_statistics_search BFS/OFS datasets — population, economy, education None
swiss_snb_financial_data Swiss National Bank — exchange rates, interest rates, inflation None
swiss_postal_data Swiss postal codes, streets, communes via OpenPLZ None
swiss_migration_statistics SEM migration and asylum statistics None

API: BFS · data.snb.ch · openplzapi.org


Installation

1. From npm (recommended)

No clone required. Point your MCP client at the published package:

{
  "mcpServers": {
    "swiss-apis-mcp": {
      "command": "npx",
      "args": ["-y", "swiss-apis-mcp"]
    }
  }
}

Or install globally and run the compiled entrypoint:

npm install -g swiss-apis-mcp

Then use "command": "swiss-apis-mcp" (and "args": [] if your client requires the field) in the same config shape as above.

2. From source (development)

git clone https://github.com/clement8426/swiss-apis-mcp.git
cd swiss-apis-mcp
npm install
npm run build

Use node /path/to/swiss-apis-mcp/dist/index.js or npx tsx src/index.ts in your MCP config while developing.

3. Optional API keys

Most tools work with zero configuration. Four tools need free credentials:

Key Service Register
OTD_API_KEY opentransportdata.swiss — GTFS real-time api-manager.opentransportdata.swiss
ZEFIX_USER ZEFIX — Swiss commercial register zefix.admin.ch
ZEFIX_PASS ZEFIX — Swiss commercial register zefix.admin.ch
FOODREPO_API_KEY FoodRepo (EPFL) — food products foodrepo.org

Option A — Let the AI agent do it for you: Ask your agent "check my Swiss APIs setup". It will call swiss_check_setup, identify what's missing, ask you for credentials, and store them automatically via swiss_set_api_key. No restart needed.

Option B — Set them manually before launching:

cp .env.example .env
# Edit .env with your keys

4. Test locally (from a clone)

npm run inspector

Opens the MCP Inspector at http://localhost:6274 — run any tool interactively.


Integration

Examples below use npx -y swiss-apis-mcp (published package). From a local clone, replace the args with ["tsx", "/absolute/path/to/swiss-apis-mcp/src/index.ts"] or ["node", "/absolute/path/to/swiss-apis-mcp/dist/index.js"] after npm run build.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "swiss-apis-mcp": {
      "command": "npx",
      "args": ["-y", "swiss-apis-mcp"]
    }
  }
}

Cursor

Edit ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-level):

{
  "mcpServers": {
    "swiss-apis-mcp": {
      "command": "npx",
      "args": ["-y", "swiss-apis-mcp"]
    }
  }
}

Windsurf

Edit ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "swiss-apis-mcp": {
      "command": "npx",
      "args": ["-y", "swiss-apis-mcp"]
    }
  }
}

Claude Code

claude mcp add swiss-apis-mcp npx -y swiss-apis-mcp

Continue.dev

In .continue/config.json:

{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "npx",
          "args": ["-y", "swiss-apis-mcp"]
        }
      }
    ]
  }
}

Project structure

swiss-apis-mcp/
├── src/
│   ├── index.ts              # Server entry point — loads saved keys, registers all tools
│   └── tools/
│       ├── setup.ts          # swiss_check_setup + swiss_set_api_key
│       ├── transport.ts      # transport.opendata.ch + opentransportdata.swiss
│       ├── geo.ts            # GeoAdmin REST + swisstopo REFRAME + height API
│       ├── health.ts         # BAG/OFSP + Versorgungsatlas
│       ├── politics.ts       # OpenParlData + Fedlex SPARQL
│       ├── business.ts       # ZEFIX REST + opendata.swiss CKAN
│       ├── energy.ts         # SFOE/BFE + Swissgrid
│       ├── weather.ts        # MeteoSwiss OGD + SLF + BAFU hydro
│       ├── food.ts           # FoodRepo (EPFL) + Swiss Food Composition DB
│       └── statistics.ts     # BFS/OFS + SNB + OpenPLZ + SEM
├── tests/
│   ├── helpers/mock-server.ts
│   ├── *.test.ts             # Unit tests (offline — axios mocked)
│   └── integration/
│       ├── helpers.ts
│       └── *.integration.test.ts  # Integration tests (real HTTP calls)
├── .env.example
├── .gitignore
├── package.json
├── tsconfig.json
├── vitest.config.ts
└── vitest.integration.config.ts

Scripts

Command Description
npm run dev Start the MCP server via tsx (development)
npm run build Compile TypeScript to dist/
npm start Start compiled server (node dist/index.js)
npm run inspector Open MCP Inspector UI at localhost:6274
npm test Run unit tests (fast, offline, no network)
npm run test:integration Run integration tests (real API calls)
npm run test:all Run both
npm run test:coverage Unit tests with coverage report

Adding a new tool

// src/tools/my_domain.ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
import axios from "axios";

export function registerMyDomainTools(server: McpServer) {
  server.tool(
    "swiss_my_tool_name",
    "Description shown to the AI agent — be precise about what data is returned.",
    {
      param1: z.string().describe("What this parameter does"),
    },
    async ({ param1 }) => {
      const resp = await axios.get("https://api.swiss.ch/endpoint", {
        params: { q: param1 },
      });
      return {
        content: [{ type: "text", text: JSON.stringify(resp.data, null, 2) }],
      };
    }
  );
}

Then register in src/index.ts:

import { registerMyDomainTools } from "./tools/my_domain.js";
registerMyDomainTools(server);

Resources

Licence

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选