Skip to main content
Glama
mcp-server-public-transport

mcp-server-public-transport

mcp-server-public-transport

ヨーロッパ全域のリアルタイム公共交通機関データを提供するMCPサーバー。

概要

mcp-server-public-transportは、Model Context Protocol (MCP)互換のローカルサーバーで、ヨーロッパ全域の公共交通機関データへのアクセスを提供します。 現在、イギリス、スイス、ノルウェー、ベルギー、およびベルリン/ブランデンブルクのAPIを統合しており、列車の接続情報、リアルタイムの出発情報、バスの現在地などを取得できます。

Related MCP server: BVG MCP Server

機能実装状況

対応国

国

APIベースURL

ステータス

イギリス

https://transportapi.com

✅

スイス

https://transport.opendata.ch

✅

ベルギー

https://api.irail.be

✅

ノルウェー

https://api.entur.io

✅

ベルリン/ブランデンブルク

https://v6.vbb.transport.rest

✅

国別の機能

機能

APIパス

ステータス

イギリス

リアルタイム出発情報

/uk/train/station_timetables/{station_code}.json

✅

スイス

接続検索

/connections

✅

駅検索

/locations

✅

出発ボード

/stationboard

✅

近隣の駅

/locations?x={lon}&y={lat}

✅

ベルギー

リアルタイム出発情報

/departures

✅

駅検索

/stations

✅

近隣の駅

/stations/nearby

✅

ノルウェー

場所検索

/geocoder/v1/autocomplete

✅

リアルタイム出発情報

GraphQL: stopPlace(id) { estimatedCalls(...) }

✅

旅行計画

GraphQL: trip(from, to, dateTime, numTripPatterns, ...)

✅

最寄りの停留所

GraphQL: nearest(latitude, longitude, maximumDistance, ...)

✅

ベルリン/ブランデンブルク

場所検索

/locations

✅

リアルタイム出発情報

/stops/:id/departures

✅

リアルタイム到着情報

/stops/:id/arrivals

✅

旅行計画

/journeys

✅

近隣の駅

/locations/nearby

✅

セットアップ

環境変数

以下の環境変数を設定してください:

UK_TRANSPORT_APP_ID=your_uk_app_id
UK_TRANSPORT_API_KEY=your_uk_api_key

Claude Desktopでの使用

claude_desktop_config.jsonに追加してください:

{
  "mcpServers": {
    "mcp-server-public-transport": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/mcp-server-public-transport",
        "run",
        "server.py"
      ],
      "env": {
        "UK_TRANSPORT_APP_ID": "your-uk-app-id",
        "UK_TRANSPORT_API_KEY": "your-uk-api-key"
      }
    }
  }
}

/ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-server-public-transportを、リポジトリをクローンした実際のパスに置き換えてください。

注:コマンドフィールドには、uv実行ファイルのフルパスを指定する必要がある場合があります。これは、MacOS/Linuxではwhich uv、Windowsではwhere uvを実行することで取得できます。

開発

開発環境の構築

  1. リポジトリのクローン

git clone https://github.com/mirodn/mcp-server-public-transport.git
cd mcp-server-public-transport
  1. 依存関係のインストール

uv sync
  1. 環境変数の設定

cp .env.example .env
  1. サーバーの実行

uv run server.py

テストの実行

このプロジェクトではテストにpytestを使用しており、以下のコマンドが利用可能です:

# Run all tests
make test

コード品質

# Run linting
make lint

# Run code formatting
make format

継続的インテグレーション

このプロジェクトには、GitHub Actionsワークフロー(.github/workflows/test.yml)が含まれており、自動的に以下を行います:

  • Python 3.10、3.11、3.12でのテスト実行

  • ruffを使用したリンティングチェックの実行

  • mainブランチへのすべてのプッシュおよびプルリクエストで実行

CIパイプラインにより、変更がマージされる前に、サポートされているすべてのPythonバージョンでコードの品質と互換性が保証されます。

コントリビューション

コントリビューションを歓迎します!お気軽にプルリクエストを送信してください。

パッケージは、pyproject.tomlでproject.versionが更新されると、自動的にPyPIにデプロイされます。 バージョニングにはセマンティックバージョニング(semver)に従ってください。

ライセンス

MIT License

Available Tools

13 tools
be_get_departuresB

Get live departure board for a Belgian train station.

Inputs: station (required), limit. Returns: object

be_get_vehicleA

Get details about a specific Belgian train vehicle by its ID.

Inputs: vehicle_id (required). Returns: object

be_search_connectionsB

Search train connections in Belgium between two stations. Powered by iRail API for real-time routes and schedules.

Inputs: origin (required), destination (required), results, date, +1 more. Returns: object

be_search_stationsB

Search for Belgian train stations by name.

Inputs: query (required). Returns: object

ch_get_departuresC

Get departure board for a Swiss train station with real-time information.

Inputs: station (required), limit, datetime. Returns: object

ch_nearby_stationsC

Find nearby Swiss train stations based on coordinates (latitude, longitude).

Inputs: latitude (required), longitude (required), distance. Returns: object

ch_search_connectionsA

Search for train connections in Switzerland between two stations. Uses transport.opendata.ch API to provide real-time connection data including departure times, duration, platforms, and transfers.

Inputs: origin (required), destination (required), limit, date, +2 more. Returns: object

ch_search_stationsC

Search for Swiss train stations by name or location.

Inputs: query (required), type. Returns: object

no_nearest_stopsB

Find nearest StopPlaces for a coordinate (lat, lon) within a radius in meters.

Inputs: lat (required), lon (required), radius, limit. Returns: object

no_search_placesC

Autocomplete search across stops/addresses/POIs in Norway via Entur Geocoder.

Inputs: text (required), lang, size. Returns: object

no_stop_departuresB

Upcoming departures for a StopPlace ID (e.g., 'NSR:StopPlace:58368').

Inputs: stop_place_id (required), limit. Returns: object

no_tripC

Door-to-door trip planning between two StopPlaces (NSR IDs).

Inputs: from_id (required), to_id (required), date_time, results. Returns: object

uk_live_departuresA

Get live departure information for a UK train station using its CRS code (e.g., 'PAD' for London Paddington, 'MAN' for Manchester Piccadilly). Uses the TransportAPI station timetables endpoint with live data.

Inputs: station_code (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 13 tools

    Disambiguation4/5

    Tools are clearly distinguished by country prefix (be_, ch_, no_, uk_) and specific functions like departures, connections, stations, and trips, with minimal overlap. However, some tools like be_get_departures and uk_live_departures serve similar purposes across different regions, which could cause minor confusion if an agent doesn't prioritize the country prefix.

    Naming Consistency4/5

    Naming follows a consistent pattern of country prefix + verb_noun (e.g., be_get_departures, ch_search_connections), with all tools using snake_case. Minor deviations include no_nearest_stops (using 'nearest' instead of 'search' or 'get') and no_trip (using a noun instead of verb_noun), but overall the convention is predictable and readable.

    Tool Count5/5

    With 13 tools, the count is well-scoped for a public transport server covering multiple countries (Belgium, Switzerland, Norway, UK). Each tool earns its place by providing distinct functionality per region, such as departures, connections, station searches, and trip planning, without being overly bloated or sparse.

    Completeness4/5

    The toolset offers comprehensive coverage for public transport queries across four countries, including core operations like searching stations, getting departures, and planning connections. Minor gaps exist, such as no tool for vehicle details outside Belgium or real-time alerts, but agents can work around these with the available tools for most common use cases.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers