---
title: "12306 MCP Server: China Railway Train Ticket Search"
url: "https://mcpshelf.co/servers/12306"
description: "Search China Railway 12306 for trains, seats, stops and transfers from an AI assistant. No account or key needed. Setup and what it can and cannot do."
updated: "2026-10-27"
site: "MCP Shelf"
---

# 12306 MCP

> Searches China Railway 12306 for trains, seats, stops and transfers.

## At a glance

12306 is the official booking site for China Railway. This server by Joooook lets an assistant look up trains between two stations on a date, filter them by train type or departure time, see which seats are left, list every stop a train makes, and find journeys with a change of train. It reads the same public data the 12306 website shows, so no account or key is needed.

It only searches. It cannot book or pay for tickets, so you still buy them on 12306 or its app. The author describes it as a learning project, and the tool descriptions and station names are in Chinese.

|  |  |
| --- | --- |
| Made by | Joooook (community project) |
| GitHub | https://github.com/Joooook/12306-mcp |
| Licence | MIT |
| npm package | [12306-mcp](https://www.npmjs.com/package/12306-mcp) 0.3.10 (30 Jul 2026) |
| GitHub stars | 2.4K |
| Downloads | 4.3K a week |
| Last commit | 31 Jul 2026 |
| Tools | 8 |
| Runs on | Your computer |
| Install check | Started in our test |
| Category | [Knowledge and work apps](https://mcpshelf.co/categories/knowledge-and-work) |

**Our check:** We ran this exact config on 22 Oct 2026: it started and answered with 8 tools.

## Tools

We listed 8 tools on 27 Oct 2026. Every one of them only reads.

| Tool | Kind | What it is for |
| --- | --- | --- |
| `get-current-date` | reads | Returns today's date in China time, so the model can work out dates such as tomorrow or next Wednesday. |
| `get-stations-code-in-city` | reads | Lists every station in a city, by its Chinese name, with their station codes. |
| `get-station-code-of-citys` | reads | Returns the main station code for one or more cities. |
| `get-station-code-by-names` | reads | Looks up station codes from exact Chinese station names, such as 北京南. |
| `get-station-by-telecode` | reads | Returns the details of a station from its three-letter code. |
| `get-tickets` | reads | Searches trains between two stations on a date, with seats left, filters by train type and departure time, and sorting. |
| `get-interline-tickets` | reads | Finds journeys with one change of train, returning the first ten. |
| `get-train-route-stations` | reads | Lists every stop on a train's route with arrival, departure and stop times. |

## Set it up

### Claude Desktop

Where: claude_desktop_config.json (Settings → Developer → Edit Config)

```json
{
  "mcpServers": {
    "12306": {
      "command": "npx",
      "args": [
        "-y",
        "12306-mcp"
      ]
    }
  }
}
```

### Claude Code

Where: Your terminal, in the project folder

```bash
claude mcp add-json 12306 '{"command":"npx","args":["-y","12306-mcp"]}'
```

### Cursor

Where: ~/.cursor/mcp.json, or .cursor/mcp.json in a project

```json
{
  "mcpServers": {
    "12306": {
      "command": "npx",
      "args": [
        "-y",
        "12306-mcp"
      ]
    }
  }
}
```

### VS Code

Where: .vscode/mcp.json in your project

```json
{
  "servers": {
    "12306": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "12306-mcp"
      ]
    }
  }
}
```

### Windsurf

Where: ~/.codeium/windsurf/mcp_config.json

```json
{
  "mcpServers": {
    "12306": {
      "command": "npx",
      "args": [
        "-y",
        "12306-mcp"
      ]
    }
  }
}
```

### ChatGPT

Where: Not supported

ChatGPT only connects to remote servers by URL. This one runs on your computer, so use Claude, Cursor or VS Code.

Add "--port", "8080" to the args to serve it over HTTP instead of stdio.

## Settings

| Setting | Kind | Required | What it does |
| --- | --- | --- | --- |
| `--port` | flag | no | Serves it over HTTP (streamable HTTP and SSE) on this port instead of stdio. Example: `--port 8080` |
| `--host` | flag | no | The address to listen on in HTTP mode. Defaults to localhost. Example: `--host 0.0.0.0` |

## What it can touch

**It can read**

- Public timetable and seat availability data from 12306.cn

**It can change**

**Safer setup:** It only reads public data. It cannot log in, book or pay.

## Before you start

- Node.js 18 or newer

## Good for

- Planning rail trips in China in plain language
- Comparing high-speed trains by time and seats left
- Finding routes that need a change of train

## If it does not work

**It quits as soon as it starts**
It downloads the station list from 12306.cn on start. Check that the machine can reach 12306.cn, which can be slow or blocked from some networks.

**A station is not found**
Use the Chinese station name, such as 上海虹桥, or look up the code with get-station-code-by-names first.

**Dates come out wrong**
Ask the model to call get-current-date first; it works in China time.

## Similar servers

| Server | Tools | Runs on | Stars |
| --- | --- | --- | --- |
| [Google Search Console MCP](https://mcpshelf.co/servers/search-console) | 21 | Your computer | 2K |
| [Telegram MCP](https://mcpshelf.co/servers/telegram) | 147 | Your computer | 1.9K |
| [Slack MCP Server](https://mcpshelf.co/servers/slack) | 22 | Your computer | 1.9K |
| [iMCP](https://mcpshelf.co/servers/imcp) | 56 | Your computer | 1.8K |

## Questions

### Can it buy tickets?

No. It only searches, so book on 12306 or its app.

### Does it need a 12306 account?

No. It reads the same public data the website shows before you sign in.

### Does it work in English?

You can ask in English, but tool descriptions and station names are in Chinese, so models that read Chinese do best.

### Is it affiliated with China Railway?

No. It is a personal learning project by its author.

Full docs on GitHub: https://github.com/Joooook/12306-mcp

---

From [MCP Shelf](https://mcpshelf.co/): A short shelf of MCP servers that are worth installing. Index for agents: https://mcpshelf.co/llms.txt

