Skip to main content
Glama
MBTA Worcester Line MCP Server

MBTA Worcester Line MCP Server

by ericskiff

MBTA Worcester Line MCP Server

An MCP (Model Context Protocol) server that provides real-time train schedule information for the MBTA Worcester Line. Built with Next.js and deployable on Vercel.

Features

  • Real-time train departures from any Worcester Line station

  • Merges scheduled times with live predictions

  • Supports all 18 Worcester Line stops

  • Works with Gemini CLI and other MCP clients

Related MCP server: MBTA MCP Server

Quick Start

1. Get an MBTA API Key

Get a free API key at: https://api-v3.mbta.com

2. Install Dependencies

npm install

3. Configure Environment

Copy .env.example to .env.local and add your MBTA API key:

MBTA_API_KEY=your-mbta-api-key-here
MCP_API_KEY=your-secret-token  # Optional: for authentication

4. Run Locally

npm run dev

5. Test the MCP Server

npm run test:mcp

Deployment

Deploy to Vercel

  1. Push to GitHub

  2. Import to Vercel

  3. Add environment variables:

    • MBTA_API_KEY: Your MBTA API key

    • MCP_API_KEY: Secret token for authentication (optional)

Client Configuration

Gemini CLI

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "mbta": {
      "httpUrl": "https://your-app.vercel.app/api",
      "headers": {
        "Authorization": "Bearer YOUR_MCP_API_KEY"
      },
      "timeout": 30000
    }
  }
}

Or via CLI:

gemini mcp add --transport http mbta https://your-app.vercel.app/api

Claude Desktop (via mcp-remote)

{
  "mcpServers": {
    "mbta": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://your-app.vercel.app/api/mcp"]
    }
  }
}

Available Tools

get_worcester_departures

Get upcoming train departures from any Worcester Line station.

Parameters:

Name

Type

Required

Description

stop

string

Yes

Stop name or ID (e.g., "South Station", "framingham")

direction

string

No

"outbound" (toward Worcester) or "inbound" (toward Boston). Default: "outbound"

date

string

No

Date in YYYY-MM-DD format. Default: today

limit

number

No

Number of departures (1-20). Default: 5

Example queries:

  • "What trains leave South Station for Worcester?"

  • "Get next trains from Framingham to Boston"

  • "What trains leave Westborough tomorrow morning?"

Worcester Line Stops

South Station, Back Bay, Lansdowne, Boston Landing, Newtonville, West Newton, Auburndale, Wellesley Farms, Wellesley Hills, Wellesley Square, Natick Center, West Natick, Framingham, Ashland, Southborough, Westborough, Grafton, Worcester

Project Structure

src/
├── app/
│   ├── api/[transport]/route.ts  # MCP handler
│   └── page.tsx                   # Status page
├── lib/
│   ├── mbta/
│   │   ├── client.ts             # MBTA API client
│   │   ├── types.ts              # TypeScript types
│   │   └── stops.ts              # Stop ID mappings
│   └── mcp/
│       ├── auth.ts               # Authentication
│       └── tools/                # MCP tools
│           ├── get-departures.ts
│           └── index.ts

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    • Omio MCP server for ChatGPT, Claude and any AI agent: search trips, find the cheapest day and start booking in your own Omio account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Omio yourself; Cotlet does not store your password and you need no Omio API key. About the official Omio API: Omio has no public API for your own account (checked 24 Oct 2026). Its affiliate programme lists a Search API for partners, and its app in ChatGPT searches trips; Your Bookings, saved travelers and checkout work only on omio.com and in the Omio app. Setup and FAQ: https://cotlet.dev/integrations/omio-api-mcp-server

      https://cotlet.dev/mcp/v1/omio
    • tri-train is a training platform for triathletes that syncs activities from Strava and Garmin and exposes them to Claude through a remote MCP server. Ask Claude how your last block went, why your run pace dropped, or whether you are fresh enough for Sunday's race, and it answers from your real data: activities with laps and grade-adjusted pace, weekly load and the performance management chart (CTL/ATL/TSB), sleep, HRV and resting heart rate, and your race calendar with predictions. Claude can also act: create and adjust planned workouts with structured intervals, push them to your Garmin watch, add races and write notes. Every change is journaled and can be undone. Read and write access are separate OAuth scopes, and the server enforces them on every call. Built and hosted in Switzerland by a triathlete; data stays on our own servers (Swiss revDSG / GDPR).

      https://tri-train.com/api/mcp
    • A real clock for AI agents: current time, timezone conversion, and DST facts from the IANA tzdb.

      https://worldclock.pro/mcp
    • BusCalc 1.8.0 exposes 33 public tool families: 26 calculations and seven attributed data lookups. Calculate business pricing, finance, uncertainty, lease economics and emergency dispatch margins. Look up metals, energy, exchange rates, weather, BLS, USDA, Census and selected emergency sources, including NOAA gauges and USGS flood-impact points. Calculations include unsigned replayable receipts. Lookup results include source and observation dates where available. Road and outage coverage varies by location. The public Streamable HTTP endpoint is https://buscalc.com/api/mcp. Direct access is anonymous and rate limited. Full guide: https://buscalc.com/for-ai/

      https://buscalc.com/api/mcp

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables users to interact with Washington DC Metro (WMATA) transit system through natural language queries. Provides real-time train arrivals, service alerts, station information, trip planning, and accessibility updates.
      2,969 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables real-time Indian Railways information retrieval, including live train running status, station schedules, and upcoming arrivals/departures.
      ISC
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides real-time San Francisco Bay Area Rapid Transit data, enabling queries about BART schedules, routes, and station information through natural language.
      129 npm
      MIT