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: 12306 Train Ticket Search 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
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
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 Connectors
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
21TravelMind: 8 MCP tools for travel (12306 trains, flights, hotels, geocode, planning, policy).
Search award flights and cash fares, optimize points, and predict fares inside ChatGPT and Claude.
Search Chinese books with Douban ratings, AI book guides and curated toplists. Free, no API key.
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.7378MIT
- 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.8,3132MIT
- AlicenseNot gradedqualityDmaintenanceEnables searching Turkish high-speed train (YHT) tickets via TCDD API. Supports real-time availability, station name resolution, date formatting, and passenger count.MIT
- FlicenseNot gradedqualityDmaintenanceEnables real-time flight and train ticket queries, dynamic trip tracking, and knowledge-based Q&A about rail and aviation policies.-
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