12306-mcp
MCP server that searches China Railway 12306 tickets: schedules, train filters, transfers and intermediate stops
Medium risk
We rate an entry medium when the tool runs code, makes network calls or reads project files. Check what exactly it does before installing.
Why this level
- Runs local code and makes network calls to the 12306 service
Install
In your terminal, with SkillFoxx CLI
npx skillfoxx add mcp/12306-mcpDetects the agents on your machine, checks the risk and pins the version.
Other ways to install
Run in a terminal
claude mcp add --transport stdio 12306-mcp -- npx -y 12306-mcpOr add to the file .mcp.json, in the project
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
The button opens the agent and offers to add the server. If nothing happens, copy the config below.
Add to the file ~/.cursor/mcp.json, for all projects
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcpServers key. For a single project, put the same block into .cursor/mcp.json.
The button opens the agent and offers to add the server. If nothing happens, copy the config below.
Run in a terminal
code --add-mcp '{"name":"12306-mcp","type":"stdio","command":"npx","args":["-y","12306-mcp"]}'Or add to the file .vscode/mcp.json, in the project
{
"servers": {
"12306-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the servers key.
Run in a terminal
codex mcp add 12306-mcp -- npx -y 12306-mcpOr add to the file ~/.codex/config.toml, for all projects
[mcp_servers.12306-mcp]
command = "npx"
args = ["-y", "12306-mcp"]If the file already exists, append the block to the end.
Add to the file ~/.gemini/settings.json, for all projects
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
Add to the file ~/.config/devin/mcp_config.json, for all projects
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcpServers key. Legacy Cascade keeps the MCP config in ~/.codeium/windsurf/mcp_config.json.
Formerly Windsurf.
Add to the file cline_mcp_settings.json, for all projects
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcpServers key. Open the settings file in Cline: MCP Servers tab, Configure MCP Servers.
Add to the file .roo/mcp.json, in the project
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
A fork of Roo Code, same .roo folders.
Add to the file opencode.json, in the project
{
"mcp": {
"12306-mcp": {
"type": "local",
"command": [
"npx",
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcp key.
Add to the file ~/.config/zed/settings.json, for all projects
{
"context_servers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the context_servers key.
Add to the file .codeassistant/mcp.json, in the project
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
Add an MCP server named 12306-mcp with command npx and args -y 12306-mcp, then restart the client. For http mode add the --port argument with a port number.
Other ways from the author
npx -y 12306-mcpRuns in stdio mode.
This is third-party code. Review the repository files before installing.
What it does
The server exposes MCP tools that query the 12306 service and return structured train and ticket data. An agent can search trips between stations, filter trains by the attributes it needs, inspect a route with its intermediate stops and find options that require a transfer. Because results come back structured, the agent can compare and explain them further. It runs locally over stdio or as an http service, with no keys or account required.
Who it is for. For developers and agent users who need China Railway schedules and tickets straight from a chat.
Good fit when
- You need to find trains and tickets between two stations in China
- You need to check a route with intermediate stops or a transfer option
- You need structured trip data for the agent to compare further
Not a fit when
- You need to buy or book a ticket rather than just search
- You need railways of countries other than China
Example request
Find morning trains from Beijing to Shanghai for tomorrow and show the travel timeLimitations
The server works only with the 12306 service and only for search; it does not buy or book. The author notes the project is for learning. It needs Node.js 18 or newer, and debugging via MCP Inspector 2.0.0 needs Node.js 22.19.0 or newer. Data availability depends on 12306 itself.
How to disable. Remove the 12306-mcp entry from your client's MCP configuration and restart it.
MCP
- Transport
- stdio, http
- Authentication
- not required
Security check
- Runs local code and makes network calls to the 12306 service
README in short
The README presents a 12306 ticket search server built on the Model Context Protocol. Listed features include ticket lookup, train filtering, intermediate stop queries and transfer queries. It shows how to run it: npx for stdio and http with a port, a Docker build and run, and an mcpServers config snippet. There is separate documentation on how it works and its architecture, and the author states the project is for learning. MIT licensed.
FAQ
Can I buy a ticket through the server?
No, the server only searches and shows train and ticket data; buying and booking are not supported.
Do I need a 12306 account or a key?
No, search does not require keys or an account login.
Related
A self-hosted knowledge base with block-level references and a built-in MCP server for connecting AI agents to your notes
A CLI for every Google Workspace API with JSON output and agent skills: Drive, Gmail, Calendar, Sheets and more
Local search over Markdown notes, docs and meeting transcripts: keywords, semantic search and reranking, with an MCP server
A task manager for AI-driven development: breaks a PRD into dependent tasks and guides the agent through them via MCP or CLI