Mcp Server 12306
@drfccv
关于 Mcp Server 12306
12306 MCP Server 是一个基于 Model Context Protocol (MCP) 的高性能火车票查询后端系统。它通过标准化接口提供官方 12306 的实时数据服务,包括余票查询、车站信息、列车经停站、中转换乘方案等核心功能。
基本信息
配置
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"12306": {
"command": "uvx",
"args": [
"mcp-server-12306"
]
}
}
}工具
7官方12306余票/车次/座席/时刻一站式查询。输入出发站、到达站、日期,返回所有可购车次、时刻、历时、各席别余票等详细信息。支持中文名、三字码。 【智能筛选指南】返回结果通常包含出发/到达城市的所有相关车站(如北京/北京西/北京南)。请根据用户输入语境灵活处理: 1. 用户仅输入城市名(如'九江'):请展示所有相关站点的车次,不要过滤。 2. 用户指定具体车站(如'九江站'):优先展示匹配车站的车次,但若其他同城车站有更优方案(如时间更短、有票),也应作为补充选项提供。 请避免机械地仅通过字符串匹配过滤车次,以免遗漏用户可能感兴趣的出行方案。
查询火车票价信息。输入出发站、到达站、日期,返回各车次的票价详情。支持指定车次号过滤。 【智能筛选指南】返回结果通常包含出发/到达城市的所有相关车站(如北京/北京西/北京南)。请根据用户输入语境灵活处理: 1. 用户仅输入城市名(如'九江'):请展示所有相关站点的车次,不要过滤。 2. 用户指定具体车站(如'九江站'):优先展示匹配车站的车次,但若其他同城车站有更优方案(如时间更短、有票),也应作为补充选项提供。 请避免机械地仅通过字符串匹配过滤车次,以免遗漏用户可能感兴趣的出行方案。
智能车站搜索。支持中文名、拼音、简拼、三字码(Code)。可用于模糊搜索(如“北京”),也可用于精确获取车站代码(如输入“BJP”返回北京站信息)。
官方中转换乘方案查询。输入出发站、到达站、日期,可选中转站/无座/学生票,自动分页抓取全部中转方案。
列车经停站全表查询。支持输入车次号或官方编号,返回所有经停站、到发时刻、停留时间。
车次号转官方唯一编号(train_no),支持三字码/全名。常用于经停站查询前置转换。
获取当前日期和时间信息,支持相对日期计算。返回当前日期、时间,以及常用的相对日期。
概览
What is MCP Server 12306?
MCP Server 12306 is a high-performance train ticket query service based on the Model Context Protocol (MCP). It supports real-time queries for 12306 ticket availability, prices, stations, stopovers, transfers, and intelligent time tools, designed for AI, automation, and intelligent assistant scenarios.
How to use MCP Server 12306?
Supports two operation modes: Stdio mode (recommended for Claude Desktop) and Streamable HTTP mode (for remote deployment). Stdio mode can be run via uvx or pipx; HTTP mode is started after pip installation with the [http] extra or via Docker. Client configuration for HTTP mode is http://localhost:8000/mcp.
Key features of MCP Server 12306
- Real-time query of tickets, trains, seats, schedules, and transfers
- Nationwide station management with fuzzy search
- Full support for official stopover and transfer plans
- Real-time fare query for each train
- Smart time tools with timezone and timestamp support
- Dual transport modes: Stdio | Streamable HTTP
Use cases of MCP Server 12306
- Integrate into intelligent assistants for real-time train ticket and fare queries
- Automate itinerary planning with transfer route suggestions
- Fuzzy search and station information completion
- Query train stopovers and timetables
- Assist date selection based on current time
FAQ from MCP Server 12306
What transport modes does MCP Server 12306 support?
It supports Stdio mode (for local MCP clients like Claude Desktop) and Streamable HTTP mode (for remote access via SSE/POST).
What are the runtime requirements?
Python 3.10+; HTTP mode requires FastAPI/uvicorn (install with pip install mcp-server-12306[http]); also available via Docker.
Where does the station data come from?
The project does not store 12306 data; it only aggregates and forwards the official public interface. Static station resources are stored in the resources/ directory.
Is MCP Server 12306 free and open-source?
Yes, the project is licensed under MIT License, but commercial use is strictly prohibited. Users must comply with Chinese laws and 12306 regulations.
How to configure MCP Server 12306 for Claude Desktop?
Add the following to your Claude Desktop MCP configuration: for uvx, set command to "uvx" and args to `["mcp-server-123
其他 分类下的更多 MCP 服务器
MCP Go 🚀
mark3labsA Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.
Nginx UI
0xJackyYet another WebUI for Nginx
🚀 Model Context Protocol (MCP) Curriculum for Beginners
microsoftThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable,
Unity MCP ✨
justinpbarnettUnity MCP acts as a bridge between AI assistants and your Unity Editor. Give your LLM tools to manage assets, control scenes, edit scripts, and automate tasks within Unity.
MCP Registry
modelcontextprotocolA community driven registry service for Model Context Protocol (MCP) servers.
评论