MBTA Worcester Line MCP Server
Provides real-time train schedule information and live predictions for all 18 stations on the MBTA Worcester Line. It enables users to query upcoming departures and filter by direction or date through natural language.
README
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
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
- Push to GitHub
- Import to Vercel
- Add environment variables:
MBTA_API_KEY: Your MBTA API keyMCP_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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.