Basic information
About 12306 Railway MCP Server
12306 Railway server connects to China’s official system for real-time train ticket search, schedules, and route info across the railway network.
12306 Railway is a MCP server in the Developer Tools category listed in the AddMCP.net directory, published by freestylefly. It exposes 8 tools, including get-current-date, get-stations-code-in-city, get-station-code-of-citys, get-station-code-by-names and more. Supported transport: stdio, streamable-http. Runtime: JavaScript. License: MIT. The repository has 19 GitHub stars. Source code is hosted on github.com. Related topics: 12306, analytics-data, community, developer-tools, mcp.
Setup
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}
{
"servers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}
12306 Railway MCP Server config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}
12306 Railway MCP Server tools
- get-current-date — 获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 "yyyy-MM-dd"。主要用于解析用户提到的相对日期(如“明天”、“下周三”),提供准确的日期输入。
- get-stations-code-in-city — 通过中文城市名查询该城市 **所有** 火车站的名称及其对应的 `station_code`,结果是一个包含多个车站信息的列表。
- get-station-code-of-citys — 通过中文城市名查询代表该城市的 `station_code`。此接口主要用于在用户提供**城市名**作为出发地或到达地时,为接口准备 `station_code` 参数。
- get-station-code-by-names — 通过具体的中文车站名查询其 `station_code` 和车站名。此接口主要用于在用户提供**具体车站名**作为出发地或到达地时,为接口准备 `station_code` 参数。
- get-station-by-telecode — 通过车站的 `station_telecode` 查询车站的详细信息,包括名称、拼音、所属城市等。此接口主要用于在已知 `telecode` 的情况下获取更完整的车站数据,或用于特殊查询及调试目的。一般用户对话流程中较少直接触发。
- get-tickets — 查询12306余票信息。
- get-interline-tickets — 查询12306中转余票信息。尚且只支持查询前十条。
- get-train-route-stations — 查询特定列车车次在指定区间内的途径车站、到站时间、出发时间及停留时间等详细经停信息。当用户询问某趟具体列车的经停站时使用此接口。
Overview
What is 12306 Railway?
12306 Mcp is a ticket search server for the Chinese railway system (12306) built on the Model Context Protocol (MCP). It provides a simple API interface that allows large language models to search for 12306 ticket information. The project is intended for developers integrating train ticket lookup into AI applications and is described as for learning purposes.
How to use 12306 Railway?
Clone the repository and run npm i. Use npx -y 12306-mcp to start with stdio transport, or npx -y 12306-mcp --port [port] for HTTP transport. Docker images can be built and run with similar commands. The MCP server configuration for clients requires setting the command and args as shown in the README.
Key features of 12306 Railway
- Query 12306 ticket information
- Filter train information
- Pass-through station query
- Transfer (connecting) query
Use cases of 12306 Railway
- Search for available trains between two stations
- Filter trains by criteria
- Find trains that pass through a specific intermediate station
- Plan journeys involving train transfers
Frequently asked questions
1 How is 12306 Mcp installed and run?
Install by cloning the repository and running npm i. Run via npx -y 12306-mcp for stdio transport or with --port [port] for HTTP transport. Docker images can be built with docker build . -t 12306-mcp and run accordingly.
2 What transport protocols does 12306 Mcp support?
It supports both stdio (standard input/output) and HTTP transport. HTTP transport requires specifying a port number.
3 What runtime does 12306 Mcp require?
The README indicates a Node.js environment (TypeScript-based) and npm. Docker is also supported as an alternative deployment method.
4 Is 12306 Mcp production-ready?
The README states the project is for learning purposes only ("本项目仅用于学习") and welcomes feature requests, indicating it is an experimental/educational project.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In