mcp-server-public-transport
mcp-server-public-transport
Un servidor MCP que proporciona datos de transporte público en tiempo real en toda Europa.
Acerca de
mcp-server-public-transport es un servidor local compatible con el Protocolo de Contexto de Modelo (MCP) que proporciona acceso a datos de transporte público en toda Europa. Actualmente, integra APIs del Reino Unido, Suiza, Noruega, Bélgica y Berlín/Brandeburgo, lo que le permite recuperar conexiones de tren, salidas en vivo y ubicaciones de autobuses.
Related MCP server: BVG MCP Server
Estado de implementación de funciones
Países admitidos
País | URL base de la API | Estado |
Reino Unido | ✅ | |
Suiza | ✅ | |
Bélgica | ✅ | |
Noruega | ✅ | |
Berlín/Brandeburgo | ✅ |
Funciones por país
Función | Ruta de la API | Estado |
Reino Unido | ||
Salidas en vivo |
| ✅ |
Suiza | ||
Buscar conexiones |
| ✅ |
Búsqueda de estaciones |
| ✅ |
Panel de salidas |
| ✅ |
Estaciones cercanas |
| ✅ |
Bélgica | ||
Salidas en vivo |
| ✅ |
Búsqueda de estaciones |
| ✅ |
Estaciones cercanas |
| ✅ |
Noruega | ||
Búsqueda de lugares |
| ✅ |
Salidas en vivo |
| ✅ |
Planificación de viajes |
| ✅ |
Paradas más cercanas |
| ✅ |
Berlín/Brandeburgo | ||
Búsqueda de ubicación |
| ✅ |
Salidas en vivo |
| ✅ |
Llegadas en vivo |
| ✅ |
Planificación de viajes |
| ✅ |
Estaciones cercanas |
| ✅ |
Configuración
Variables de entorno
Establezca las siguientes variables de entorno:
UK_TRANSPORT_APP_ID=your_uk_app_id
UK_TRANSPORT_API_KEY=your_uk_api_keyUso con Claude Desktop
Añada a su 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"
}
}
}
}
Reemplace /ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-server-public-transport con la ruta real donde ha clonado el repositorio.
Nota: Es posible que deba poner la ruta completa al ejecutable uv en el campo de comando. Puede obtenerla ejecutando which uv en MacOS/Linux o where uv en Windows.
Desarrollo
Configuración del entorno de desarrollo
Clonar el repositorio
git clone https://github.com/mirodn/mcp-server-public-transport.git
cd mcp-server-public-transportInstalar dependencias
uv syncEstablecer variables de entorno
cp .env.example .envEjecutar el servidor
uv run server.pyEjecución de pruebas
El proyecto utiliza pytest para realizar pruebas con los siguientes comandos disponibles:
# Run all tests
make testCalidad del código
# Run linting
make lint
# Run code formatting
make formatIntegración continua
El proyecto incluye un flujo de trabajo de GitHub Actions (.github/workflows/test.yml) que automáticamente:
Ejecuta pruebas en Python 3.10, 3.11 y 3.12
Ejecuta comprobaciones de linting usando ruff
Se ejecuta en cada push y pull request a la rama
main
La canalización de CI garantiza la calidad del código y la compatibilidad entre las versiones de Python admitidas antes de que se fusionen los cambios.
Contribución
¡Las contribuciones son bienvenidas! Por favor, siéntase libre de enviar un Pull Request.
El paquete se despliega automáticamente en PyPI cuando se actualiza project.version en pyproject.toml.
Siga semver para el versionado.
Licencia
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.440 PyPI1MIT