12306-MCP
Allows installation and usage of the 12306-mcp package via npm to provide train ticket search functionality to AI models
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 find train tickets from Beijing to Shanghai for 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.
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购票信息。
🔥应用
1、在 Cursor 中使用
可以智能选票还能生成途径站点可视化地图!
教程:Cursor + 12306 MCP,实现AI智能选票还能生成精美网站

在yb.html中可直接用浏览器打开

2、用阿里云百炼做智能体
教程:阿里百炼+12306 MCP,打造AI智能选票智能体,超酷的!

我在后天想从西安出发去往郑州,请推荐出合理的车票,并推荐三天后返程的车票,

还能对比各个列车票价,做个图表,更直观了。

同样能让他生成列车停靠站点地图:

还能生成途径站点的旅行攻略。这里我的逻辑是先让他去网上搜,搜不到就调用文生图模型,由 AI 生成图片。

阿里自带的这个生图 MCP 感觉能力还是挺强的。

感觉跟真的也差不多啊,哈哈哈。

说实话,在火车上看着自己坐的这一趟列车途径的城市,看着这些景点,心中难免有一丝丝的冲动。

Related MCP server: 12306-mcp
🚩Features
功能描述 | 状态 |
查询12306购票信息 | ✅ 已完成 |
过滤列车信息 | ✅ 已完成 |
过站查询 | ✅ 已完成 |
中转查询 | ✅ 已完成 |
其余接口,欢迎提feature | 🚧 计划内 |
⚙️Installation
git clone https://github.com/freestylefly/12306-mcp.git
npm i▶️Quick Start
CLI
npm run build
node ./build/index.jsMCP sever configuration
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}👉️Reference
💭Murmurs
本项目原自12306-MCP ,感谢作者,本项目仅用于学习,欢迎催更。
👉️友情链接
mcp-server-weread :🚀基于 Model Context Protocol (MCP) 的12306购票搜索服务器。提供了简单的API接口,允许大模型利用接口搜索12306购票信息。
12306-MCP :🚀一个为微信读书提供MCP(Model Context Protocol)服务的工具,支持将微信读书的书籍、笔记和划线数据提供给支持MCP的大语言模型客户端,如Claude Desktop。
CodeCanvas :📚本代码仓库是作者苍何多年从事一线互联网Java开发的学习历程技术汇总,旨在为大家提供一个清晰详细的学习教程,侧重点更倾向编写Java核心内容。💪🏻
PmHub :🔥PmHub 是一套基于 SpringCloud & LLM 的微服务智能项目管理系统,这个项目旨在帮助小伙伴们快速掌握微服务/分布式项目的架构设计和开发流程,如果想在校招或者社招中拿到一个满意的 offer,PmHub 将是一个非常 nice 的选择。
star 趋势图
公众号
微信搜 苍何 或扫描下方二维码关注苍何的原创公众号,回复 AI 即可和 5000+ 好友一同探讨AI,一同学习MCP。

开源协议
MIT License (MIT) The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Copyright (c) 2025-2026 12306-MCP
Available Tools
8 toolsget-current-dateA
获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 "yyyy-MM-dd"。主要用于解析用户提到的相对日期(如“明天”、“下周三”),为其他需要日期的接口提供准确的日期输入。
Inputs: no named parameters.
get-interline-ticketsB
查询12306中转余票信息。尚且只支持查询前十条。
Inputs: date (required), fromStation (required), toStation (required), middleStation, +2 more.
get-station-by-telecodeA
通过车站的 station_telecode 查询车站的详细信息,包括名称、拼音、所属城市等。此接口主要用于在已知 telecode 的情况下获取更完整的车站数据,或用于特殊查询及调试目的。一般用户对话流程中较少直接触发。
Inputs: stationTelecode (required).
get-station-code-by-namesA
通过具体的中文车站名查询其 station_code 和车站名。此接口主要用于在用户提供具体车站名作为出发地或到达地时,为接口准备 station_code 参数。
Inputs: stationNames (required).
get-station-code-of-citysA
通过中文城市名查询代表该城市的 station_code。此接口主要用于在用户提供城市名作为出发地或到达地时,为接口准备 station_code 参数。
Inputs: citys (required).
get-stations-code-in-cityA
通过中文城市名查询该城市 所有 火车站的名称及其对应的 station_code,结果是一个包含多个车站信息的列表。当用户想了解一个城市有哪些火车站,或者不确定具体从哪个车站出发/到达时可以使用此接口。
Inputs: city (required).
get-ticketsB
查询12306余票信息。
Inputs: date (required), fromStation (required), toStation (required), trainFilterFlags.
get-train-route-stationsA
查询特定列车车次在指定区间内的途径车站、到站时间、出发时间及停留时间等详细经停信息。当用户询问某趟具体列车的经停站时使用此接口。
Inputs: trainNo (required), fromStationTelecode (required), toStationTelecode (required), departDate (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose with no overlap. Tools target specific functions like date retrieval, station code lookup (by telecode, names, cities, or stations in a city), ticket queries (direct and interline), and train route details, making misselection unlikely.
All tools follow a consistent verb_noun pattern with 'get-' prefix (e.g., get-current-date, get-tickets). The naming is uniform and predictable, enhancing readability and usability.
With 8 tools, the server is well-scoped for querying 12306 train data. Each tool serves a specific role in the workflow, from station code resolution to ticket and route queries, without being overly sparse or bloated.
The toolset covers core functionalities like date handling, station code retrieval, ticket queries, and route details, supporting key user workflows. A minor gap is the lack of booking or purchase tools, but this is reasonable for a query-focused server.
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.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows LLMs to interact with web content through standardized tools, currently supporting web scraping functionality.1MIT
- AlicenseAqualityDmaintenanceThe server provides a simple API interface that allows users to search for 12306 tickets.82,476MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server for querying large JSON files using JSONPath expressions, enabling LLMs to efficiently search and extract information from large JSON data.311MIT
- AlicenseAqualityBmaintenanceA 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.7426MIT