12306 MCP Server
A high-performance FastAPI backend for train ticket queries in China, supporting real-time ticket availability, station information, transfers, and train schedules through the Model Context Protocol for AI assistants and automation.
What is 12306 MCP Server?
12306 MCP Server is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to high-performance fastapi backend for train ticket queries in china, supporting real-time ticket availability, station information, transfers, and train schedules through the model context protocol for...
A high-performance FastAPI backend for train ticket queries in China, supporting real-time ticket availability, station information, transfers, and train schedules through the Model Context Protocol for AI assistants and automation.
This server falls under the Search & Data Extraction category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A high-performance FastAPI backend for train ticket queries
Use Cases
Maintainer
Works with
Installation
NPM
npx -y mcp-server-12306PIP
pip install mcp-server-12306Manual Installation
npx -y mcp-server-12306Configuration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use 12306 MCP Server
The 12306 MCP Server exposes China's national rail ticketing system to AI assistants through seven structured tools covering real-time ticket availability queries, fare lookup, fuzzy station search in Chinese and pinyin, transfer routing, and live timetable data. Built on a high-performance FastAPI backend, it connects to the 12306.cn data infrastructure and returns structured results that an AI can reason over, making it straightforward to ask natural language questions like 'find me seats from Beijing to Shanghai this Friday' and get actionable answers. It is indispensable for travelers, travel assistants, and automation scripts that need programmatic access to Chinese high-speed rail schedules.
Prerequisites
- Python 3.10+ and pip, or uvx/pipx for zero-install execution
- An MCP-compatible client such as Claude Desktop
- Internet access to reach 12306.cn data endpoints (no personal 12306 account required for queries)
Install via pip or use uvx for zero-setup
The package is published on PyPI as mcp-server-12306. Use uvx for a self-contained, no-virtual-environment approach, or install with pip into your current environment.
pip install mcp-server-12306
# or run directly without installing:
uvx mcp-server-12306Add the server to your MCP client configuration
Edit claude_desktop_config.json to launch mcp-server-12306 via uvx (recommended) or pipx. The server requires no environment variables for basic ticket queries.
{
"mcpServers": {
"12306": {
"command": "uvx",
"args": ["mcp-server-12306"]
}
}
}Alternatively run the HTTP server mode
For multi-client access or remote use, run the server in HTTP mode with Docker. It listens on port 8000 and exposes SSE and POST MCP endpoints.
docker run -d -p 8000:8000 --name mcp-server-12306 drfccv/mcp-server-12306:latestConfigure for HTTP mode in the MCP client
If you started the Docker container, point your MCP client at the local HTTP endpoint instead of running a subprocess.
{
"mcpServers": {
"12306": {
"url": "http://localhost:8000/mcp"
}
}
}Restart the client and run a station search
Reload Claude Desktop. The 12306 server exposes: query_tickets, query_ticket_price, search_stations, get_station_info, query_transfer, get_train_route_stations, and get_current_time. Try a station search to confirm connectivity.
12306 MCP Server Examples
Client configuration
Claude Desktop config using uvx to run mcp-server-12306 without a manual install step.
{
"mcpServers": {
"12306": {
"command": "uvx",
"args": ["mcp-server-12306"]
}
}
}Prompts to try
Example prompts that use the 12306 MCP Server's ticket query and station lookup tools.
- "Find available train tickets from Beijing to Shanghai this Friday, showing seat types and prices."
- "What G-train options are there from Guangzhou South to Shenzhen North tomorrow morning?"
- "Search for the station code for '上海虹桥' (Shanghai Hongqiao)."
- "Plan a transfer route from Chengdu to Xi'an with the fewest stops."
- "List all stops on train G7 from Beijing to Tianjin with departure times."Troubleshooting 12306 MCP Server
query_tickets returns empty results for a valid route
Confirm station names are correct using search_stations first — the tool supports fuzzy matching in Chinese characters, pinyin, or abbreviations. Date format must match what 12306 expects; use get_current_time to confirm date handling.
uvx: command not found
Install uv first with: pip install uv or curl -LsSf https://astral.sh/uv/install.sh | sh. Alternatively use the pipx variant: set command to pipx and args to ["run", "--no-cache", "mcp-server-12306"].
Connection refused when using the Docker HTTP mode
Ensure Docker is running and port 8000 is not already in use. Verify the container started correctly with: docker logs mcp-server-12306. The HTTP endpoint should be http://localhost:8000/mcp.
Frequently Asked Questions about 12306 MCP Server
What is 12306 MCP Server?
12306 MCP Server is a Model Context Protocol (MCP) server that high-performance fastapi backend for train ticket queries in china, supporting real-time ticket availability, station information, transfers, and train schedules through the model context protocol for ai assistants and automation. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install 12306 MCP Server?
Install via npm with the command: npx -y mcp-server-12306. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with 12306 MCP Server?
12306 MCP Server works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is 12306 MCP Server free to use?
Yes, 12306 MCP Server is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
12306 MCP Server Alternatives — Similar Search & Data Extraction Servers
Looking for alternatives to 12306 MCP Server? Here are other popular search & data extraction servers you can use with Claude, Cursor, and VS Code.
TrendRadar
★ 58.0kA real-time hotspot monitoring and news aggregation assistant that provides AI-powered analysis of trending topics across multiple platforms via the Model Context Protocol. It enables users to track news and receive automated notifications through va
Scrapling
★ 52.7k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
PDF Math Translate
★ 33.9k[EMNLP 2025 Demo] PDF scientific paper translation with preserved formats - 基于 AI 完整保留排版的 PDF 文档全文双语翻译,支持 Google/DeepL/Ollama/OpenAI 等服务,提供 CLI/GUI/MCP/Docker/Zotero
GPT Researcher
★ 27.2kAn autonomous agent that conducts deep research on any data using any LLM providers
Agent Reach
★ 20.1kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Xiaohongshu
★ 13.7kMCP for xiaohongshu.com
Browse More Search & Data Extraction MCP Servers
Explore all search & data extraction servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up 12306 MCP Server in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use 12306 MCP Server?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.