Docs for the live transit MCP.

metro-mcp exposes DC Metro and NYC Subway data through MCP tools, resources, and prompts. This page covers client setup, public endpoints, what each tool can answer, and which official transit feeds power the results.

Connect an MCP client

The production MCP endpoint is anonymous Streamable HTTP. No login is required. No client credentials, token, or OAuth flow is required; stale Authorization headers are ignored.

Claude Desktop / Cursor config
{
  "mcpServers": {
    "metro-mcp": {
      "url": "https://metro-mcp.anuragd.me/mcp"
    }
  }
}

Codex CLI

Add the same anonymous Streamable HTTP endpoint from a terminal.

codex mcp add metro-mcp https://metro-mcp.anuragd.me/mcp

Generic client

Use name metro-mcp, URL https://metro-mcp.anuragd.me/mcp, and transport streamable-http.

HTTP endpoints

The Worker serves both the public website and anonymous MCP API. MCP traffic, metadata, and static pages are public.

GET/

Landing page.

GET/docs/

This documentation page.

GET/info

JSON server summary: supported cities, station counts, capabilities, and MCP endpoint.

POST/mcp

Primary anonymous MCP Streamable HTTP endpoint.

POST/OPTIONS/sse

Stateless alias for /mcp. GET /sse returns 405; it is not a persistent stream.

MCP tools

Every tool is read-only and returns structured content plus serialized JSON text for older clients. Station-name tools search first, and ambiguous matches can trigger MCP elicitation where the client supports it.

Station discovery

search_stations, get_all_stations, and get_stations_by_line cover both DC and NYC. Results include IDs, names, lines, coordinates, and addresses when available.

Arrivals

get_station_predictions resolves a station name or code and returns line, destination, minutes away, arrival time, status, cars, direction, and track where the feed provides it.

Service state

get_incidents works for DC and NYC. get_elevator_incidents is DC-only and returns unit, station, symptom, outage time, estimated return, and update time.

DC bus and rail operations

get_bus_predictions, get_bus_routes, get_bus_stops, get_bus_positions, and get_train_positions expose WMATA bus arrivals, route catalogs, stop search, live buses, and live train positions.

NYC route detail

get_route_info returns route names and service descriptions. get_station_transfers returns platform and nearby transfers with walk times in seconds and minutes.

Progress and safety hints

get_all_stations emits progress notifications when clients pass a progress token. Tool annotations mark calls as read-only, idempotent, and open-world because they query live transit systems.

Data sources and cache windows

metro-mcp normalizes official agency data into MCP-friendly JSON. DC data is fetched from WMATA REST APIs with Cloudflare edge caching; NYC uses MTA GTFS-realtime feeds plus bundled station and route metadata.

WMATA: DC Metro and Metrobus

Requires the server-side WMATA API key configured in the Worker environment.

CapabilityOfficial endpointCache
Stations/Rail.svc/json/jStations1 hour
Rail arrivals/StationPrediction.svc/json/GetPrediction/{station}30 sec
Incidents/Incidents.svc/json/Incidents5 min
Elevator outages/Incidents.svc/json/ElevatorIncidents5 min
Bus arrivals/NextBusService.svc/json/jPredictions30 sec
Train positions/TrainPositions/TrainPositions10 sec
Bus routes/Bus.svc/json/jRoutes1 hour
Bus stops/Bus.svc/json/jStops30 min
Bus positions/Bus.svc/json/jBusPositions10 sec

MTA: NYC Subway

Public feeds are read without a server-side API key.

CapabilitySourceCache
Arrivalsnyct/gtfs* GTFS-realtime protobuf feeds for ACE, BDFM, G, JZ, NQRW, L, numbered lines, and SIR30 sec in-memory
Alertscamsys/subway-alerts.jsonLive fetch
StationsBundled NYC_STATIONS metadataStatic asset in code
RoutesBundled NYC_ROUTES metadataStatic asset in code
TransfersBundled station transfer recordsStatic asset in code

Resources and prompts

Clients that support more of MCP can read resource URIs directly and invoke prompt templates instead of hand-writing tool instructions.

TypeNameWhat it does
Resourcetransit://stations/{city}/{id}Station metadata with coordinates, lines, address, and transfer records.
Resourcetransit://routes/{city}/{id}Route metadata. NYC has rich route records; DC route detail is not implemented yet.
Resourcetransit://incidents/{city}Live per-city incident feed. Read-only in this release.
Promptservice-briefingAsks the model to summarize current incidents for a whole system or line.
Promptcommute-plannerAsks the model to resolve stations, check arrivals, inspect incidents, and produce a route plan.
Promptaccessibility-checkUses DC elevator outages to flag accessibility impacts along a route.

Cloudflare stack

metro-mcp runs as a small Cloudflare application: the edge handles web pages, anonymous MCP requests, lightweight rate limiting, and logs close to the user.

Workers

The Worker is the front door. It serves the site, accepts anonymous MCP traffic, and routes requests to the right part of the app.

Request-scoped runtime

Each MCP request runs in a request-scoped stateless runtime. It does not support resumability or server push.

Rate limiting and rollback

The Cloudflare Rate Limit binding applies roughly 300 requests per 60-second window per source-IP key per Cloudflare location. Shared egress IPs group clients, and enforcement is eventually consistent. The inactive MetroMcpAgent rollback class and v1 migration remain for rollback.

Assets and logs

Cloudflare serves the landing page and docs as static assets, while Worker logs and source maps make production behavior easier to debug after deploys.