caltrain
A Model Context Protocol (MCP) server for Caltrain schedules. Get real-time train departures using GTFS data, designed for Claude Desktop and other MCP clients.
claude mcp add --transport stdio davidyen1124-caltrain-mcp uvx caltrain-mcp
How to use
This MCP server provides access to Caltrain GTFS-based schedules via the MCP protocol. It exposes utilities to query the next trains between two stations and to list all Caltrain stations, using GTFS data that is downloaded and parsed by the server. Clients like Claude Desktop or any MCP-compatible client can start the server and communicate through standard MCP input/output channels to request trip times or station lists. The server is designed to be run as an MCP service rather than directly by humans, and it fetches GTFS data to feed the query functions.
To use it with Claude Desktop, configure the MCP section to run the server with uvx caltrain-mcp, which will install and run the latest version from PyPI. Once the Claude Desktop instance is restarted, Caltrain schedules become available within conversations. For other MCP clients, you can start the server with uvx caltrain-mcp and connect via the MCP protocol over stdin/stdout. The available tools include next_trains(origin, destination, when_iso=None) for future departures and list_stations() to retrieve the 31 Caltrain station names.
How to install
Prerequisites: Python environment and uv (uvx) installed.
-
Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh
-
Install and run the Caltrain MCP server via uvx (will fetch from PyPI):
uvx caltrain-mcp
-
If you want to use it with Claude Desktop, ensure your Claude configuration includes:
{ "mcpServers": { "caltrain": { "command": "uvx", "args": ["caltrain-mcp"] } } }
-
Obtain GTFS data (handled by the server tooling). If you need to fetch manually for development:
uv run python scripts/fetch_gtfs.py
Prerequisites in brief:
- Python environment
- uv (via uvx) installed
- GTFS data downloaded to src/caltrain_mcp/data/caltrain-ca-us/
- Optional: Claude Desktop or any MCP-compatible client for testing
Additional notes
Notes and tips:
- The server relies on GTFS data (stops.txt, trips.txt, stop_times.txt, calendar.txt). Ensure the data directory src/caltrain_mcp/data/caltrain-ca-us/ is populated before queries.
- When running tests, you can exercise next_trains and list_stations programmatically; expect placeholder results where real-time data would vary.
- Station name matching supports full names, short names, abbreviations (e.g., sf for San Francisco), and partial matching (e.g., diridon).
- If you encounter issues with GTFS fetch, verify network access and that fetch_gtfs.py completes successfully.
- This server is designed to be used by MCP clients rather than manual interactive use; interactions occur over the MCP protocol via stdin/stdout.
Related MCP Servers
mcp -tree-sitter
MCP Server for Tree-sitter
Gitingest
mcp server for gitingest
mcp_server_filesystem
MCP File System Server: A secure Model Context Protocol server that provides file operations for AI assistants. Enables Claude and other assistants to safely read, write, and list files in a designated project directory with robust path validation and security controls.
cfbd
An MCP server enabling CFBD API queries within Claude Desktop.
mcp-coroot
MCP server for Coroot observability platform - integrate monitoring, troubleshooting, and configuration tools with AI agents
JMX
A powerful Model Context Protocol (MCP) server that enables AI assistants like Claude Desktop to monitor and manage Java applications through JMX. Provides real-time MBean discovery, attribute management, and natural language JMX operations.