Real-time MBTA transit predictions for Boston-area subway, bus, commuter rail, and ferry. Query departure times, search stops/routes, check service alerts, and run a live dashboard. Use when asked about Boston transit, T schedules, when to leave for the train, or MBTA service status.
Query real-time MBTA predictions via the v3 API.
# Optional but recommended for higher rate limits
export MBTA_API_KEY=your_key_here # Free at https://api-v3.mbta.com/portal
# Install dependencies
pip install requests pyyaml flask # flask only needed for dashboard
cd skills/mbta
# Next departures from a stop
python scripts/mbta.py next --stop place-alfcl # Alewife
python scripts/mbta.py next --stop place-harsq --route Red # Harvard, Red Line only
# Search for stop IDs
python scripts/mbta.py stops --search "Porter"
python scripts/mbta.py stops --search "Kendall"
# List routes
python scripts/mbta.py routes # All routes
python scripts/mbta.py routes --type rail # Subway only
python scripts/mbta.py routes --type bus # Buses
# Service alerts
python scripts/mbta.py alerts # All alerts
python scripts/mbta.py alerts --route Red # Red Line alerts
# All configured departures (uses config.yaml)
python scripts/mbta.py departures --config config.yaml
# Start web dashboard
python scripts/mbta.py dashboard --config config.yaml --port 6639
Edit config.yaml to set up your stops: