MBTA MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MBTA MCP
Model Context Protocol (MCP) server that exposes live MBTA V3 transit data over Streamable HTTP.
Public production endpoint (after Cloud Run deploy):
https://mbta.metaverseprofessional.tech/mcp
For more info, I wrote a Medium post about this project here: Link
Architecture
MCP Client
→ Streamable HTTP (/mcp)
→ Python MCP server (MCP Python SDK v2)
→ MBTA V3 API (https://api-v3.mbta.com)Related MCP server: marta-mcp
Tools
Tool | When to use |
| List routes; optional |
| Stops for a known |
| Resolve a station/stop name to stop IDs (client-side name match) |
| Predicted arrivals at a |
| Service alerts; optional route/stop filters |
| Live vehicle positions; optional |
Also exposes GET /health for load balancers and Cloud Run probes.
Requirements
Python 3.12+
MBTA API key from api-v3.mbta.com
Quick start (local)
cd MBTA-MCP
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e ".[dev]"
copy .env.example .env
# Edit .env and set MBTA_API_KEY=...
python -m mbta_mcpServer listens on:
MCP:
http://127.0.0.1:8080/mcpHealth:
http://127.0.0.1:8080/health
Or with uvicorn:
uvicorn mbta_mcp.server:create_app --factory --host 0.0.0.0 --port 8080Configuration
All secrets come from the environment (never hardcode keys).
Variable | Required | Default | Description |
| recommended | — | MBTA V3 API key (optional for light anonymous testing) |
| no |
| Bind address |
| no |
| Bind port (Cloud Run sets this) |
| no |
| API base URL |
| no |
| Logging level |
| no | localhost + production host | Streamable HTTP Host allowlist |
See .env.example.
Tests
pytest
pytest -m integration # live MBTA calls when MBTA_API_KEY is setSmoke-test tools against a running server:
python scripts/smoke_tools.py --url http://127.0.0.1:8080/mcpDocker
docker build -t mbta-mcp .
docker run --rm -p 8080:8080 -e MBTA_API_KEY=your_key mbta-mcpThen:
curl http://127.0.0.1:8080/health
python scripts/smoke_tools.py --url http://127.0.0.1:8080/mcpConnect an MCP client
Point a Streamable HTTP MCP client at:
Local:
http://127.0.0.1:8080/mcpProduction:
https://mbta.metaverseprofessional.tech/mcp
Cloud Run (later — do not deploy until local + Docker work)
Store the key in Secret Manager as
MBTA_API_KEY.Build/push the image to Artifact Registry.
Deploy to Cloud Run with:
secret mapped to env var
MBTA_API_KEYcontainer port
8080health check path
/health
Map custom domain
mbta.metaverseprofessional.tech.Ensure
MCP_ALLOWED_HOSTSincludesmbta.metaverseprofessional.techandmbta.metaverseprofessional.tech:*.
App code only reads MBTA_API_KEY from the environment; Secret Manager wiring is a Cloud Run concern.
Project layout
src/mbta_mcp/
server.py # MCPServer, tools, /health
config.py # env settings
mbta/client.py # MBTA V3 httpx client
tools/ # tool handlers
tests/
DockerfileLicense
Use at your own risk. MBTA data is subject to MBTA API terms of use.
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
- UnifAPIOAuthcom.unifapi
Hosted MCP server for live public-data APIs and Skills for AI agents.
The official MCP Server for the Mux API
Public MCP server for discovering open jobs. Search, filter, and get application links.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that provides tools for querying live transit data (stops, departures, routes, vehicles, alerts) from any WP GTFS Pro site, enabling AI assistants to answer rider questions.7 npmGPL 2.0
- AlicenseAqualityCmaintenanceMCP server for Atlanta MARTA real-time transit data, enabling queries about train arrivals and bus positions via natural language.4MIT
- AlicenseCqualityCmaintenanceMCP server for the UK Bus Open Data Service, enabling timetable queries, stop search, route discovery, journey planning, and real-time bus tracking.1625 PyPIMIT
- AlicenseBqualityDmaintenanceMCP server exposing Pittsburgh Regional Transit (PRT) TrueTime operations as typed tools for agent clients.7MIT