mcp-server-public-transport
Provides real-time European public transport data for Switzerland, Belgium, Norway, and the UK.
Search Swiss train connections and stations, get station departures, and find nearby Swiss stations.
Search Belgian train connections and stations, get live departures, and look up vehicle details.
Autocomplete Norwegian places, get StopPlace departures, plan door-to-door trips between stops, and find nearest stops.
Get live UK train departures by station CRS code.
Provides GraphQL-based public transport data integration for Norway, enabling trip planning, stop departures, nearest stops, and place search through Entur's GraphQL API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-public-transport show me the next trains from London Paddington to Bristol Temple Meads"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-public-transport
An MCP Server providing real-time public transport data across Europe.
About
mcp-server-public-transport is a Model Context Protocol (MCP)-compatible local server that provides access to public transport data across Europe. Currently, it integrates APIs from UK, Switzerland, Norway, Belgium, Berlin/Brandenburg, Portugal (Lisbon + Porto) and Italy, allowing you to retrieve train connections, live departures, and bus locations.
Related MCP server: BVG MCP Server
Feature Implementation Status
Supported Countries
Country | API Base URL | Status |
United Kingdom | ✅ | |
Switzerland | ✅ | |
Belgium | ✅ | |
Norway | ✅ | |
Berlin/Brandenburg | ✅ | |
Portugal (Lisbon + Porto) | ✅ | |
Italy (national) | ✅ |
Features by Country
Feature | API Path | Status |
United Kingdom | ||
Live Departures |
| ✅ |
Switzerland | ||
Search Connections |
| ✅ |
Station Lookup |
| ✅ |
Departure Board |
| ✅ |
Nearby Stations |
| ✅ |
Belgium | ||
Live Departures |
| ✅ |
Station Lookup |
| ✅ |
Nearby Stations |
| ✅ |
Norway | ||
Place Search |
| ✅ |
Live Departures |
| ✅ |
Trip Planning |
| ✅ |
Nearest Stops |
| ✅ |
Berlin/Brandenburg | ||
Location Search |
| ✅ |
Live Departures |
| ✅ |
Live Arrivals |
| ✅ |
Journey Planning |
| ✅ |
Nearby Stations |
| ✅ |
Portugal (Lisbon + Porto) | ||
Station Lookup |
| ✅ |
Search Connections |
| ✅ |
Departure Board |
| ✅ |
Nearby Stations |
| ✅ |
Italy (national) | ||
Station Lookup |
| ✅ |
Search Connections |
| ✅ |
Departure Board |
| ✅ |
Nearby Stations |
| ✅ |
Portugal coverage is scoped to the Lisbon and Porto metro areas (Metro Lisboa, Carris, Carris Metropolitana, CP suburban; Metro do Porto, STCP) via Transitous, a free MOTIS instance over ingested GTFS feeds. No API key required.
Italy coverage is national: Trenitalia rail (high-speed, long-distance, regional, night) plus regional GTFS feeds (metro, tram, bus), also via Transitous. No API key required.
Attribution (Transitous)
Lisbon/Porto and Italy data is served by Transitous, a volunteer-run, best-effort service (limited hosting, no availability or accuracy guarantees). Keep the Transitous attribution visible when showing this data to users; underlying feeds, including OpenStreetMap, are listed at transitous.org/sources.
Follow the Transitous usage policy: modest request volume,
an identifying User-Agent, non-commercial / open-source use only.
Response Format
Departure/arrival boards and connection searches return a compact format that is the same for every country, instead of the raw upstream payload (typically 80–95% smaller):
{
"station": {"id": "8503000", "name": "Zürich HB"},
"departures": [
{"line": "S 14", "category": "S", "destination": "Hinwil",
"planned": "2026-10-05T10:12:00+02:00", "expected": "2026-10-05T10:36:00+02:00",
"delay_min": 24, "platform": "33", "operator": "SBB"}
]
}Times are ISO 8601 in local time.
expectedis only set when real-time data exists.Journeys contain
legs(withwalk: truefor footpaths);departure,arrivalandduration_minof a journey are scheduled values, real-time data is on the legs.Disruption messages appear in
remarks. Empty fields are omitted.Pass
raw: trueto get the unmodified upstream response.
Station searches, nearby lookups, be_get_vehicle and uk_live_departures still return
the upstream payload.
Setup
Hosted Server (no install)
A public instance is available via Streamable HTTP:
https://mcp-public-transport-412652413053.europe-west1.run.app/mcpClaude (web / desktop): Settings → Connectors → Add custom connector, paste the URL.
Claude Code:
claude mcp add --transport http public-transport https://mcp-public-transport-412652413053.europe-west1.run.app/mcp
The hosted instance does not include UK tools. For UK data, run the server locally with your own keys (see below).
Environment Variables
Set the following environment variables:
UK_TRANSPORT_APP_ID=your_uk_app_id
UK_TRANSPORT_API_KEY=your_uk_api_keyUsage with Claude Desktop
The quickest way is to run the published package with uvx (no clone needed).
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mcp-server-public-transport": {
"command": "uvx",
"args": ["mcp-server-public-transport"],
"env": {
"UK_TRANSPORT_APP_ID": "your-uk-app-id",
"UK_TRANSPORT_API_KEY": "your-uk-api-key"
}
}
}
}To run from a local clone instead:
{
"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"
}
}
}
}
Replace /ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-server-public-transport with the actual path where you've cloned the repository.
Note: You may need to put the full path to the uv executable in the command field. You can get this by running which uv on MacOS/Linux or where uv on Windows.
Development
Setting up Development Environment
Clone the repository
git clone https://github.com/mirodn/mcp-server-public-transport.git cd mcp-server-public-transportInstall dependencies
uv syncSet environment variables
cp env.example .envRun the server
uv run server.py
Running Tests
The project uses pytest for testing with the following commands available:
# Run all tests
make testCode Quality
# Run linting
make lint
# Run code formatting
make formatContinuous Integration
The project includes a GitHub Actions workflow (.github/workflows/test.yml) that automatically:
Runs tests on Python 3.10, 3.11, and 3.12
Executes linting checks using ruff
Runs on every push and pull request to
mainbranch
The CI pipeline ensures code quality and compatibility across supported Python versions before any changes are merged.
Hosting (Google Cloud Run)
The hosted instance runs on Cloud Run with stateless Streamable HTTP (MCP_STATELESS=true),
scale-to-zero and a single max instance. A monthly budget triggers
deploy/budget-guard, which makes the service private
once the budget is used up.
The hosted instance has no UK credentials, so UK tools are not available there. To use them, get your own key at transportapi.com and run the server locally (see Setup).
One-time setup:
deploy/gcp-setup.shDeploys:
.github/workflows/deploy-cloudrun.ymlruns on release tags or manually. It only swaps the image, so limits and public access stay as configured.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
The package is deployed automatically to PyPI when project.version is updated in pyproject.toml.
Follow semver for versioning.
License
Available Tools
13 toolsbe_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
Scored across 13 tools
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 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.
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.
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
Related MCP Connectors
An MCP server for Georgian public data, read from the organizations that publish it.
MCP server with quote and live cryptocurrency price tools, local and cloud-deployed transports.
MCP server for Travel & Transportation
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
Related MCP Servers
- FlicenseDqualityDmaintenanceProvides access to Berlin's public transport data through the VBB API, enabling users to search stops, get departures, and plan journeys across Berlin-Brandenburg.36-
- AlicenseNot gradedqualityDmaintenanceAn MCP server for interacting with the Berlin Public Transport (BVG) API to search for locations and plan journeys. It provides real-time access to departures, arrivals, trip details, and vehicle tracking within Berlin's transit network.MIT
- AlicenseAqualityDmaintenanceA zero-authentication MCP server for Swiss public transport, enabling users to query train connections, disruptions, station facilities, and plan journeys using natural language.121MIT
- AlicenseAqualityDmaintenanceMCP server for Swiss public transport — connections, stationboards, real-time delays, and direct booking links for SBB.418 PyPI1MIT