Transitland Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.2.0更新於 Oct 24, 2026

Global transit via Transitland v2 — operators, GTFS/GTFS-RT/GBFS feeds, routes, stops, departures.

已驗證STDIO僅桌面位置與生活資料與分析

概覽

AI 產生的概覽

以 Transitland v2 為基礎的 MCP 伺服器,讓助理查詢全球大眾運輸營運單位、GTFS/GTFS-RT/GBFS 資料來源、路線、站點與即時發車資訊。

可以做什麼
  • 依名稱、點半徑、邊界框、國家/地區或 Onestop ID 尋找並取得營運單位紀錄,含下屬機構與來源標籤
  • 探索 GTFS、GTFS-Realtime 與 GBFS 資料來源,回傳抓取網址、資料新鮮度與各來源的授權條款
  • 依地理位置、營運單位、Onestop ID 或名稱尋找路線與站點,含運具類型、無障礙資訊與時區
  • 取得某站點的發車資訊,逐筆標示為即時預測或表定時刻,並附延誤、終點方向與時刻表關係
  • 以 Onestop ID 為鍵,將營運單位與資料來源紀錄當作資源讀取
適用情境
適合需要全球公共運輸基礎資料的情境:確認某地區由哪個營運單位或資料來源涵蓋、核對路線與站點資訊,或結合即時狀態回答近期發車問題。它不做地理編碼,須先將地名解析為座標。
執行需求
以 stdio 在本機執行(npx、bunx 或 Docker),也可作為 Streamable HTTP 服務執行。需要 Bun v1.4.0+ 或 Node.js v24+、連線至 Transitland REST API 的網路,以及必填的 TRANSITLAND_API_KEY(以 apikey 查詢參數送出);免費額度有速率限制。其餘選用變數涵蓋傳輸方式、連接埠、驗證模式、日誌與儲存。
安裝前請注意
TRANSITLAND_API_KEY 是必填密鑰,透過環境變數傳入並以查詢參數送出,請勿寫入共用設定。使用 Transitland 資料須明顯顯示 Transitland 名稱並連結其條款,且各來源資料可能有各自的授權與署名要求,重新散布前須逐一確認。選用的失敗承載日誌可能記錄工具參數與結果。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Transitland Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@cyanheads/transitland-mcp-server

Global transit data from the Transitland v2 registry — operators, GTFS/GTFS-RT/GBFS feeds with license terms, routes, stops, and real-time-aware departures via MCP. STDIO or Streamable HTTP.

6 Tools • 2 Resources


Overview

Transit data for thousands of operators worldwide from Transitland, the open aggregator of GTFS, GTFS-Realtime, and GBFS feeds. Find operators and their feeds, and look up routes, stops, and real-time departures.

Tools

ToolDescription
transitland_find_operatorsFind transit operators/agencies by name, point/radius, bounding box, country/region, or Onestop ID
transitland_get_operatorFetch the full operator record by Onestop ID — agencies, feeds, and source tags
transitland_find_feedsDiscover GTFS, GTFS-Realtime, and GBFS feeds — fetch URLs, license terms, and freshness
transitland_find_routesFind routes by point/radius, bounding box, operator, Onestop ID, or GTFS mode
transitland_find_stopsFind stops/stations by name, point/radius, bounding box, Onestop ID, or operator network
transitland_get_departuresDepartures from a stop, each flagged realtime true/false

