Get the FREE Ultimate OpenClaw Setup Guide →

metro

Metro-MCP connects LLMs and other AI agents to live transit data from NYC Subway and DC Metro. Train positions, arrivals, delays—all in real-time through MCP.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio aarekaz-metro-mcp npx -y metro-mcp

How to use

This MCP server provides a unified interface to query real-time transit data and station information for DC Metro (WMATA) and New York City Subway (MTA). It exposes a set of MCP tools that let clients fetch live train predictions, search stations, list stations by line, check service incidents, and obtain complete station inventories with coordinates. Clients connect via the MCP protocol, authenticate using OAuth 2.1 with PKCE, and then issue tool calls such as get_station_predictions, search_stations, get_stations_by_line, get_incidents, and get_all_stations. The server is designed to work with Claude Desktop and any MCP-compatible client, enabling natural-language style queries with structured tool calls behind the scenes.

How to install

Prerequisites:

  • Node.js or Bun installed on your machine
  • Cloudflare Wrangler (for deployment to Workers) and a Cloudflare account
  • A WMATA API key for real-time data access
  • A GitHub OAuth App for user authentication

Setup steps:

  1. Install dependencies (recommended Bun):
bun install

Or with npm:

npm install
  1. Generate a JWT secret (for token signing):
openssl rand -hex 32
  1. Create a GitHub OAuth App and capture Client ID/Secret:
  1. Create Cloudflare KV namespaces for OAuth clients and rate limiting:
bunx wrangler kv namespace create "OAUTH_CLIENTS"
bunx wrangler kv namespace create "OAUTH_CLIENTS" --preview

bunx wrangler kv namespace create "RATE_LIMIT_KV"
bunx wrangler kv namespace create "RATE_LIMIT_KV" --preview
  1. Copy example config files and fill in values:
cp wrangler.toml.example wrangler.toml
# Update the KV namespace IDs in wrangler.toml

cp .dev.vars.example .dev.vars
# Add your actual secrets to .dev.vars
  1. Set production secrets (Cloudflare stored):
bunx wrangler secret put WMATA_API_KEY
bunx wrangler secret put GITHUB_CLIENT_SECRET
bunx wrangler secret put JWT_SECRET
  1. Deploy to Cloudflare Workers:
bunx wrangler deploy

If you prefer running locally, you can start the local development server using your chosen runtime (e.g., Bun or Node) with the appropriate entry point for the metro-mcp package.

Additional notes

Environment variables and secrets:

  • WMATA_API_KEY: WMATA API key for real-time data
  • GITHUB_CLIENT_SECRET: GitHub OAuth client secret
  • JWT_SECRET: Secret for signing JWT access tokens

Deployment tips:

  • The server is typically deployed to Cloudflare Workers via Wrangler; ensure wrangler is configured with your account and project bindings
  • If you upgrade dependencies, re-run docker/npm/bun install accordingly and re-deploy
  • For OAuth flows, ensure your Homepage and Callback URLs are publicly reachable when deployed

Common issues:

  • Missing WMATA API key leads to failed real-time queries
  • Incorrect KV namespace IDs in wrangler.toml will block OAuth persistence
  • If OAuth redirects fail, verify your GitHub OAuth App settings and callback URL

Related MCP Servers

Sponsor this space

Reach thousands of developers