metrotransit-mcp
Provides Google Gemini tool declarations and handlers for accessing Metro Transit departures, routes, stops, and service alerts.
Provides OpenAI function definitions and handlers so OpenAI agents can retrieve Metro Transit departures, routes, stops, and alerts.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@metrotransit-mcp what are the next departures at stop 51408?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
metrotransit-mcp
A unified Model Context Protocol (MCP), Command Line Interface (CLI), and Agent Capabilities Protocol (ACP) toolkit for Metro Transit in the Minneapolis–Saint Paul metropolitan area.
Connect your AI assistants (Claude Desktop, Cursor, Antigravity, custom agents) or query directly from your terminal for real-time bus & light rail departures, station search, route schedules, and live alerts.
Zero API keys or signups required — built on Metro Transit's open public REST API.
What's Included
🔌 MCP Server: Stdio server implementing the official Model Context Protocol for Claude, Cursor, Antigravity, and other MCP clients.
💻 Interactive CLI: Beautiful terminal tool for departures, routes, directions, stops, and incident reports.
🤖 ACP (Agent Capabilities Protocol): Ready-to-use function calling declarations and execution handlers for OpenAI, Anthropic Claude, and Google Gemini agents.
📜 Downloaded OpenAPI / Swagger Specs: Full OpenAPI 3.0.4 definitions for NexTrip v2, Alerts v1, Trip Planner v1, and Schedule v1 included in
spec/.
Related MCP server: BusTime MCP
1. CLI Usage
You can run commands directly using npx metrotransit-mcp <command> or by installing globally (npm i -g metrotransit-mcp).
# List all routes or search by name/number
metrotransit routes
metrotransit routes green
metrotransit routes 94
# Show route travel directions
metrotransit directions 902
# List stops for a route in a specific direction (0 = EB/NB, 1 = WB/SB)
metrotransit stops 902 0
# Search for a station on a route
metrotransit search 902 "U.S. Bank"
metrotransit search 902 "Nicollet"
# Live countdown departure board by Stop ID (posted at bus stops & platforms)
metrotransit departures 51408
# Live countdown departure board by Route + Direction + Place Code
metrotransit departures 902 0 5SNI
# Check active detours, service advisories, and closures
metrotransit alerts
metrotransit alerts 902
metrotransit alerts 94 --keyword detour
# Inspect downloaded OpenAPI / Swagger specs
metrotransit spec2. Model Context Protocol (MCP) Setup
Run via NPX
npx metrotransit-mcp(When launched by an MCP client or without arguments on a piped stdio, it automatically starts the MCP server).
Claude Desktop Configuration
Add to your claude_desktop_config.json:
macOS / Linux
{
"mcpServers": {
"metrotransit": {
"command": "npx",
"args": ["-y", "metrotransit-mcp"]
}
}
}Windows
{
"mcpServers": {
"metrotransit": {
"command": "cmd.exe",
"args": ["/c", "npx", "-y", "metrotransit-mcp"]
}
}
}Cursor / Antigravity / Other MCP Clients
{
"mcpServers": {
"metrotransit": {
"command": "node",
"args": ["/path/to/metrotransit-mcp/dist/index.js", "mcp"]
}
}
}MCP Tools Provided
list_routes– List or search all Twin Cities transit routes.get_route_directions– Get directional travel options (Eastbound/Westbound, Northbound/Southbound).get_route_stops– Get all stations/stops and place codes for a route.search_stops– Fuzzy search stations along a route.get_departures– Live GPS countdowns, departure times, and stop alerts by 4–5 digit Stop ID or Route + Place Code.get_service_alerts– Check active detours, stop closures, or incident advisories.
3. Agent Capabilities Protocol (ACP)
Need to equip a custom agent with Metro Transit tools without MCP?
Run:
# Output OpenAI function definitions
metrotransit acp --format openai
# Output Anthropic tool definitions
metrotransit acp --format anthropic
# Output Google Gemini tool declarations
metrotransit acp --format geminiOr import directly in TypeScript / JavaScript:
import {
getOpenAITools,
getAnthropicTools,
getGeminiTools,
executeAgentTool,
} from "metrotransit-mcp";
// 1. Pass tool definitions to your model
const tools = getOpenAITools();
// 2. Execute when tool is called
const result = await executeAgentTool("metrotransit_get_departures", {
stop_id: 51408,
});4. OpenAPI / Swagger Specs
The repository includes the official OpenAPI 3.0.4 schemas directly in the spec/ folder:
spec/nextrip-v2.json: Real-time vehicle positions, arrival countdowns, and routes.spec/alerts-v1.json: Incident alerts, construction reroutes, and detours.spec/tripplanner-v1.json: Transit itinerary planning and geocoding.spec/schedule-v1.json: Static timetable schedules and planned stop details.
Development & Testing
# Install dependencies
npm install
# Build
npm run build
# Run unit tests
npm test
# Test CLI
node dist/index.js departures 51408License
MIT © Amin
Available Tools
6 toolsget_departuresA
Get real-time departure predictions, vehicle countdowns, and stop alerts for a Metro Transit stop or station. You can query either by a 4-5 digit Stop ID, or by Route ID + Direction ID + Place Code.
Inputs: stop_id, route_id, place_code, direction_id.
get_route_directionsA
Get valid travel directions for a specific route (e.g., Eastbound/Westbound, Northbound/Southbound) and their direction IDs.
Inputs: route_id (required).
get_route_stopsA
Get all scheduled stops for a route in a specific direction, including their place codes and station descriptions.
Inputs: route_id (required), direction_id (required).
get_service_alertsA
Get active service alerts, detours, stop closures, and disruptions across the Metro Transit network, optionally filtered by route ID or keyword.
Inputs: keyword, route_id.
list_routesA
Get all Metro Transit routes in the Minneapolis-St. Paul metro area (METRO Blue/Green/Gold/Orange/Red/A/B/C/D/E lines and bus routes). Supports optional filtering by search query.
Inputs: query.
search_stopsA
Search for stops/stations along a specific route by keyword or station name (e.g., search 'Stadium' or 'Nicollet' on the Green Line).
Inputs: query (required), route_id (required), direction_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct transit resource (routes, directions, stops, departures, alerts), but get_route_stops and search_stops overlap in purpose—one returns all stops while the other filters them by keyword. Descriptions are clear enough to differentiate, though minor boundary ambiguity exists.
All tool names follow a consistent snake_case verb_noun pattern (list_routes, get_route_directions, get_departures, search_stops). No mixed conventions or vague verbs, making the set highly predictable.
Six tools is well-scoped for a transit information server, covering route discovery, stop lookup, departures, and alerts without unnecessary bloat. Each tool earns its place in the workflow.
The core transit query surface is covered: routes, directions, stops, departures, and alerts. Minor gaps exist such as no route-by-ID lookup or stop details endpoint, but agents can achieve common tasks with the provided operations.
Maintenance
Related MCP Connectors
NJ Transit rail, bus and PATH schedules via MCP (scheduled, plus live PATH)
TriMet MCP — live arrivals, stop lookup, vehicle positions and service alerts for Portland…
SEPTA MCP — Philadelphia SEPTA real-time transit (www3.septa.org/api, keyless)
MBTA MCP — Boston real-time transit via the MBTA v3 API (api-v3.mbta.com)
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables querying self-hosted OpenTripPlanner for accurate transit routes via MCP, supporting both stdio and HTTP.359 npmMIT
- FlicenseAqualityDmaintenanceWraps the CTA Bus Tracker API to provide live access to bus routes, stops, predictions, vehicle locations, patterns, and detours via MCP clients.11-
- AlicenseNot gradedqualityBmaintenanceEnables querying stops, routes, real-time arrivals, vehicle positions, and schedules from OneBusAway transit APIs via MCP, supporting STDIO or Streamable HTTP.121 npm2Apache 2.0
- FlicenseNot gradedqualityDmaintenanceMCP server exposing live MBTA V3 transit data, with tools for routes, stops, arrivals, alerts, and vehicle positions.-