# mcp-server-12306

Enables AI agents to query China Railway 12306 services. Checks real-time train availability, seat prices, schedules, and transfer routes.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 167 installs · ★ 9 repo stars
- Author: reason-machines
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/reason-machines/mcp-skills/tree/HEAD/skills/mcp-server-12306/SKILL.md
- Updated: 2026-10-09
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/mcp-server-12306

## What it does

This skill equips coding assistants with tools to interface with the China Railway 12306 booking system through Model Context Protocol. It guides models on formulating requests for train classes like G, D, K, T, and Z, checking remaining seat inventory, and translating station queries supplied in pinyin or Chinese characters.

The server implementation uses FastAPI to handle async queries. Tool definitions cover searching direct connections, planning trips with a single interchange, retrieving stop sequences with layover durations, and computing booking windows under the `Asia/Shanghai` timezone.

A functioning transport layer is necessary: either configure the stdio command with `uvx` in your client configuration or keep the HTTP daemon alive on `http://localhost:8000/mcp`. Without that running backend, the assistant cannot retrieve live schedule data.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/mcp-skills --skill mcp-server-12306 -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/mcp-server-12306/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/mcp-server-12306/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/mcp-skills --skill mcp-server-12306 -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/mcp-server-12306/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/mcp-skills --skill mcp-server-12306 -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/mcp-server-12306/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install reason-machines/mcp-skills skills/mcp-server-12306
```

2. **Manually: put the files in place**
- File: `.github/skills/mcp-server-12306/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/mcp-skills --skill mcp-server-12306 -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/reason-machines/mcp-skills --path skills/mcp-server-12306
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/mcp-server-12306/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add reason-machines/mcp-skills --skill mcp-server-12306 -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/reason-machines/mcp-skills/tree/HEAD/skills/mcp-server-12306/SKILL.md

## When to use it
- search live train seat availability across Chinese rail stations
- calculate ticket prices in CNY for specific carriage classes
- find one-transfer train combinations between distant cities
- resolve railway station telecodes using pinyin keywords
- inspect complete stop lists and arrival timings for scheduled trains

## Example prompts
- Check available seats on trains from Beijing to Shanghai for 2025-06-15
- Search transfer connections between Beijing and Guilin for adult tickets on 2025-06-20
- Get all scheduled stop stations and timings for train G101

## Similar
- [cloudbase-agent](https://affpapa.org/en/nevibecode/skills/cloudbase-agent.md) — skill · 268 installs
- [fastapi-templates](https://affpapa.org/en/nevibecode/skills/fastapi-templates.md) — skill · 25840 installs
- [fastapi-python](https://affpapa.org/en/nevibecode/skills/fastapi-python.md) — skill · 14100 installs
- [fastapi-patterns](https://affpapa.org/en/nevibecode/skills/fastapi-patterns.md) — skill · 6700 installs
- [fastapi-expert](https://affpapa.org/en/nevibecode/skills/fastapi-expert.md) — skill · 6600 installs
- [sentry-python-sdk](https://affpapa.org/en/nevibecode/skills/sentry-python-sdk.md) — skill · 2700 installs

From the same set: [reason-machines/mcp-skills](https://affpapa.org/en/nevibecode/by/reason-machines/mcp-skills.md) — 98 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
