Skip to main content
Glama

mcp-server-public-transport

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

CountryAPI Base URLStatus
United Kingdomhttps://transportapi.com
Switzerlandhttps://transport.opendata.ch
Belgiumhttps://api.irail.be
Norwayhttps://api.entur.io

Features by Country

FeatureAPI PathStatus
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 DeparturesGraphQL: stopPlace(id) { estimatedCalls(...) }
Trip PlanningGraphQL: trip(from, to, dateTime, numTripPatterns, ...)
Nearest StopsGraphQL: nearest(latitude, longitude, maximumDistance, ...)

Setup

Environment Variables

Set the following environment variables:

UK_TRANSPORT_APP_ID=your_uk_app_id UK_TRANSPORT_API_KEY=your_uk_api_key

Usage with Claude Desktop

Add to your 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" } } } }

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

  1. Clone the repository
    git clone https://github.com/mirodn/mcp-server-public-transport.git cd mcp-server-public-transport
  2. Install dependencies
    uv sync
  3. Set environment variables
    cp .env.example .env
  4. Run the server
    uv run server.py

Running Tests

The project uses pytest for testing with the following commands available:

# Run all tests make test

Code Quality

# Run linting make lint # Run code formatting make format

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

MIT License

Deploy Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

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.

mcp-server-public-transport is an open-source, locally hosted server providing an interface for accessing public transport data across Europe.

  1. About
    1. Feature Implementation Status
      1. Supported Countries
      2. Features by Country
    2. Setup
      1. Environment Variables
      2. Usage with Claude Desktop
    3. Development
      1. Setting up Development Environment
      2. Running Tests
      3. Code Quality
      4. Continuous Integration
    4. Contributing
      1. License

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          MCP 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 -
          4
          3
          MIT License
        • -
          security
          F
          license
          -
          quality
          An 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 -
        • -
          security
          A
          license
          -
          quality
          An 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 -
          3
          MIT License

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/mirodn/mcp-server-public-transport'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server