Skip to main content
MCP server CX Codex

mcp-server-12306 — Claude Code MCP server: 12306 railway queries

Brings seven tools to query Chinese railway schedules, ticket prices, transfers and stations via the 12306 public API.

MIT ★ 426 updated 2026-09-30

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add mcp-server-12306 -- uvx mcp-server-12306
Open on GitHub

What mcp-server-12306 does

The server exposes ticket availability search with train-number filtering, real-time pricing for all seat classes (business through standing), station lookup by name or code (including pinyin and abbreviations), transfer routing, per-train stop schedules, train-number-to-ID resolution, and timezone-aware current time. It runs in stdio mode (local standard I/O) or HTTP mode (web server on port 8000 for remote access). Requires Python 3.10 or later; install via uvx, pip, or the Docker image drfccv/mcp-server-12306.

Station data loads from station_name.js bundled in the package. HTTP mode adds endpoints: /health reports loaded stations and active sessions, /schema/tools serves tool JSON schemas, / lists version and endpoints. Configure via environment variables (SERVER_HOST, SERVER_PORT, LOG_LEVEL) or a .env file.

What it helps with

  • query remaining seats on a train between two Chinese cities
  • fetch ticket prices for all service classes
  • look up a station by Chinese name or three-letter code
  • calculate transfer routes using the official 12306 API
  • retrieve the full stop schedule of a specific train

Example prompts for the agent

  • Show available tickets from Beijing to Shanghai tomorrow
  • What does business class cost on train G123 from Guangzhou to Shenzhen on May 15?
  • Find the station with code BJP

How to install mcp-server-12306

Platform CLI

claude mcp add mcp-server-12306 -- uvx mcp-server-12306

uvx runs the command named after the package; if the README names another one, use uvx --from mcp-server-12306 <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about mcp-server-12306

How do I install mcp-server-12306 in Claude Code?

Run claude mcp add mcp-server-12306 -- uvx mcp-server-12306. The server will connect via stdio and appear in Claude Code's interface.

What does mcp-server-12306 do?

It adds seven tools to query the 12306 API: ticket search, pricing, station lookup, transfer planning, train schedules, train-number resolution, and current time. Data comes from the official Chinese railway booking system endpoints.

Does mcp-server-12306 require an API key?

No. The server calls public 12306 endpoints without authentication. You only need network access to those endpoints and Python 3.10 or later.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open