Skip to content
Skillpedia
● Free and open sourceπŸ’» LocalπŸ”“ No API keyOther

12306 Train Ticket MCP Server

Lets your AI agent check China 12306 train tickets: seats, prices, stations, stops and transfers.

420 stars on GitHubby drfccvLicense MITUpdated 19 days ago

How to install

This MCP is local: it runs on your computer.

It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Code…). Choose your app:

Paste in the terminal:

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

Ready! Now test it

Restart the app and paste one of these requests in the chat:

Which trains from Beijing to Shanghai tomorrow still have second-class seats?
What is the price for each seat type on train G1 from Beijing South to Shanghai Hongqiao?

What it is

This server connects your agent to the official 12306 public interfaces for Chinese railways. It can look up available tickets, ticket prices, station names, the stops of a train and transfer plans. It also gives the current date and relative dates to help pick a travel day.

What it can do

  • query-tickets: remaining tickets, trains, seats and times
  • query-ticket-price: real-time prices for each train and seat class
  • search-stations: fuzzy station search by Chinese name, pinyin or code
  • query-transfer: transfer plans between stations
  • get-train-route-stations: all stops and times for a train
  • get-train-no-by-train-code: train code to official unique number
  • get-current-time: current time and relative dates

When to use

  • β€ΊWhen you plan a train trip in China and want to compare trains and seats
  • β€ΊWhen you need a transfer plan between two stations with waiting times
  • β€ΊWhen you want to check the stops and times of a specific train

What you need

Python 3.10 to 3.13 and uv, pip or pipx, or Docker. It needs network access to the official 12306 interfaces. No API key is mentioned.

Skills that pair well

⭐ Skillpedia MCP Β· freeYour agent finds the right skill on its ownInstall our MCP and your agent searches 15,000+ skills whenever it needs one.Install for free β†’

Frequently asked questions

Is it free and open source?

Yes. It uses the MIT license. The README says it is for study, research and technical exchange, not for commercial use.

Does it need an API key?

No key is mentioned. It reads the official public 12306 interfaces.

Can it book tickets?

The README lists only query tools: tickets, prices, stations, transfers, stops and time. It does not list booking.

How is it run?

With uvx mcp-server-12306 in stdio mode, as a Streamable HTTP server with mcp-12306 on port 8000, or with Docker.

How many stations does it know?

The README says more than 3,382 stations nationwide.

Who is responsible for how it is used?

The README says users bear any consequences, such as account bans, and must follow Chinese law and 12306 rules.

If it does not work

  • β€ΊCheck your Python version is between 3.10 and 3.13.
  • β€ΊIf the HTTP port is busy, set SERVER_PORT or map another port in docker run.
  • β€ΊMake sure your machine can reach the official 12306 interfaces.

5 new skills a week. 1 minute to read.