Skip to main content
Glama
CallwaterSword

train-mcp-server

列車チケット照会 MCP Server(FastMCP)

FastMCP で実装された列車・新幹線の運行情報照会サービス。リモート MCP ツールとして任意の Agent(deepagents、LangGraph、Claude など)から呼び出せます。

機能

1 つのツール関数:query_train_tickets(from_station, to_station, date)

  • 2 駅間の指定日の列車番号、時刻、所要時間、予約可否、空席状況を照会

  • データソース:12306 公開照会インターフェース(実データ)。インターフェースが風制御された場合は自動的にシミュレーションデータに切り替え、出所を明記。デモが常に実行可能な状態を保証

Related MCP server: THSRC MCP Server

ローカル実行

pip install -r requirements.txt
python server.py        # 启动 streamable-http 服务,默认 http://127.0.0.1:8000

MCP クライアント設定(ローカル連携テスト):

{
  "mcpServers": {
    "train": {
      "url": "http://127.0.0.1:8000/mcp/",
      "transport": "streamable_http"
    }
  }
}

魔搭 MCP 広場へのデプロイ(重要な手順)

  1. このリポジトリを GitHub にプッシュ

  2. modelscope.cn/mcp を開いてログイン → 「MCP 作成」 をクリック

  3. 作成タイプは 「GitHub クイック作成」 を選択。ホスティングタイプは 「ホスティング可能」 を選択

  4. 英語/中国語の名前、ソースアドレス(GitHub リポジトリ URL)を入力し、プラットフォームの指示に従って設定を補完

  5. 送信後、プラットフォームがアクセスアドレスを生成:https://mcp.api-inference.modelscope.net/<あなたのID>/sse または /mcp(長期有効に設定可能)

  6. そのアドレスを Agent プロジェクトの MCP 設定に記入すれば完了

ヒント:プラットフォームはホスティングプロジェクトに対して起動方法の要件があります(通常は Python + HTTP サービスの起動が必要)。デプロイに失敗した場合は、プラットフォームの指示に従ってエントリポイントを調整してください(例:run スクリプトや環境変数の提供)。

データソースについて

  • 12306 には公式の公開 API はありません。本プロジェクトはその公開照会インターフェース(kyfw.12306.cn/otn/leftTicket)を使用しており、ログイン不要で照会可能。個人の学習研究のみを目的としています

  • インターフェースには風制御があります(偶発的に 302 が発生)。コードではセッション cookie + シミュレーションデータによるフォールバックを実装

  • より安定したデータが必要な場合は、_fetch_12306 をサードパーティのデータソースに置き換えてください(プラグイン可能)

ディレクトリ

  • server.py — FastMCP サービスのメインプログラム

  • test_client.py — ローカル連携テストスクリプト(ツール関数の直接呼び出し + MCP プロトコル経由のテスト)

  • requirements.txt — 依存関係

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    A
    quality
    B
    maintenance
    A 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.
    7
    359
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Enables 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.
    49
    2
    MIT
  • F
    license
    -
    quality
    B
    maintenance
    Enables real-time Indian Railways information retrieval, including live train running status, station schedules, and upcoming arrivals/departures.

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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