Prerequisites
- Install
mta-jswithnpm install mta-js. - Set
MTA_API_KEYin your environment. - Requires
mta-js2.4.0 or later.
1
Explore stations and routes
Each railroad has its own stops and routes endpoints:Use
/api/v1/lirr/routes/{route}/stops or /api/v1/metro-north/routes/{route}/stops to list stations served by a route. The route segment accepts an ID or exact route name, such as Babylon Branch:2
Get upcoming departures
The Each departure includes its
stop parameter accepts a station ID, stop code, or exact station name, matched without case sensitivity. For example, use Penn Station for LIRR or Grand Central for Metro-North. You can also filter by route and set a limit.trainNumber, destination, scheduled time, minutes until the event, and delaySeconds when available. The response also includes the route, station, direction, and peak/off-peak classification.3
Check train locations and alerts
Vehicle locations can be filtered by route. Service alerts are available separately for both systems:
4
Use the MCP tools or shared stop catalog
The read-only MCP tools are
get_lirr_departures, get_metro_north_departures, and list_commuter_rail_stops.LIRR and Metro-North stops and routes are also available in the shared endpoints. Add modes=lirr,metro-north to /stops/near and /routes; omitted modes continue to default to subway and bus.