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

mcp-server-public-transport

mcp-server-public-transport

Ein MCP-Server, der Echtzeitdaten des öffentlichen Nahverkehrs in ganz Europa bereitstellt.

Über

mcp-server-public-transport ist ein Model Context Protocol (MCP)-kompatibler lokaler Server, der Zugriff auf Daten des öffentlichen Nahverkehrs in ganz Europa bietet. Derzeit integriert er APIs aus Großbritannien, der Schweiz, Norwegen, Belgien sowie Berlin/Brandenburg und ermöglicht es Ihnen, Zugverbindungen, Live-Abfahrten und Busstandorte abzurufen.

Related MCP server: BVG MCP Server

Status der Funktionsimplementierung

Unterstützte Länder

Land

API-Basis-URL

Status

Großbritannien

https://transportapi.com

✅

Schweiz

https://transport.opendata.ch

✅

Belgien

https://api.irail.be

✅

Norwegen

https://api.entur.io

✅

Berlin/Brandenburg

https://v6.vbb.transport.rest

✅

Funktionen nach Land

Funktion

API-Pfad

Status

Großbritannien

Live-Abfahrten

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

✅

Schweiz

Verbindungen suchen

/connections

✅

Bahnhofssuche

/locations

✅

Abfahrtstafel

/stationboard

✅

Bahnhöfe in der Nähe

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

✅

Belgien

Live-Abfahrten

/departures

✅

Bahnhofssuche

/stations

✅

Bahnhöfe in der Nähe

/stations/nearby

✅

Norwegen

Ortssuche

/geocoder/v1/autocomplete

✅

Live-Abfahrten

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

✅

Reiseplanung

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

✅

Nächstgelegene Haltestellen

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

✅

Berlin/Brandenburg

Ortssuche

/locations

✅

Live-Abfahrten

/stops/:id/departures

✅

Live-Ankünfte

/stops/:id/arrivals

✅

Reiseplanung

/journeys

✅

Bahnhöfe in der Nähe

/locations/nearby

✅

Einrichtung

Umgebungsvariablen

Setzen Sie die folgenden Umgebungsvariablen:

UK_TRANSPORT_APP_ID=your_uk_app_id
UK_TRANSPORT_API_KEY=your_uk_api_key

Verwendung mit Claude Desktop

Fügen Sie dies zu Ihrer claude_desktop_config.json hinzu:

{
  "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"
      }
    }
  }
}

Ersetzen Sie /ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-server-public-transport durch den tatsächlichen Pfad, unter dem Sie das Repository geklont haben.

Hinweis: Möglicherweise müssen Sie den vollständigen Pfad zur uv-Executable im Befehlsfeld angeben. Diesen erhalten Sie unter MacOS/Linux mit which uv oder unter Windows mit where uv.

Entwicklung

Entwicklungsumgebung einrichten

  1. Repository klonen

git clone https://github.com/mirodn/mcp-server-public-transport.git
cd mcp-server-public-transport
  1. Abhängigkeiten installieren

uv sync
  1. Umgebungsvariablen setzen

cp .env.example .env
  1. Server ausführen

uv run server.py

Tests ausführen

Das Projekt verwendet pytest für Tests, wobei die folgenden Befehle verfügbar sind:

# Run all tests
make test

Code-Qualität

# Run linting
make lint

# Run code formatting
make format

Kontinuierliche Integration

Das Projekt enthält einen GitHub Actions-Workflow (.github/workflows/test.yml), der automatisch:

  • Tests auf Python 3.10, 3.11 und 3.12 ausführt

  • Linting-Prüfungen mit ruff durchführt

  • Bei jedem Push und Pull Request auf den main-Branch ausgeführt wird

Die CI-Pipeline stellt die Code-Qualität und Kompatibilität über die unterstützten Python-Versionen sicher, bevor Änderungen zusammengeführt werden.

Mitwirken

Beiträge sind willkommen! Bitte zögern Sie nicht, einen Pull Request einzureichen.

Das Paket wird automatisch auf PyPI bereitgestellt, wenn project.version in pyproject.toml aktualisiert wird. Folgen Sie für die Versionierung semver.

Lizenz

MIT-Lizenz

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