PlugWiki
12306-mcp logo

12306 Train Tickets MCP Server by Joooook: Setup for Claude, Cursor and More

CommunityLocal
Getnpm12306-mcpjoooook/12306-mcp

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.

Install 12306 MCP

Claude Code

  1. 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. 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-tickets

  • Finds 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-tickets

  • Lists 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-stations

  • Lists 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-city

  • Used 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-date

  • Finds 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-citys

  • Finds 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-names

  • Shows 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-onlyNot needed: every tool only reads.
Talks tokyfw.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

GitHubChangelogIssues

Sources

Docs, issue trackers and discussions this page is built from. Issues, quotes and findings above link to their own source.

Show all 2
  1. 12306-mcp README · github.com
  2. 12306-mcp source (tool registrations) · github.com

Facts from the official MCP registry, GitHub, npm, PyPI and the Docker catalog. Updated Nov 2, 2026.