get-current-date
获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 "yyyy-MM-dd"。主要用于解析用户提到的相对日期(如“明天”、“下周三”),提供准确的日期输入。
Ask about China Railway services the way you would out loud — where to, when, and what is still on sale — and get it back off 12306.
LABSCO SUMMARY
What it takes off you is the lookup: turn a city into the station codes the timetable actually uses, ask what is left on the day you mean, and read a train's stops and times back — including the connecting itineraries you would otherwise have to construct yourself.
A query layer over 12306, China Railway's own ticketing site. At startup it pulls the national station list from 12306 and indexes it by city, station name and code; every answer after that is a live lookup — seat availability, transfers, and a train's calling pattern.
Node.js 18 or newer and npx on your PATH; npx -y 12306-mcp --port runs it over HTTP instead of stdio, and a Dockerfile is in the repository. Everything it answers comes from 12306 at request time, so it needs network access, and the station and train names it takes and returns are the Chinese ones. Ticket queries are rejected for a date earlier than today, which is what the date call is there to settle.
One command — npx -y 12306-mcp
USE CASES
Settle what date "next Wednesday" is, turn both city names into station codes, and ask what is still on sale.
List every station in the city with its code, so the query goes to the one you actually want to leave from.
Ask for transfer itineraries, optionally through an interchange you name, rather than piecing two searches together yourself.
Read the calling pattern over the stretch you care about, with arrival, departure and dwell time at each stop.
Look the station up by its telecode to get the name, pinyin and city back.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
get-current-date获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 "yyyy-MM-dd"。主要用于解析用户提到的相对日期(如“明天”、“下周三”),提供准确的日期输入。
get-interline-tickets查询12306中转余票信息。尚且只支持查询前十条。
get-station-by-telecode通过车站的 station_telecode 查询车站的详细信息,包括名称、拼音、所属城市等。此接口主要用于在已知 telecode 的情况下获取更完整的车站数据,或用于特殊查询及调试目的。一般用户对话流程中较少直接触发。
get-station-code-by-names通过具体的中文车站名查询其 station_code 和车站名。
get-station-code-of-citys通过中文城市名查询代表该城市的 station_code。
get-stations-code-in-city通过中文城市名查询该城市 所有 火车站的名称及其对应的 station_code,结果是一个包含多个车站信息的列表。
get-tickets查询12306余票信息。
get-train-route-stations查询特定列车车次在指定区间内的途径车站、到站时间、出发时间及停留时间等详细经停信息。当用户询问某趟具体列车的经停站时使用此接口。
BEFORE YOU INSTALL
8 tools when we connected.
npx on PATH
CONTEXT COST
Rated by the size of the 8 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
Add the block to your client, or run the command directly.
{
"mcpServers": {
"12306-mcp": {
"command": "npx",
"args": [
"-y",
"12306-mcp"
]
}
}
}npx -y 12306-mcp