Transitland does not geocode place names — resolve a location to coordinates with a geocoding MCP server (e.g. openstreetmap-mcp-server's openstreetmap_geocode) before calling a geography-filtered tool.

Resources

ResourceDescription
transitland://operator/{onestop_id}Operator record by Onestop ID — agencies, places served, published feeds, and source tags
transitland://feed/{onestop_id}Feed record by Onestop ID — spec, fetch URL, license terms, and freshness

All resource data is also reachable via tools (transitland_get_operator, transitland_find_feeds).

Capability reference

Page limits default to 20 and are capped at 100. A larger limit is clamped with a notice, and truncated, shown, and cap appear when a page hits the limit. Use the returned after cursor to continue.

transitland_find_operators tool

  • Filter by search (name), lat+lon+radius (max 100,000m, default 1,000m), bbox, onestop_id, or adm0_name/adm1_name (country/region) — at least one required, or the call fails as no_filter
  • lat requires lon and vice versa, or the call fails as incomplete_point
  • Returns each operator's Onestop ID, name, places served, published feeds (a GTFS_RT entry signals real-time departures may be available), and Wikidata QID

transitland_get_operator tool

  • Accepts an Onestop ID (e.g. o-9q9-bart) or an internal integer ID
  • Returns agencies (each with places served), published feeds, and source tags: Wikidata QID, US NTD ID, general Twitter/X handle
  • operator_not_found when the ID doesn't resolve

transitland_find_feeds tool

  • Filter by operator_onestop_id (from transitland_find_operators), spec (gtfs/gtfs-rt/gbfs/mds; case and underscore/hyphen variants such as GTFS_RT are accepted), search, or fetch_error — at least one required
  • Each feed returns its fetch URL, real-time endpoints, freshness (last fetch, content hash, calendar window covered), and license terms — redistribution, commercial use, derived products, and attribution as yes/no/unknown, never inferred from a blank field — plus SPDX identifier and attribution text where known
  • authorizationRequired flags feeds whose download needs a separate key or registration

transitland_find_routes tool

  • Filter by lat+lon+radius (max 50,000m, default 1,000m), bbox, operator_onestop_id, onestop_id, route_type (GTFS mode integer), or search — at least one required
  • lat requires lon and vice versa, or the call fails as incomplete_point
  • Returns short/long name, GTFS mode (bus, subway, rail, ferry, tram, …), brand color, and the operating agency's and source feed's Onestop IDs. A missing route type is null with mode unknown
  • Scheduled (GTFS static) route definitions, not live vehicle positions

transitland_find_stops tool

  • Filter by lat+lon+radius (max 10,000m, default 500m), bbox, onestop_id, served_by_onestop_ids (comma-separated operator/route Onestop IDs), or stop-name search — at least one required. Name searches need no geocoding
  • Returns coordinates (null when missing upstream), location_type with a label (stop, station, entrance, node, boarding area), wheelchair accessibility, timezone, and the parent station's Onestop ID for child platforms
  • Departures attach to platform-level stops (location_type 0) — a station may return none, so use its child platforms

transitland_get_departures tool

  • Resolve a stop to its Onestop ID with transitland_find_stops first; stop_not_found when it doesn't resolve. next_seconds sets the look-ahead window: 60–86,400 (default 3,600) — widen it or set use_service_window: true when a stop returns nothing
  • Every departure carries a realtime flag (true for a live GTFS-Realtime prediction, false for a scheduled time) and a scheduleRelationship (STATIC, SCHEDULED, ADDED, CANCELED, UNSCHEDULED, DUPLICATED)
  • Also returns scheduled and estimated times with delay in seconds, route, headsign, mode, trip, direction, and accessibility; top-level realtimeAvailable reports whether the stop's feed publishes GTFS-RT at all

transitland://operator/{onestop_id} resource

  • Mirrors transitland_get_operator — agencies, places served, published feeds, and source tags
  • onestop_id accepts an Onestop ID (e.g. o-9q9-bart) or internal integer ID; operator_not_found when it doesn't resolve

transitland://feed/{onestop_id} resource

  • Mirrors a single-feed result from transitland_find_feeds — spec, fetch URL, real-time endpoints, license terms, and freshness
  • onestop_id accepts a feed Onestop ID (e.g. f-9q9-bart) or internal integer ID; feed_not_found when it doesn't resolve
  • Blank license fields come back as unknown/null, never inferred as permissive

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

Transitland-specific:

  • Direct HTTP client for the Transitland v2 REST API — no SDK dependency, a flat query-param contract over a handful of GET endpoints
  • Onestop IDs (o-/f-/r-/s-) are the identifier spine — surfaced in every result, accepted on input alongside internal integer IDs
  • Feed lookups return only the latest feed version's freshness, not the full fetch history
  • Coverage polygons and route/stop geometry are omitted; results carry a compact country/region/city place summary instead

Agent-friendly output:

  • Real-time status is explicit: per-departure realtime and scheduleRelationship, plus a top-level realtimeAvailable
  • Blank license fields come back as unknown/null, never inferred as permissive, and agents are told to confirm against the license URL before redistributing
  • Upstream pagination URLs embed the API key; only the opaque after cursor is surfaced, so the key never reaches tool output or logs
  • Empty results return an actionable notice (geocode first, widen the window, try a child platform) rather than an error

Getting started

Add the following to your MCP client configuration file. A Transitland API key is required — see Prerequisites for how to get one.

json
{  "mcpServers": {    "transitland-mcp-server": {      "type": "stdio",      "command": "bunx",      "args": ["@cyanheads/transitland-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info",        "TRANSITLAND_API_KEY": "your-api-key"      }    }  }}

Or with npx (no Bun required):

json
{  "mcpServers": {    "transitland-mcp-server": {      "type": "stdio",      "command": "npx",      "args": ["-y", "@cyanheads/transitland-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info",        "TRANSITLAND_API_KEY": "your-api-key"      }    }  }}

Or with Docker:

json
{  "mcpServers": {    "transitland-mcp-server": {      "type": "stdio",      "command": "docker",      "args": [        "run", "-i", "--rm",        "-e", "MCP_TRANSPORT_TYPE=stdio",        "-e", "TRANSITLAND_API_KEY=your-api-key",        "ghcr.io/cyanheads/transitland-mcp-server:latest"      ]    }  }}

For Streamable HTTP, set the transport and start the server:

sh
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 TRANSITLAND_API_KEY=your-api-key bun run start:http# Server listens at http://localhost:3010/mcp

Prerequisites

Installation

  1. Clone the repository:
sh
git clone https://github.com/cyanheads/transitland-mcp-server.git
  1. Navigate into the directory:
sh
cd transitland-mcp-server
  1. Install dependencies:
sh
bun install
  1. Configure environment:
sh
cp .env.example .env# edit .env and set TRANSITLAND_API_KEY

Configuration

All configuration is validated at startup via Zod schemas in src/config/server-config.ts. A missing TRANSITLAND_API_KEY fails at startup with a banner naming the variable, not at the first tool call.

VariableDescriptionDefault
TRANSITLAND_API_KEYRequired. Transitland v2 API key, sent as the apikey query parameter.—
TRANSITLAND_BASE_URLTransitland REST API base URL. Override to pin a specific deployment or a self-hosted instance.https://transit.land/api/v2/rest
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for the HTTP server.3010
MCP_HTTP_ENDPOINT_PATHHTTP endpoint path where the MCP server is mounted./mcp
MCP_AUTH_MODEAuthentication mode: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (debug, info, notice, warning, error).info
LOGS_DIRDirectory for log files (Node.js only).<project-root>/logs
LOG_TOOL_FAILURE_PAYLOADSLog failed calls' arguments and result, redacted by key name (secrets in free-form values remain). Size capped by LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES (default 16384).false
STORAGE_PROVIDER_TYPEStorage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1.in-memory
OTEL_ENABLEDEnable OpenTelemetry instrumentation (spans, metrics, completion logs).false

See .env.example for the full list of optional overrides.

HTTP sessions are stateless by default; set MCP_SESSION_MODE to override.

Running the server

Local development

  • Build and run:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:stdio# orbun run start:http
  • Run checks and tests:

    sh
    bun run devcheck   # Lint, format, typecheck, security, changelog syncbun run test       # Vitest test suitebun run lint:mcp   # Validate MCP definitions against spec

Docker

sh
docker build -t transitland-mcp-server .docker run --rm -e TRANSITLAND_API_KEY=your-key -p 3010:3010 transitland-mcp-server

The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/transitland-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools and resources, inits the Transitland service.
src/configServer-specific environment variable parsing and validation with Zod.
src/mcp-server/toolsTool definitions (*.tool.ts). Six tools across operators, feeds, routes, stops, and departures.
src/mcp-server/resourcesResource definitions (*.resource.ts). Operator and feed records.
src/services/transitlandTransitland v2 REST client — HTTP, apikey injection, cursor normalization, error classification, and per-endpoint typed methods.
tests/Unit and integration tests mirroring src/.

Development guide

See CLAUDE.md / AGENTS.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging, ctx.state for tenant-scoped storage
  • Register new tools and resources via the barrels in src/mcp-server/*/definitions/index.ts
  • Wrap the Transitland API: validate raw → normalize to domain type → return output schema; never fabricate missing fields (especially license terms — blanks are unknown, not permissive)

Data & licensing

Transit data is provided by Transitland — an open registry aggregating GTFS, GTFS-Realtime, and GBFS feeds from thousands of operators worldwide. Products built on Transitland data must display the name "Transitland" with a link to transit.land/terms, clearly visible to end users.

Transitland aggregates feeds from thousands of operators, each of which may carry its own license and attribution requirements. Review the per-feed license terms at transit.land/terms and comply with each source feed's requirements before redistributing or publishing data obtained through this server.

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

Apache-2.0 — see LICENSE for details.

來源:README.md,提交 81110a2

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

4
  1. v0.2.0最新Oct 13, 2026
  2. v0.1.3Oct 7, 2026
  3. v0.1.2Sep 21, 2026
  4. v0.1.1Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分