12306-mcp
The 12306-mcp server provides functionalities for searching and filtering train ticket information:
Query tickets: Search for train tickets between stations on a specific date
Filter results: Filter by train types (G, D, Z, T, K, O, F, S) or specific flags (high-speed, smart trains)
Station information: Retrieve station codes for cities, query all stations within a city, or find codes for specific station names
Advanced routing: Perform intermediate station queries and transfer queries
Used as a donation platform where users can buy the developer a milk tea.
Linked to the developer's Bilibili profile, though no specific integration capabilities are described.
Referenced as the project repository platform, but not described as a service the MCP server integrates with.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@12306-mcp search for train tickets from Beijing to Shanghai tomorrow"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
12306-mcp
A 12306 ticket search server based on the Model Context Protocol (MCP). The server provides a simple API interface that allows users to search for 12306 tickets.
基于 Model Context Protocol (MCP) 的12306购票搜索服务器。提供了简单的API接口,允许大模型利用接口搜索12306购票信息。
如需Skill -> https://github.com/Joooook/12306-skill
🚩Features
功能描述 | 状态 |
查询12306购票信息 | ✅ 已完成 |
过滤列车信息 | ✅ 已完成 |
过站查询 | ✅ 已完成 |
中转查询 | ✅ 已完成 |
其余接口,欢迎提feature | 🚧 计划内 |
Related MCP server: 12306 Train Ticket Search MCP Server
⚙️Installation
git clone https://github.com/Joooook/12306-mcp.git
npm i▶️Quick Start
CLI-stdio
npx -y 12306-mcpCLI-http
npx -y 12306-mcp --port [端口号]Runtime requirements
The server requires Node.js 18 or newer. The npm run debug command uses
MCP Inspector 2.0.0, which requires Node.js 22.19.0 or newer.
MCP sever configuration
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}
Docker-stdio
docker build . -t 12306-mcp
docker run --rm -it 12306-mcp npx 12306-mcpDocker-http
docker build . -t 12306-mcp
docker run -p [your_port]:8080 -d 12306-mcp npx 12306-mcp --port 8080📚Documentation
👉️Reference
💭Murmurs
本项目仅用于学习,欢迎催更。
🎫Badges
☕️Donate
请我喝杯奶茶吧。
Available Tools
8 toolsget-current-dateA
获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 "yyyy-MM-dd"。主要用于解析用户提到的相对日期(如“明天”、“下周三”),提供准确的日期输入。
Inputs: no named parameters.
get-interline-ticketsB
查询12306中转余票信息。尚且只支持查询前十条。
Inputs: date (required), toStation (required), fromStation (required), format, +8 more.
get-station-by-telecodeA
通过车站的 station_telecode 查询车站的详细信息,包括名称、拼音、所属城市等。此接口主要用于在已知 telecode 的情况下获取更完整的车站数据,或用于特殊查询及调试目的。一般用户对话流程中较少直接触发。
Inputs: stationTelecode (required).
get-station-code-by-namesA
通过具体的中文车站名查询其 station_code 和车站名。
Inputs: stationNames (required).
get-station-code-of-citysB
通过中文城市名查询代表该城市的 station_code。
Inputs: citys (required).
get-stations-code-in-cityB
通过中文城市名查询该城市 所有 火车站的名称及其对应的 station_code,结果是一个包含多个车站信息的列表。
Inputs: city (required).
get-ticketsB
查询12306余票信息。
Inputs: date (required), toStation (required), fromStation (required), format, +6 more.
get-train-route-stationsA
查询特定列车车次在指定区间内的途径车站、到站时间、出发时间及停留时间等详细经停信息。当用户询问某趟具体列车的经停站时使用此接口。
Inputs: trainCode (required), departDate (required), format.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools have distinct purposes (date, tickets, interline tickets, station queries by different criteria, train route). However, get-station-code-by-names and get-station-code-of-citys could be confused as both involve station codes, but descriptions clarify the input type.
All tools follow get-<resource>-<detail> pattern with snake_case, but there are inconsistencies: 'citys' is a typo, and some use singular 'station' while others use plural 'stations' (e.g., get-stations-code-in-city vs get-station-code-by-names).
8 tools cover core query needs for a train information server (date, tickets, stations, routes). Not excessive or insufficient, though a tool for train number details might be expected.
Covers essential queries: date, tickets, interline tickets, station codes by multiple methods, station details, and train routes. Missing price or order-related queries, but the scope is focused on info retrieval.
Maintenance
Related MCP Connectors
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
Skiplagged MCP Server for flight search, hotel booking, and travel planning
MCP server for Chinese express delivery tracking: query parcel status by tracking number across
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that allows large language models to search for and analyze Chinese railway (12306) tickets through a simple API interface.813,273 npm19MIT
- AlicenseNot gradedqualityDmaintenanceEnables searching for train tickets on China's 12306 railway system, including ticket availability queries, train filtering, station stopover information, and transfer route planning.13,273 npm2MIT
- AlicenseBqualityDmaintenance12306 ticket purchase search server based on Model Context Protocol (MCP). It provides a simple API interface, allowing large models to search for 12306 ticket purchasing information through the interface.81Apache 2.0
- AlicenseNot gradedqualityDmaintenanceMCP server providing access to Russian Railways ticket API, enabling train search, station lookup, and trip information.1MIT
