yahoo-transit-mcp
Click on "Deploy 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., "@yahoo-transit-mcp 東京から大阪までの経路を教えて"
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.
yahoo-transit-mcp
Yahoo!乗換案内 の非公式 MCP(Model Context Protocol)サーバーです。Claude Code / Claude Desktop などのMCPクライアントから、日本の電車の経路検索・終電・運行情報・駅時刻表を調べられるようになります。
Unofficial MCP server for Yahoo! Transit (transit.yahoo.co.jp), a Japanese transit directions service. Provides route search (incl. last/first train), realtime service disruption info, and station timetables as MCP tools. No authentication required. Japanese rail network only.
できること
ツール | 説明 |
| 経路検索。出発・到着時刻指定のほか、終電( |
| 運行情報(遅延・運転見合わせ)。8地方エリア別。路線名で絞り込むと平常運転かどうかも確認できる |
| 駅名から駅コードを検索。候補が1件なら路線・方面一覧も返す |
| 駅の発車時刻表。路線・方面・平日/土曜/日祝・時間帯で絞り込み |
認証・APIキー・環境変数は一切不要です(ログイン不要の公開ページのみを利用するため)。
Related MCP server: ns-bridge
クイックスタート
Node.js 18以上が必要です。
Claude Code
プロジェクトの .mcp.json に追加します:
{
"mcpServers": {
"transit": {
"type": "stdio",
"command": "npx",
"args": ["-y", "github:groundcobra009/yahoo-transit-mcp"]
}
}
}またはCLIで:
claude mcp add transit -- npx -y github:groundcobra009/yahoo-transit-mcpClaude Desktop
claude_desktop_config.json に追加します:
{
"mcpServers": {
"transit": {
"command": "npx",
"args": ["-y", "github:groundcobra009/yahoo-transit-mcp"]
}
}
}クローンして使う場合
git clone https://github.com/groundcobra009/yahoo-transit-mcp.git
cd yahoo-transit-mcp
npm ci && npm run build
# → MCPクライアントには command: "node", args: ["/path/to/yahoo-transit-mcp/dist/index.js"] で登録登録後、「明日の朝9時までに大阪駅に着きたい」「山手線は遅れてる?」「終電何時?」のように話しかけるだけで使えます。
出力例
search_route(from: "東京", to: "大阪") の実際の返り値(抜粋):
{
"routes": [
{
"no": 1,
"depart": "06:00",
"arrive": "08:40",
"duration": "2時間40分",
"fare": "13,870円",
"transfers": 1,
"badges": ["早"],
"legs": [
{
"from": "東京", "fromTime": "06:00",
"line": "JR新幹線のぞみ1号", "destination": "博多行",
"to": "新大阪", "toTime": "08:22",
"platform": { "departure": "14番線", "arrival": "21番線" },
"fare": "8,910円"
},
{
"from": "新大阪", "fromTime": "08:36",
"line": "JR直通快速107号",
"to": "大阪", "toTime": "08:40",
"platform": { "departure": "3番線" }
}
]
}
]
}スモークテスト(npm run smoke)で4ツールすべてを実データ検証できます:
動作原理
公式APIは存在しないため、このサーバーは公開ページに埋め込まれた構造化データを読み取ります。
Yahoo!乗換案内はNext.jsで構築されており、サーバーサイドレンダリングされた各ページには、画面表示用の全データが <script id="__NEXT_DATA__"> タグ内のJSONとして同梱されています(Reactのハイドレーション用・Next.jsの標準動作)。このサーバーはブラウザと同じようにページをGETし、このJSONだけを抽出してパースします。
Yahooのバックエンドエンドポイントを直接叩きません(リバースエンジニアリング・トークン取得なし)
CSSセレクタに依存しないため、見た目のリニューアル程度では壊れません
ページ構造が大きく変わって解析できなくなった場合は、
MarkupChangedErrorがツール結果として明示的に返ります(黙って誤った経路を返すことはありません)
ツールリファレンス
search_route — 経路検索
パラメータ | 型 | 説明 |
| string(必須) | 出発・到着の駅名または地名 |
| string[] | 経由駅(最大3つ) |
| string |
|
| enum |
|
| enum |
|
| enum |
|
| boolean | 新幹線 / 有料特急 / 飛行機 / 高速バスの利用可否(既定: true) |
駅名が曖昧な場合は候補リスト(didYouMean)を返します。
get_train_status — 運行情報
パラメータ | 型 | 説明 |
| enum |
|
| string | 路線名の部分一致フィルタ(例: |
| boolean |
|
search_station — 駅検索
パラメータ | 型 | 説明 |
| string(必須) | 駅名(例: |
get_timetable — 駅時刻表
パラメータ | 型 | 説明 |
| string(必須) | 駅名または駅コード |
| string | 路線名・方面の部分一致。曖昧なら候補一覧がエラーとして返るので絞り込んで再実行 |
| enum |
|
| number | 返す時間帯(0〜27時台) |
アクセスマナー(実装で強制)
相手サーバーに負荷をかけないため、以下をコードで強制しています:
全リクエストの直列化+1.5秒以上の間隔(
src/fetch.ts)URL単位の15分キャッシュ
10秒タイムアウト・リトライは通信エラー時の1回のみ
対話的な利用を想定したツールです。ポーリング・一括クロール・大量取得には使わないでください。
開発
npm ci # 依存インストール
npm run build # TypeScriptビルド(dist/)
npm run lint # 型チェック(tsc --noEmit)
npm run smoke # 実サイトに対する動作確認(約6リクエスト・直列)
npx tsx scripts/try-route.ts 東京 大阪 2026-07-10 09:00 arrival # 単発の経路検索CIでは lint / build のみ実行します。smoke は実サイトへアクセスするため、リリース前の手動ゲートとしてローカルで実行してください。
免責事項
本プロジェクトは個人による非公式ツールであり、LINEヤフー株式会社とは一切関係ありません(非公認・非提携)。「Yahoo!」「Yahoo!乗換案内」はサービスの識別のためにのみ言及しており、商標は各権利者に帰属します
公開ウェブページの解析に基づくため、サイト側の変更により予告なく動作しなくなる可能性があります
取得した情報の正確性は保証されません。実際の運行は公式情報を確認してください
本ソフトウェアの利用は自己責任です。利用者は対象サービスの利用規約を自身で確認し、過度なアクセス・商用利用・取得データの再配布を行わないでください
ライセンス
MIT © keitaro (groundcobra009)
Available Tools
4 toolsget_timetable駅の時刻表A
指定駅・路線・方面の発車時刻表を取得する。路線・方面が曖昧な場合は候補一覧をエラーとして返すので、それを見て絞り込んで再実行する。
Inputs: station (required), line, hourTo, dayType, +2 more.
get_train_status運行情報(遅延・運転見合わせ)A
鉄道の運行情報(遅延・運転見合わせ等)をエリア別に取得する。line で特定路線に絞り込める(平常運転かどうかも分かる)。
Inputs: area, line, onlyTroubled.
search_route経路検索(Yahoo!乗換案内)A
出発地から目的地までの電車経路を検索する。時刻・所要時間・運賃・乗換回数・各区間の路線と番線を返す。終電は mode=last_train、始発は mode=first_train。
Inputs: to (required), from (required), via, date, +8 more.
search_station駅検索(駅コード・路線一覧)A
駅名から駅コードを検索する。候補が1件に絞れた場合はその駅の路線・方面一覧(時刻表取得用のgroupId)も返す。get_timetable の前段として使う。
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clear, distinct purpose: station search, route planning, train status, and timetable lookup. There is no overlap or ambiguity between them.
All tool names follow a consistent verb_noun pattern: search_station, search_route, get_train_status, get_timetable. The naming is uniform and predictable.
With 4 tools, the server is well-scoped for a transit domain, covering the essential user needs without unnecessary bloat or missing core functionality.
The tool set covers station lookup, route planning with fares and times, real-time status, and timetable retrieval. This forms a complete workflow for transit information, with no obvious gaps.
Maintenance
Related MCP Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Official remote MCP server for SUZURI.
Hosted MCP server for live public-data APIs and Skills for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides real-time delay information for JR East train lines, accessible via MCP clients like Claude Desktop through the 'getDelays' tool.5MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to interact with the Netherlands Railways (NS) API for route planning, pricing, and real-time departure information. It provides tools for searching stations, planning trips with connections, and viewing real-time departure boards.31MIT
- AlicenseAqualityDmaintenanceMCP server for searching Japanese train routes using Yahoo! Transit data, enabling station-to-station route planning with optional via stations, time specifications, and fare options.145 npm30MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for Japanese public transit journey planning with interactive map UI, enabling station search, route planning, and departure lookups via natural language.MIT