
12306 Train Tickets MCP Server by Joooook: Setup for Claude, Cursor and More
Lets Claude or Cursor search China 12306 train tickets, transfers, stations and stops.
This is a community server by Joooook, not made by China Railway. It runs on your computer and looks up live seat data on the public 12306 site. You do not need an account or an API key.
It reads only. It cannot book or pay for tickets. Station names must be in Chinese, and transfer search returns only the first ten results.
Good for
- Travelers planning trips by train in China
- Developers building a travel assistant on 12306 data
Works in
12 should work
Tap an app to see how to set it up and any known problems.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Client does not support this transport.
Client does not support this transport.
Install 12306 MCP
Claude Code
- 1
Copy this prompt.
Add the 12306 MCP server to Claude Code. Run this command: claude mcp add 12306 -- npx -y 12306-mcp Then check that it loaded and tell me if I need to sign in or restart.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
Built from the package data we hold. Not yet tested by us.
Tools
Finds train tickets and seats left for a date
Looks up seats left between two stations on a given date from the 12306 site. You can narrow the results by train type and departure time.
Try: “Find high-speed trains from Beijing to Shanghai tomorrow morning with seats left.”
Network ·
get-ticketsFinds trips that need a change of train
Searches for journeys with one transfer when no direct train fits. It returns only the first ten results.
Try: “Find a trip with one change from Lhasa to Hangzhou next Friday.”
Network ·
get-interline-ticketsLists every stop of a train and the times
Shows the stops of one train between two stations, with arrival, departure and wait time at each. Use it to check where a train like G1033 calls.
Try: “Which stations does train G1033 stop at on 2026-12-01?”
Network ·
get-train-route-stationsLists all train stations in a city
Returns every station in a Chinese city with its station code. Handy for cities with several stations, such as Beijing.
Try: “List all the train stations in Shanghai.”
Read ·
get-stations-code-in-cityUsed by the assistant behind the scenes
Gives today's date in China time
Returns today's date in Shanghai time. The assistant calls it first so words like "tomorrow" turn into a real travel date.
Try: “What is the date today in China?”
Read ·
get-current-dateFinds the main station code for cities
Gives the station code that stands for each city you name. You can pass several cities separated by a bar.
Try: “What are the station codes for Beijing and Shanghai?”
Read ·
get-station-code-of-citysFinds station codes from station names
Looks up the code for exact station names such as Beijing South. Several names can be given at once.
Try: “Get the code for Shanghai Hongqiao station.”
Read ·
get-station-code-by-namesShows station details from its code
Returns the name, pinyin and city for a three-letter station code.
Try: “What station has the code BJP?”
Read ·
get-station-by-telecode
Read from the source code
Permissions
low risk · 2 things to watch
Low risk
All eight tools only look things up, so the worst case is that your route and date are sent to the 12306 website. Keep the default stdio setup and do not expose the optional HTTP port.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
HTTP mode is not password protected
With the --port option it listens for HTTP on localhost unless you set --host. Keep it on localhost and do not set --host 0.0.0.0. github.com
Your searches go to the 12306 website
Each ticket search sends your route and date to 12306 servers, the same as using the site. Nothing else leaves your machine. github.com
Security advisories
No published security advisories as of Nov 1, 2026.
Technical details
| Turning on read-only | Not needed: every tool only reads. |
|---|---|
| Talks to | kyfw.12306.cn. search.12306.cn. www.12306.cn |
Questions
Is the 12306 MCP server official?
No. It is a community project by Joooook (MIT license) and is not made by China Railway or 12306.
Can it book tickets?
No. It only searches tickets, transfers, stations and train stops. You still book on the 12306 site or app.
Do I need an account or API key?
No. It needs no sign-in or key. It needs Node.js for npx; the package declares no minimum version. On each search it fetches an anonymous session cookie from 12306, so it works without an account.
Which apps does it work in?
Any app that runs local MCP servers, such as Claude Desktop, Claude Code and Cursor. Use the install box above for each one.
Can I search in English?
Partly. Station and city names must be given in Chinese, such as 北京. Your assistant can translate them for you.
Does it run on my computer or in the cloud?
On your computer. Searches go from your machine to the 12306 website.
Information
updated Nov 2, 2026
- Publisher
- Community
- Package
12306-mcp- Registry
- npm
- Transport
- stdio, Streamable HTTP
- Auth
- None
- License
- MIT
- Last commit
- Jul 31, 2026
- Open issues
- 8
Sources
Docs, issue trackers and discussions this page is built from. Issues, quotes and findings above link to their own source.
Show all 2Hide
- 12306-mcp README · github.com
- 12306-mcp source (tool registrations) · github.com