Data as of
12306 MCP for VS Code: Setup & Config
12306 MCP lets VS Code search Chinese railway ticket availability and train routes.
What you can do with 12306 in VS Code
A focused 12306 search interface with station resolution, transfer queries, and stop-by-stop details.
- Find direct train-ticket availability for a travel request.
- Resolve Chinese city and station names into station codes.
Before you start: 12306 in VS Code
- Node.js and npx
- An MCP-compatible client
Uses the README's CLI-stdio example. HTTP operation is documented with a --port argument, and Docker build/run examples cover both modes. No required environment variables or minimum Node.js version are stated.
12306 VS Code configuration
Choose VS Code configuration scope
For 12306 MCP, open Workspace: .vscode/mcp.json. Merge into servers; preserve existing inputs.
Add 12306 MCP to VS Code
Use the 12306-mcp entry below in servers. Keep 12306 MCP's documented stdio connection fields and your other VS Code entries.
Check 12306 MCP in VS Code
12306 MCP: Start in VS Code’s MCP controls; inspect output and trust prompts.
Config file · Workspace: .vscode/mcp.json
{
"servers": {
"12306-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"12306-mcp"
],
"env": {}
}
}
}12306 tools available to VS Code
12306's stored tool list documents 8 tools; compare it with VS Code's connected tool list, because the stored list is not a live check.
- get-current-date
Look for get-current-date among VS Code's agent-mode tools after starting 12306 through the MCP controls.
Return the current Shanghai-time date for resolving relative travel dates.
- get-stations-code-in-city
Look for get-stations-code-in-city among VS Code's agent-mode tools after starting 12306 through the MCP controls.
List all train stations and their codes for a Chinese city name.
- get-station-code-of-citys
Look for get-station-code-of-citys among VS Code's agent-mode tools after starting 12306 through the MCP controls.
- get-station-code-by-names
Look for get-station-code-by-names among VS Code's agent-mode tools after starting 12306 through the MCP controls.
- get-station-by-telecode
Look for get-station-by-telecode among VS Code's agent-mode tools after starting 12306 through the MCP controls.
Retrieve station details such as name, pinyin, and city from a telecode.
- get-tickets
Look for get-tickets among VS Code's agent-mode tools after starting 12306 through the MCP controls.
Query remaining ticket availability through 12306.
- get-interline-tickets
Look for get-interline-tickets among VS Code's agent-mode tools after starting 12306 through the MCP controls.
- get-train-route-stations
Look for get-train-route-stations among VS Code's agent-mode tools after starting 12306 through the MCP controls.
Troubleshooting 12306 in VS Code
- Make npx 12306-mcp (Node.js/npm) available in the workspace, container, or remote environment hosting 12306 MCP. Start through VS Code's MCP controls; inspect output and trust prompts.
- 12306 MCP uses stdio here: VS Code must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
- Known limitation: The transfer query is limited to the first ten results.
- Known limitation: Booking and payment operations are not documented.
- Known limitation: The README frames the project as a learning tool.
- General VS Code troubleshooting lives in the /clients/vscode guide.
12306 MCP — details. VS Code guide