@cyanheads/onebusaway-mcp-server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Public Hosted Server: https://onebusaway.caseyjhand.com/mcp
Overview
Real-time transit from OneBusAway, set up for Puget Sound (King County Metro, Sound Transit, Pierce Transit, Community Transit, and more) and compatible with any OneBusAway instance. Find stops and routes, track live arrivals and vehicle positions, and pull schedules and service alerts.
Tools
Tool | Description |
| List the transit agencies on the instance, with IDs, contact info, and coverage area |
| Find stops near a lat/lon, optionally filtered by stop code |
| Resolve a stop name to a stop ID |
| Fetch one stop by ID |
| Find routes near a lat/lon, optionally filtered by name or number |
| Resolve a route name or number to a route ID |
| Fetch one route by ID |
| List every route an agency operates |
| Real-time arrivals and departures at a stop, with schedule deviation, vehicle positions, and active alerts |
| Stop details, real-time arrivals, and full detail for every alert at the stop, from one upstream request |
| Full service alert detail by situation ID |
| Real-time status and stop sequence for a trip |
| Every trip one vehicle runs in a service day, in order, with stop times |
| Real-time positions in a vehicle agency's namespace, optionally filtered by route |
| Full-day departure schedule for a stop, by route and direction |
| Full-day schedule for a route: every trip and its stop sequence |
Resources
Resource | Description |
| Stop metadata: name, coordinates, served routes, wheelchair accessibility |
| Route metadata: short name, description, agency, schedule URL |
The same data is available to tool-only clients through onebusaway_get_stop and onebusaway_get_route.
Related MCP server: otp-mcp
Capability reference
onebusaway_list_agencies tool
No input; returns agencies with IDs, contact info, timezones, coverage centers, and full coverage widths in degrees
limitExceededflags an upstream-capped list, with no pagination to fetch the rest
onebusaway_find_stops tool
latandlonare required. The radius defaults to 300 m and caps at 1600 m. The optionalquerymatches the stop code printed on the signEach stop carries
id,code,direction,wheelchairBoarding(ACCESSIBLE/NOT_ACCESSIBLE/UNKNOWN), allrouteIds, androuteswithid,shortName, andagencyIdwhere the response includes a matching referencelimitExceededflags upstream truncation
onebusaway_search_stops tool
query(stop name fragment) required;maxCountdefaults to 10 and caps at 3500. For a code from a stop sign, useonebusaway_find_stopswith the stop's approximate location and code asquerySame stop shape as
onebusaway_find_stops.limitExceededmeans OneBusAway reported more matching stops than it returned
onebusaway_get_stop tool
Single
stopId; returns the same stop record asonebusaway_find_stopsUnknown IDs fail as
stop_not_found, with recovery viaonebusaway_find_stopsoronebusaway_search_stops
onebusaway_find_routes tool
latandlonare required. The radius defaults to 500 m and caps at 1600 m. Set bothlatSpanandlonSpanfor a box search and omit the radius. The optionalqueryfilters by route name or numberEach route carries
shortName,longName,agencyId, GTFStype(0=tram … 5=cable_car),color, and scheduleurl;limitExceededmeans more routes exist in the area
onebusaway_search_routes tool
query(route name or number) required;maxCountdefaults to 10 and caps at 6000Returns
shortName,longName,agencyId, and GTFStype.limitExceededmeans OneBusAway reported more matching routes than it returnedSearch can return an empty list for a known route. Use
onebusaway_find_routesnear the service area oronebusaway_list_routes_for_agencyto check the agency's routes
onebusaway_get_route tool
Single
routeId; returnsshortName,longName,description, agency, GTFStype,color, and scheduleurlUnknown IDs fail as
route_not_found, with recovery viaonebusaway_find_routesoronebusaway_list_routes_for_agency
onebusaway_list_routes_for_agency tool
agencyIdrequired; unknown agencies fail asagency_not_foundEvery route with
shortName,longName, GTFStype,color, andurl;limitExceededflags an upstream-capped list with no pagination
onebusaway_get_arrivals tool
stopIdis required. The window uses nonnegative integers forminutesBefore(default 5, cap 60) andminutesAfter(default 35, cap 240). For later departures, useonebusaway_get_schedule_for_stopCompare
predictedArrivalTimewithscheduledArrivalTimefor deviation at the stop.scheduleDeviationis the vehicle's current deviation in seconds, positive when late and meaningful whenpredictedis truestopsAwayis the queried stop's block sequence minus the vehicle's next stop block sequence. Zero can also mean unavailableActive alerts arrive in
situations[]: those on the stop itself plus those linked from each arrival'ssituationIds, each once
onebusaway_get_stop_context tool
Same input as
onebusaway_get_arrivals, and the samestop_not_found/rate_limitedfailures; one call issues one upstream requestReturns
stop(theonebusaway_get_stopfields withoutrouteIdsandroutes),arrivalsin theonebusaway_get_arrivalsshape, andalertsin theonebusaway_get_alertshape, including stop-wide alertsWhen the upstream response omits the stop,
stopis null; a referenced alert missing from the response is left out; either way anoticenames the tool to fetch it with
onebusaway_get_alert tool
Single
situationId, fromonebusaway_get_arrivals(situations[].idorarrivals[].situationIds); unknown IDs fail assituation_not_foundReturns a TPEG
reasoncode,severity,consequenceMessage,affects(agency, route, stop, or trip scope),consequenceswith diversion stop IDs, andactiveWindows
onebusaway_get_trip tool
tripIdrequired;serviceDateMs(non-negative integer, midnight local) only for a trip on a previous service day;includeSchedule(default true) adds the stop sequence with GTFS times anddistanceAlongTripMetersWhen present,
status.activeTripIdidentifies the trip the live status describes, andstatus.blockTripSequencegives its sequence within the block when available. The top-leveltripIdandschedulerefer to the requested trip. Use a non-nullblockIdwithonebusaway_get_blockFails as
trip_not_foundwhen the trip isn't active for the service date; a completed trip's times come fromonebusaway_get_schedule_for_route
onebusaway_get_block tool
Single
blockId, fromonebusaway_get_trip; unknown IDs fail asblock_not_foundTop-level
trips,activeServiceIds, andinactiveServiceIdsdescribe the first returned configuration;alternateConfigurationspreserves every remaining configuration in order. Service IDs are calendar conditions, not a claim that a configuration operates todayEach trip carries
distanceAlongBlock,accumulatedSlackTime(layover seconds), andblockStopTimes. Optional exacttripIdordepartureFromSec/departureBeforeSecselects complete trips independently in every configuration, retaining empty configuration slotsWith selectors,
selection.total/returnedcount trip occurrences across configurations;configurationCounts[0]describes the top-level configuration, then one entry per alternative
Example: {"blockId":"<blockId from onebusaway_get_trip>","departureFromSec":86400,"departureBeforeSec":90000} selects trips with any departure from 24:00 inclusive to 25:00 exclusive, retaining their complete stop sequences.
onebusaway_get_vehicles tool
agencyIdis the vehicle ID's agency namespace. Use the prefix of a knownvehicleIdfrom an arrival or trip. A route's operating agency can differ. The optionalrouteIdfilters that namespace's results by exact route IDEach vehicle carries
position,orientation,phase,scheduleDeviation,tripId,nextStop, andpredicted(reporting real-time GPS);limitExceededflags an upstream-capped list with no paginationtripIdprefers the active trip; route and headsign metadata resolve only from that trip.orientationpreserves counter-clockwise degrees from east (0=east, 90=north, 180=west, 270=south), not a compass bearingRecords missing latitude or longitude are skipped:
omittedWithoutPositioncounts them across the agency, andomittedWithoutPositionOnRoutecounts resolved matches when filtering by route. These counts are independent of upstream truncation
onebusaway_get_schedule_for_stop tool
stopIdrequired; optionaldateas a realYYYY-MM-DDcalendar date, default (omitted or blank) today in the agency's timezone; unknown stops fail asstop_not_foundDepartures grouped by route and direction, each with
scheduledDepartureTimeandtripIdserviceDateMspreserves the upstream schedule-date marker: query time for an omitted/blank date, instance-local midnight for an explicit date; it is not rounded to a service-day boundaryOptional
routeId,departureFromMs, anddepartureBeforeMscombine with AND; time bounds are non-negative integer Unix milliseconds, lower inclusive and upper exclusive. Selected results omit empty directions/routes;selection.total/returnedcount departure rows before/after selectionStatic schedule only; live predictions come from
onebusaway_get_arrivals
Example: {"stopId":"1_75403","routeId":"1_100259","departureFromMs":1792882800000,"departureBeforeMs":1792886400000} selects that route's departures in the given epoch interval.
onebusaway_get_schedule_for_route tool
routeIdrequired; optionaldateas a realYYYY-MM-DDcalendar date, default (omitted or blank) today; unknown routes fail asroute_not_foundEvery trip that day with
tripId,tripHeadsign,serviceId, and its stop sequenceserviceDateMspreserves the upstream routescheduleDate, identifying the schedule's service dayRoute, stop, headsign, and service metadata resolve from references first, retaining legacy metadata and grouping fallbacks where reference fields are absent or empty
Optional exact
tripIdordepartureFromSec/departureBeforeSecselects whole trips having any departure in the interval. Bounds are non-negative integer GTFS seconds from midnight, including values beyond 86400; lower inclusive, upper exclusive.selection.total/returnedcount trips before/after selectionStatic schedule only; live predictions come from
onebusaway_get_arrivalsat a stop
Example: {"routeId":"1_100259","departureFromSec":28800,"departureBeforeSec":32400} selects trips with any departure from 08:00 inclusive to 09:00 exclusive.
For route and block schedules, a nonblank tripId cannot be combined with departure bounds. Blank optional IDs mean omitted; either bound may be omitted, and two supplied bounds must increase. Without selectors, all three tools return their complete mapped response with no selection metadata or default cap. Selection counts describe only that upstream response, not omitted upstream service; a zero match is a successful result with a notice.
Arrivals, stop context, trips, vehicles, schedules, and alerts include a validated IANA timezone; epoch clocks and date headings carry that zone explicitly. Stop tools use the queried stop's agency namespace, vehicles the requested agency, and trip/route schedules the referenced route's agency. Each alert resolves its own agency, route, trip, and stop scopes and uses their zone only when every scope resolves and agrees. Missing, invalid, unresolved, or conflicting zones use UTC, without additional requests. Epoch numbers and GTFS seconds remain unchanged, including schedule times beyond 24:00.
onebusaway://stop/{stopId} resource
Stop record as
application/json, the same shapeonebusaway_get_stopreturnsstopIdcomes fromonebusaway_find_stopsoronebusaway_search_stops
onebusaway://route/{routeId} resource
Route record as
application/json, the same shapeonebusaway_get_routereturnsrouteIdcomes fromonebusaway_find_routesoronebusaway_list_routes_for_agency
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.
OneBusAway-specific:
Wraps
onebusaway-sdkwith typed error classification (NotFound,RateLimited,ValidationErrorfor an upstream 400,ServiceUnavailable)Defaults to the Puget Sound instance (
api.pugetsound.onebusaway.org), whereONEBUSAWAY_API_KEY=TESTworks for development;ONEBUSAWAY_BASE_URLpoints it at any other OneBusAway instanceStop and route IDs are agency-prefixed,
{agencyId}_{localId}(stop1_75403, route1_100259). Pass raw IDs from the configured instance as tool arguments. Resource URIs accept URI encoding for their ID segmentOne shared pacer, sized by
ONEBUSAWAY_RATE_LIMIT_*, queues every upstream request against the API key's budget; a call that gets no slot within the wait cap fails as retryablerate_limitedwithdata.retryAfter, on any toolTransit data only, no trip planning; server-level instructions walk agents through the ID format and the common lookup chains
Agent-friendly output:
predictedon every arrival, trip, and vehicle separates GPS-tracked data from schedule-only projectionsMachine-readable times:
scheduleDeviationin seconds; arrival, stop-schedule, and update timestamps in Unix milliseconds; trip, route-schedule, and block stop times in GTFS seconds from midnightChainable IDs:
stopIdfrom the stop tools feeds arrivals,tripIdfeedsonebusaway_get_trip,blockIdfeedsonebusaway_get_block,situationIdsfeedonebusaway_get_alert, andagencyIdfeeds vehicles and route listingTyped error contracts whose recovery hints name the next tool to call, plus a
noticeon empty or truncated results
Getting started
Public Hosted Instance
A public instance is available at https://onebusaway.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"onebusaway-mcp-server": {
"type": "streamable-http",
"url": "https://onebusaway.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file. ONEBUSAWAY_API_KEY=TEST works on the Puget Sound instance without registration.
{
"mcpServers": {
"onebusaway-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/onebusaway-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"ONEBUSAWAY_API_KEY": "TEST"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"onebusaway-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/onebusaway-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"ONEBUSAWAY_API_KEY": "TEST"
}
}
}
}Or with Docker:
{
"mcpServers": {
"onebusaway-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "ONEBUSAWAY_API_KEY=TEST",
"ghcr.io/cyanheads/onebusaway-mcp-server:latest"
]
}
}
}For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 ONEBUSAWAY_API_KEY=TEST bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
Bun v1.4.4 or higher (or Node.js v24+).
A OneBusAway API key.
TESTworks on the Puget Sound instance for development; for production use or other instances, register at the relevant agency's developer portal.
Installation
Clone the repository:
git clone https://github.com/cyanheads/onebusaway-mcp-server.gitNavigate into the directory:
cd onebusaway-mcp-serverInstall dependencies:
bun installConfigure environment:
cp .env.example .env
# edit .env — set ONEBUSAWAY_API_KEY if neededConfiguration
Variable | Description | Default |
| OneBusAway API key. |
|
| Base URL of the OneBusAway instance. |
|
| Apply the documented caps to over-limit search counts, radii, and arrival windows. Each reduction reports the requested and applied values. Set |
|
| Upstream requests allowed per window, shared by all callers. |
|
| Width of the sliding rate window, in ms. |
|
| Longest a call waits for a slot before failing as |
|
| Transport: |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level ( |
|
| Directory for log files. Relative paths resolve inside the server package. Use an absolute path to write elsewhere. |
|
| Storage backend: |
|
| Enable OpenTelemetry. |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
Build and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:http # or bun run start:stdioRun checks and tests:
bun run devcheck # Lint, format, typecheck, security, changelog sync bun run test # Vitest test suite bun run test:coverage # Test suite with coverage, held to the framework thresholds bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t onebusaway-mcp-server .
docker run --rm -e ONEBUSAWAY_API_KEY=TEST -p 3010:3010 onebusaway-mcp-serverThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/onebusaway-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Directory | Purpose |
|
|
| Server-specific env var parsing and validation with Zod. |
| Tool definitions ( |
| Stop and route resource definitions ( |
| OneBusAway service: wraps |
| Vitest tests for the tools, resources, service, and config. |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageRegister new tools and resources in the
createApp()arrays insrc/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
Transit data from the default Puget Sound OneBusAway API, operated by Sound Transit and King County Metro, is governed by the Sound Transit Transit Data Terms of Use, and users of the hosted endpoint receive it under those terms. Key obligations:
Clause 2: usage metrics are available on request.
Clause 3: data is fetched live from the OneBusAway API and is not modified or cached beyond the request cycle.
Clause 4: you agree to pass substantially similar terms through to any users you provide this data to.
Clause 7: this server does not use Sound Transit trademarks in its name or branding.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query SEC EDGAR filings, XBRL financials, and company data via MCP. STDIO or Streamable HTTP.
Streamable HTTP MCP gateway for NV oOS fleets — one API key, namespaced tools, quotas and policy.
Swiss Transport MCP — wraps Transport Open Data API (free, no auth)
NJ Transit rail, bus and PATH schedules via MCP (scheduled, plus live PATH)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with the Opiny API through MCP, supporting both local STDIO and remote HTTP Stream transports.ISC
- AlicenseAqualityDmaintenanceEnables querying self-hosted OpenTripPlanner for accurate transit routes via MCP, supporting both stdio and HTTP.3MIT
- AlicenseNot gradedqualityBmaintenanceExposes the FBI Crime Data Explorer API — crime estimates, agency offense rates, and LEOKA officer safety data via MCP. Supports STDIO or Streamable HTTP transport.165 npm2Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables querying real-time BART and SF Muni transit data, including departures, trip planning, fares, advisories, routes, alerts, vehicle positions, and schedules, from any MCP-compatible client.1MIT