12306
获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 'yyyy-MM-dd'。主要用于解析用户提到的相对日期(如“明天”、“下周三”),为其他需要日期的接口提供准确的日期输入。
What is 12306?
12306 is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 获取当前日期,以上海时区(asia/shanghai, utc+8)为准,返回格式为 'yyyy-mm-dd'。主要用于解析用户提到的相对日期(如“明天”、“下周三”),为其他需要日期的接口提供准确的日期输入。
获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 'yyyy-MM-dd'。主要用于解析用户提到的相对日期(如“明天”、“下周三”),为其他需要日期的接口提供准确的日期输入。
This server falls under the Search & Data Extraction category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- get-current-date
- get-stations-code-in-city
- get-station-code-of-citys
- get-station-code-by-names
- get-station-by-telecode
Use Cases
Maintainer
Works with
Installation
NPM
npx -y 12306-mcpManual Installation
npx -y 12306-mcpConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use 12306
12306-mcp is a Node.js MCP server that wraps China's official 12306 railway ticketing system, giving AI assistants the ability to search train schedules, check seat availability, look up station codes by city, query routes with transfers, and filter results by train type or seat class. It handles date interpretation in the Asia/Shanghai timezone (UTC+8) so that natural language like 'tomorrow' or 'next Wednesday' resolves correctly to the right date. Chinese travelers and developers use it to let Claude or other AI models answer questions about high-speed rail and regular train tickets without manually navigating the 12306 website.
Prerequisites
- Node.js 18+ and npm installed (for npx usage)
- An MCP-compatible client such as Claude Desktop or Cursor
- Internet access to reach the 12306 API (no account or API key required)
Test the server with npx (no install required)
Run the server directly with npx to verify it starts correctly. The server communicates over stdio by default.
npx -y 12306-mcpAdd the server to your MCP client configuration
Edit your Claude Desktop (or other MCP client) configuration file to add 12306-mcp as a server. No environment variables are required.
{
"mcpServers": {
"12306": {
"command": "npx",
"args": ["-y", "12306-mcp"]
}
}
}Restart your MCP client
Restart Claude Desktop or your chosen client to load the new server configuration.
Query train schedules in natural language
Ask the AI to search for trains between two cities. The server will resolve city names to station codes and query availability from 12306.
(Optional) Run in HTTP mode for network access
Start the server on a specific port to expose it over HTTP, useful for accessing from multiple clients or a remote machine.
npx -y 12306-mcp --port 808012306 Examples
Client configuration (Claude Desktop)
Minimal Claude Desktop configuration for 12306-mcp with no API keys required:
{
"mcpServers": {
"12306": {
"command": "npx",
"args": ["-y", "12306-mcp"]
}
}
}Prompts to try
Ask about Chinese train schedules using natural language:
- "Search for high-speed trains from Beijing to Shanghai tomorrow morning"
- "What trains are available from Guangzhou to Shenzhen this Saturday afternoon?"
- "Find transfer options from Chengdu to Hangzhou with the shortest total travel time"
- "What is the station code for trains departing from Wuhan?"
- "Show me all G-class (high-speed) trains between Nanjing and Suzhou next Monday"Troubleshooting 12306
Server returns no results for a city search
Ensure you are using the Chinese city name (e.g., '北京' or 'Beijing'). The server maps city names to internal 12306 station codes — ambiguous or misspelled city names may return empty results.
Date queries resolve to the wrong day
The server uses Asia/Shanghai timezone (UTC+8) for all date resolution. If your Claude Desktop is in a different timezone, relative dates like 'tomorrow' will still be calculated in Shanghai time. Specify an explicit date (YYYY-MM-DD) to avoid ambiguity.
Network timeout or connection refused errors
The server queries the 12306 API directly. If you are outside mainland China, access to 12306 may be restricted. Try using a VPN with a Chinese exit node, or run the server on a Chinese cloud server.
Frequently Asked Questions about 12306
What is 12306?
12306 is a Model Context Protocol (MCP) server that 获取当前日期,以上海时区(asia/shanghai, utc+8)为准,返回格式为 'yyyy-mm-dd'。主要用于解析用户提到的相对日期(如“明天”、“下周三”),为其他需要日期的接口提供准确的日期输入。 It connects AI assistants to external tools and data sources through a standardized interface.
How do I install 12306?
Install via npm with the command: npx -y 12306-mcp. 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?
12306 works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is 12306 free to use?
Yes, 12306 is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
12306 Alternatives — Similar Search & Data Extraction Servers
Looking for alternatives to 12306? 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 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?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.