> ## Documentation Index
> Fetch the complete documentation index at: https://mtaapi.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server

> Connect MCP clients to live MTA transit data and account tools.

Connect MCP-compatible clients to the MTA API using Streamable HTTP.

**Endpoint**

```text theme={null}
https://www.mtaapi.dev/mcp
```

## Authentication

> [card] API key
>
> Send your MTA API key as `Authorization: Bearer <key>`. Requests use the same authentication, metering, quotas, and plan limits as REST API requests.

> [card] Clerk OAuth
>
> Clients that sign in instead of sending an authorization header can use Clerk OAuth. The account needs a paid plan for data access. The first data-tool call creates an **MCP (auto)** API key for usage; it appears with the account's other keys on the dashboard.

## Connect a client

Use an API key in clients that support custom headers. Clients without custom headers can connect using Clerk OAuth.

> [tab] Claude Code
>
> Set `MTA_API_KEY` in your shell, then run:
>
> ```bash theme={null}
> claude mcp add --transport http mta https://www.mtaapi.dev/mcp --header "Authorization: Bearer $MTA_API_KEY"
> ```

> [tab] Cursor
>
> Add the server to `.cursor/mcp.json`. Replace the placeholder with your API key and keep the file out of version control if it contains a secret.
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "mta": {
>       "url": "https://www.mtaapi.dev/mcp",
>       "headers": {
>         "Authorization": "Bearer <your_api_key>"
>       }
>     }
>   }
> }
> ```

> [tab] Claude.ai / ChatGPT
>
> Create a custom MCP connector and enter the server URL. The client will start Clerk OAuth sign-in; no API key header is needed.
>
> ```text theme={null}
> https://www.mtaapi.dev/mcp
> ```

## Transit tools

Transit tools are read-only. With an API key, each call is authenticated and metered exactly like the corresponding REST request.

| Tool | Description | Key parameters |
| - | - | - |
| `subway_arrivals` | Get subway arrivals. | `stopId` (required), `route`, `direction` (`north`, `south`, `uptown`, `downtown`), `limit` (1–100), `includeRaw` |
| `subway_direction` | Resolve rider-entered destination text such as Union Sq into a subway direction using ordered static GTFS stop data. | `route`, `fromStopId`, `destination` (all required) |
| `subway_arrival_board` | Find nearby subway stations and group upcoming arrivals by direction for each station. | `lat`, `lon` (required), `route`, `radiusMeters`, `limitStations` (1–20), `limitArrivals` (1–10), `includeRaw` |
| `subway_route_stations` | Get ordered subway stations for a route. | `route` (required), `direction`, `includeArrivals`, `limitArrivals`, `limitStops`, `includeRaw` |
| `bus_vehicles` | Get bus vehicles. | `route`, `vehicleId`, `limit` (1–100), `includeRaw` |
| `bus_arrival_board` | Find nearby bus stops and group upcoming arrivals by route and headsign. | `lat`, `lon` (required), `route`, `radiusMeters`, `limitStops` (1–20), `limitArrivals` (1–10), `includeRaw` |
| `bus_route_stops` | Get ordered bus stops for a route. | `route` (required), `direction`, `includeArrivals`, `limitArrivals`, `limitStops`, `includeRaw` |
| `get_njt_rail_departures` | Get upcoming NJ Transit rail departures from a station. | `station` (required), `line`, `limit` (1–50) |
| `list_njt_rail_stations` | List NJ Transit rail stations supported by the API. | None |
| `get_nyc_ferry_arrivals` | Get live NYC Ferry arrivals joined to static stop and route names. | `stop`, `route`, `limit` |
| `list_nyc_ferry_stops` | List NYC Ferry stops supported by the API. | None |
| `find_citi_bike_stations` | Find nearby Citi Bike stations and check current availability. | `lat`, `lon` (required), `radius`, `limit`, `minBikes`, `minDocks`, `ebike` |
| `get_citi_bike_station` | Get a Citi Bike station by station ID or short name. | `id` (required) |
| `get_lirr_departures` | Get upcoming LIRR departures from a station. | `stop` (required), `route`, `limit` |
| `get_metro_north_departures` | Get upcoming Metro-North departures from a station. | `stop` (required), `route`, `limit` |
| `list_commuter_rail_stops` | List LIRR or Metro-North stations, optionally filtered by name. | `system` (`lirr` or `metro-north`), `name` |
| `alerts` | Get current service alerts. | `mode` (`subway`, `bus`, `lirr`, or `metro-north`), `route`, `stopId`, `includeRaw` |
| `stops_near` | Find nearby transit stops, optionally filtered to stops served by a specific route. | `lat`, `lon` (required), `modes` (comma-separated), `route`, `includeRoutes`, `radiusMeters`, `limit` |
| `stops` | Look up stops in selected transit modes while preserving request order. | `ids` (required; comma-separated), `includeRoutes`, `modes` |
| `routes` | List subway and bus routes by default; add PATH, NJ Transit rail, NYC Ferry, LIRR, or Metro-North with `modes`. | `modes` (comma-separated) |

### PATH tools

| Tool | Description | Key parameters |
| - | - | - |
| `get_path_arrivals` | Get live PATH train arrivals for New Jersey stations. | `station`, `route`, `direction` (`to-ny`, `to-nj`, `east`, `west`), `limit` |
| `list_path_stations` | List PATH stations in New Jersey supported by the API. | None |

## OAuth-only account tools

Account tools need Clerk OAuth sign-in (scopes `openid profile email`) and act only on the signed-in user's own keys and billing.

| Tool | Description | Key parameters |
| - | - | - |
| `whoami` | Returns the Clerk user ID authorized for this MCP session. | None |
| `create_api_key` | Creates a new MTA API key for the authorized Clerk user. The key secret is returned once. | `name` (required) |
| `list_api_keys` | Lists API keys for the authorized Clerk user without returning key secrets. | None |
| `revoke_api_key` | Revokes one API key owned by the authorized Clerk user. | `keyId` (required) |
| `get_usage` | Returns usage totals and coverage metadata (`partial`, `coverageStart`). | `keyId`, `window` (`current_period` or `month`) |
| `get_billing` | Returns the authorized Clerk user's current plan, limits, and billing links. | None |

## Errors and limits

If Clerk OAuth is used without an eligible paid plan, a data-tool call that needs to create the usage key returns `plan_required`. Choose a plan from the [billing dashboard](https://www.mtaapi.dev/dashboard?tab=billing), then retry.

Data-tool text output includes any quota headers returned by the REST API: `X-MTA-API-Request-Cost`, `X-MTA-API-Credits-Remaining`, `X-MTA-API-RateLimit-Limit`, and `X-MTA-API-RateLimit-Remaining`. Calls remain subject to the account's REST plan and rate limits.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.