The mcp-server-public-transport provides real-time public transport data across Europe, primarily for Switzerland and Belgium. Key features include:
Switzerland:
Search train connections between stations with real-time departure times, duration, platforms, and transfers
Search stations by name or location
Get real-time departure boards for specific stations
Find nearby stations using geographical coordinates
Belgium:
Search train connections between stations using iRail API for real-time routes and schedules
Search stations by name
Get live departure boards for specific stations
Retrieve details about specific train vehicles by ID
The server is MCP-compatible and can be integrated with Claude Desktop for enhanced functionality.
mcp-server-public-transport
An MCP-compatible 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 and Belgium, allowing you to retrieve train connections, live departures, and bus locations.
Feature Implementation Status
Supported Countries
Country | API Base URL | Status |
---|---|---|
United Kingdom | https://transportapi.com | ✅ |
Switzerland | https://transport.opendata.ch | ✅ |
Belgium | https://api.irail.be | ✅ |
Norway | https://api.entur.io | ✅ |
Features by Country
Feature | API Path | Status |
---|---|---|
United Kingdom | ||
Live Departures | /uk/train/station_timetables/{station_code}.json | ✅ |
Switzerland | ||
Search Connections | /connections | ✅ |
Station Lookup | /locations | ✅ |
Departure Board | /stationboard | ✅ |
Nearby Stations | /locations?x={lon}&y={lat} | ✅ |
Belgium | ||
Live Departures | /departures | ✅ |
Station Lookup | /stations | ✅ |
Nearby Stations | /stations/nearby | ✅ |
Norway | ||
Place Search | /geocoder/v1/autocomplete | ✅ |
Live Departures | GraphQL: stopPlace(id) { estimatedCalls(...) } | ✅ |
Trip Planning | GraphQL: trip(from, to, dateTime, numTripPatterns, ...) | ✅ |
Nearest Stops | GraphQL: nearest(latitude, longitude, maximumDistance, ...) | ✅ |
Setup
Environment Variables
Set the following environment variables:
Usage with Claude Desktop
Add to your claude_desktop_config.json`:
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
- Install dependencies
- Set environment variables
- Run the server
Running Tests
The project uses pytest for testing with the following commands available:
Code Quality
Continuous 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
main
branch
The CI pipeline ensures code quality and compatibility across supported Python versions before any changes are merged.
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
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
mcp-server-public-transport is an open-source, locally hosted server providing an interface for accessing public transport data across Europe.
Related MCP Servers
- -securityAlicense-qualityMCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.Last updated -43MIT License
- -securityFlicense-qualityAn MCP Server that enables interaction with Maharashtra's Motor Vehicle Department API, allowing users to access transportation-related services through natural language requests.Last updated -
- -securityAlicense-qualityAn MCP server providing access to Hong Kong transportation data, including passenger traffic statistics at control points and real-time bus arrival information for KMB and Long Win Bus services.Last updated -3MIT License
- -securityFlicense-qualityAn MCP server that enables interaction with the Transport Department of Puducherry's API services through natural language, providing access to transportation-related data and operations.Last updated -