train-mcp-server
Provides a tool for querying train ticket information, including schedules, durations, booking status, and seat availability, which can be used by the LangGraph agent.
Click on "Install 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., "@train-mcp-server查询明天从北京到上海的高铁车次"
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.
Train Ticket Query MCP Server (FastMCP)
A train/high-speed rail query service implemented with FastMCP, which can be called as a remote MCP tool by any Agent (such as deepagents, LangGraph, Claude, etc.).
Capabilities
One tool function: query_train_tickets(from_station, to_station, date)
Query the train numbers, schedules, durations, booking availability, and remaining tickets between two stations on a given day
Data source: 12306 public query interface (real data); automatically switches to simulated data when the interface is blocked, with the source clearly marked, ensuring the pipeline can be demonstrated at any time
Related MCP server: THSRC MCP Server
Local Run
pip install -r requirements.txt
python server.py # 启动 streamable-http 服务,默认 http://127.0.0.1:8000MCP client configuration (local debugging):
{
"mcpServers": {
"train": {
"url": "http://127.0.0.1:8000/mcp/",
"transport": "streamable_http"
}
}
}Deploy to ModelScope MCP Plaza (Key Steps)
Push this repository to GitHub
Open modelscope.cn/mcp → Log in → Click "Create MCP"
Select "GitHub Quick Create" as the creation type; select "Hosted Deployment" as the hosting type
Fill in the English/Chinese name, source URL (GitHub repository URL), and complete the configuration as prompted by the platform
After submission, the platform generates an access URL:
https://mcp.api-inference.modelscope.net/<your ID>/sseor/mcp(can be set to be valid indefinitely)Fill this URL back into the MCP configuration of the Agent project
Tip: The platform has startup method requirements for hosted projects (usually requires Python + starting an HTTP service). If deployment fails, adjust the entry point as prompted by the platform (e.g., provide a
runscript or environment variable).
Data Source Description
12306 has no official open API. This project uses its public query interface (kyfw.12306.cn/otn/leftTicket) for querying without login, for personal learning and research only
The interface has anti-bot measures (occasional 302 redirects). The code includes session cookies + simulated data as a fallback
If more stable data is needed, you can replace
_fetch_12306with a third-party data source (pluggable)
Directory
server.py— FastMCP service main programtest_client.py— Local debugging script (directly calls tool functions + tests via MCP protocol)requirements.txt— Dependencies
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- 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.7359MIT
- Alicense-qualityDmaintenanceEnables real-time Taiwan High Speed Rail (THSRC) information queries including timetables, station details, train status, and seat availability. Supports multiple languages and integrates with TDX API for up-to-date rail service data.492MIT
- Alicense-qualityDmaintenanceEnables searching for train tickets on China's 12306 railway system, including ticket availability queries, train filtering, station stopover information, and transfer route planning.9,8472MIT
- Flicense-qualityBmaintenanceEnables real-time Indian Railways information retrieval, including live train running status, station schedules, and upcoming arrivals/departures.
Related MCP Connectors
TravelMind: 8 MCP tools for travel (12306 trains, flights, hotels, geocode, planning, policy).
Provide access to Chinese stock market data including historical prices, real-time data, news, and…
China & Asia travel eSIM specialist. 200+ countries. No-VPN internet in China.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/CallwaterSword/train-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server