Get the FREE Ultimate OpenClaw Setup Guide →

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.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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.

  1. Install uv (if not already installed):

    curl -LsSf https://astral.sh/uv/install.sh | sh

  2. Install and run the Caltrain MCP server via uvx (will fetch from PyPI):

    uvx caltrain-mcp

  3. If you want to use it with Claude Desktop, ensure your Claude configuration includes:

    { "mcpServers": { "caltrain": { "command": "uvx", "args": ["caltrain-mcp"] } } }

  4. 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

Sponsor this space

Reach thousands of developers