MBTA Transit
by @squidpunch
Provides real-time MBTA transit info including next departures, service alerts, live vehicle locations, stop searches, and route listings for Boston-area tra...
clawhub install mbta-transitπ About This Skill
MBTA Transit Skill
Query real-time MBTA (Massachusetts Bay Transportation Authority) transit data: next departures, service alerts, and live vehicle positions for subway, bus, commuter rail, and ferry.
What This Skill Does
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| MBTA_API_KEY | Optional | Higher rate limits (1000 req/min vs 20). Free at https://api-v3.mbta.com/ |
Script: scripts/mbta.py
Commands
#### stops β Find stops by name
python3 scripts/mbta.py stops "South Station"
python3 scripts/mbta.py stops "Harvard"
python3 scripts/mbta.py stops "Kenmore"
Returns: Stop IDs, names, platform info, city.#### departures β Next departures
python3 scripts/mbta.py departures place-sstat 10
python3 scripts/mbta.py departures "Back Bay" 5
python3 scripts/mbta.py departures place-north
Returns: Departure times, route names, destinations.#### alerts [--stop β Active service alerts
python3 scripts/mbta.py alerts --route Red
python3 scripts/mbta.py alerts --stop place-sstat
python3 scripts/mbta.py alerts --route Orange --stop place-dwnxg
python3 scripts/mbta.py alerts # all active alerts
Returns: Alert header, effect type, severity, description, last updated.#### vehicles β Live vehicle positions
python3 scripts/mbta.py vehicles Red
python3 scripts/mbta.py vehicles Orange
python3 scripts/mbta.py vehicles "Green-D"
python3 scripts/mbta.py vehicles 1 # Route 1 bus
Returns: Vehicle label, current stop/status, heading, occupancy, last update time.#### routes [--type <0-4>] β List routes
python3 scripts/mbta.py routes
python3 scripts/mbta.py routes --type 1 # Subway/Heavy Rail
python3 scripts/mbta.py routes --type 2 # Commuter Rail
python3 scripts/mbta.py routes --type 3 # Bus
Route types: 0=Light Rail, 1=Heavy Rail, 2=Commuter Rail, 3=Bus, 4=FerryNatural Language Requests This Handles
departures place-sstat 5 (filter mentally to Red Line)alerts --route Orangedepartures place-bbsta 10vehicles Green-Dstops Kenmorealerts --stop place-dwnxgvehicles Blue (shows occupancy when available)Common Stop IDs (Quick Reference)
| Station | Stop ID |
|---------|---------|
| South Station | place-sstat |
| North Station | place-north |
| Back Bay | place-bbsta |
| Downtown Crossing | place-dwnxg |
| Park Street | place-pktrm |
| Harvard | place-harsq |
| Kendall/MIT | place-knncl |
| Alewife | place-alfcl |
| Airport | place-aport |
| Kenmore | place-kencl |
| Copley | place-coecl |
| Boylston | place-boyls |
Common Route IDs
| Route | ID |
|-------|-----|
| Red Line | Red |
| Orange Line | Orange |
| Blue Line | Blue |
| Green-B/C/D/E | Green-B, Green-C, Green-D, Green-E |
| Silver Line 1 | 741 |
| Silver Line 2 | 742 |
Tips for the AI Agent
1. Always use stop IDs over names when you have them β more reliable
2. Search for stop IDs first if you only have a station name: stops "Name"
3. Parent station IDs (e.g., place-sstat) cover all platforms β use these for departures
4. Predictions may be empty at night or when service isn't running
5. Alerts with no filter returns ALL system alerts β often noisy; filter by route or stop when possible
6. Vehicle tracking isn't available for all routes (some buses don't report positions)
7. For commuter rail departures, stop IDs are usually the station name like Back Bay
References
See references/API.md for full MBTA V3 API documentation, including all filter parameters, response formats, and complete lists of stop/route IDs.