
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.
概览
基于 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 查询参数发送);免费额度有速率限制。其余可选变量涉及传输方式、端口、认证模式、日志和存储。
安装
在 SourceWeft 中
- 打开 控制台中的 Transitland Mcp Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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.
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
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
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, oradm0_name/adm1_name(country/region) — at least one required, or the call fails asno_filter latrequireslonand vice versa, or the call fails asincomplete_point- Returns each operator's Onestop ID, name, places served, published feeds (a
GTFS_RTentry 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_foundwhen the ID doesn't resolve
transitland_find_feeds tool
- Filter by
operator_onestop_id(fromtransitland_find_operators),spec(gtfs/gtfs-rt/gbfs/mds; case and underscore/hyphen variants such asGTFS_RTare accepted),search, orfetch_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 authorizationRequiredflags 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), orsearch— at least one required latrequireslonand vice versa, or the call fails asincomplete_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
nullwith modeunknown - 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-namesearch— at least one required. Name searches need no geocoding - Returns coordinates (
nullwhen missing upstream),location_typewith 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_type0) — a station may return none, so use its child platforms
transitland_get_departures tool
- Resolve a stop to its Onestop ID with
transitland_find_stopsfirst;stop_not_foundwhen it doesn't resolve.next_secondssets the look-ahead window: 60–86,400 (default 3,600) — widen it or setuse_service_window: truewhen a stop returns nothing - Every departure carries a
realtimeflag (truefor a live GTFS-Realtime prediction,falsefor a scheduled time) and ascheduleRelationship(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
realtimeAvailablereports 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_idaccepts an Onestop ID (e.g.o-9q9-bart) or internal integer ID;operator_not_foundwhen 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_idaccepts a feed Onestop ID (e.g.f-9q9-bart) or internal integer ID;feed_not_foundwhen 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
realtimeandscheduleRelationship, plus a top-levelrealtimeAvailable - 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
aftercursor 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.
Or with npx (no Bun required):
Or with Docker:
For Streamable HTTP, set the transport and start the server:
Prerequisites
- Bun v1.4.0 or higher (or Node.js v24+).
- A Transitland v2 API key — register at the Transitland developer portal. The free tier is rate-limited; the Pro tier raises the quota.
Installation
- Clone the repository:
- Navigate into the directory:
- Install dependencies:
- Configure environment:
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.
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:
-
Run checks and tests:
Docker
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
Development guide
See CLAUDE.md / AGENTS.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor request-scoped logging,ctx.statefor 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:
License
Apache-2.0 — see LICENSE for details.
来源:README.md,提交 81110a2
工具
0版本历史
4- v0.2.0最新Oct 13, 2026
- v0.1.3Oct 7, 2026
- v0.1.2Sep 21, 2026
- v0.1.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分