
Mcp Server Tfl
io.github.oneill9由 GitHub 帳號 oneill9 發布v1.4.0更新於 Oct 24, 2026
Community-built server providing real-time London transport data via the TfL Unified API
概覽
社群打造的 MCP 伺服器,透過 TfL 統一 API 讓助理取得倫敦交通即時資料:路線狀態、到站、行程規劃、公共自行車、擁擠度與票價。
- 可以做什麼
- 查詢倫敦各交通運具目前的運行狀態與中斷情形,支援介面的用戶端還能顯示互動式狀態看板。依站名查詢公車與地鐵的即時到站資訊。規劃兩點之間的行程。列出 Santander Cycles 公共自行車租借站。查詢車站即時擁擠度與兩個指定站點間的票價資訊。站名會自動解析為 NaPTAN 編號。
- 適用情境
- 適合讓助理回答日常倫敦交通問題,例如某條路線是否正常運行、下一班公車何時到站、如何從一處前往另一處,並使用 TfL 即時資料而非一般常識。
- 執行需求
- 以 Node.js 22 以上版本在本機執行(npm 套件、MCPB 套件或 Docker 映像),使用 stdio 傳輸;另提供 Streamable HTTP 模式。強烈建議使用免費的 TfL API 金鑰,透過 TFL_APP_KEY 環境變數傳入;TFL_APP_ID 僅舊版註冊需要。需要能連線至 TfL 統一 API 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Server Tfl,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
TfL MCP Server
[TfL MCP Server logo]Disclaimer: This is a community-built project. It is not affiliated with, endorsed by, or connected to Transport for London (TfL). This project consumes the publicly available TfL Unified API.
[GitHub release] [License: MIT]
An MCP server that exposes the TfL (Transport for London) Unified API as tools, allowing AI assistants like Claude to query live London transport data.
Version 2 is a single Node.js 22 implementation using the MCP 2026-07-28 protocol revision. It supports stdio for local hosts, npm, and MCPB, plus stateless Streamable HTTP at /mcp for remote deployments.
Protocol compatibility: Streamable HTTP is modern-only MCP
2026-07-28. The stdio entry point also accepts 2025-era initialization for desktop hosts such as Codex, while modern stdio clients continue to negotiate2026-07-28. Legacy HTTP/SSE is not supported.
Getting Started
Step 1 — Add to Claude Desktop
Open your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Option A: Node.js MCPB (recommended)
Download tfl-mcp-server.mcpb from GitHub Releases and install it in Claude Desktop.
Option B: npm
With Node.js 22 or later installed, point Claude Desktop at the published package:
Option C: Docker
Step 2 — Add a TfL API key (recommended)
Without a key, TfL applies strict rate limits that will impact most real-world usage. Register a free key and pass it via the TFL_APP_KEY environment variable. The Docker example's -e TFL_APP_KEY forwards this value into the container:
Step 3 — Restart Claude Desktop and start asking questions
Example: "Is the Central line running normally?", "When is the next bus from Oxford Circus?"
For source, Docker, and Streamable HTTP options, see docs/installation.md.
Tools
Note: The server uses the
/StopPoint/Search/{query}endpoint internally to automatically resolve stop names to NaPTAN IDs for thearrivals,crowding, andfarestools.
MCP Apps UI
The service_status tool includes MCP Apps support as a progressive enhancement. UI-capable hosts (e.g. Claude Desktop) can render an interactive service status board alongside the text response. Non-UI hosts continue to receive the standard text output.
- The UI is self-contained (inline HTML/CSS, no external assets)
- Structured JSON data is returned alongside the text fallback
- No additional setup is required — host support is detected automatically
See docs/tools.md for full details.
Authentication
The MCPB and default container mode use stdio transport. The optional Streamable HTTP mode does not implement OAuth or any other server-side authentication; deploy it only behind an appropriate trusted access layer.
The TfL API uses a simple API key (TFL_APP_KEY) that you supply as an environment variable. A key is strongly recommended — without one, TfL applies strict rate limits that will impact most real-world usage. Registration is free. No OAuth flow, login, or account beyond the TfL portal is required to use this MCP server.
Configuration
An API key is strongly recommended — without one, TfL's strict rate limits will impact most real-world usage. Registration is free at api-portal.tfl.gov.uk.
Running from source
Node.js 22 or later is required. Install from the lockfile and build before starting the server.
That starts stdio transport. For stateless Streamable HTTP:
Connect an MCP 2026-07-28 client to http://127.0.0.1:8080/mcp. Set MCP_ALLOWED_HOSTS to a comma-separated hostname allowlist when serving under other hostnames.
For use with Claude Desktop, see docs/installation.md.
Testing
Unit tests use a mock HTTP server — no network access or API key required:
The Streamable HTTP acceptance tests are included in npm test. Run the official frozen MCP 2026-07-28 requirement set separately (optional extension probes outside that set are not scored):
The conformance fixture registers the real production TfL tools and resource through the shared modern-only HTTP adapter. It also adds test-only diagnostic tools, resources, prompts, and flows needed by the referee's hard-coded probes; those diagnostics are not exposed by the production entry point.
Contract tests call the live TfL API:
Build and smoke-test the packed npm CLI, MCPB, and container distributions with bash scripts/test-distributions.sh. The script skips container checks when Docker is unavailable.
Support
For questions, bug reports, or feature requests, please open an issue on GitHub Issues.
Privacy Policy
This MCP server acts as a local proxy between your AI assistant and the TfL Unified API. It does not collect, store, or transmit any personal data beyond what is required to forward your queries to TfL.
- Data collection: No analytics or telemetry is collected. Limited operational diagnostics are written to standard error but are not persisted by the server; a host may retain them under its own logging policy.
- Usage and storage: Queries are forwarded to TfL in real time and responses are returned immediately. No query history or results are persisted.
- Third-party sharing: Requests are forwarded to the TfL Unified API (
api.tfl.gov.uk). See TfL's privacy policy for how TfL handles API usage data. - Data retention: The server retains no data and holds no state between requests. Host-managed standard-error retention is outside the server's control.
- Contact: For privacy concerns, open an issue at https://github.com/oneill9/tfl-mcp-server/issues.
The full privacy policy is available at PRIVACY.md.
Compliance
This server has been reviewed for compliance with the Anthropic Software Directory Terms and Anthropic Software Directory Policy. See COMPLIANCE.md for the full compliance statement and maintainer commitments.
TfL API Reference
- Unified API: https://api.tfl.gov.uk/
- API Portal / Key Registration: https://api-portal.tfl.gov.uk/
- Swagger UI: https://api.tfl.gov.uk/swagger/ui/index.html
來源:README.md,提交 bbe1b96
工具
0版本歷史
1- v1.4.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分