{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/onebusaway-mcp-server</h1>\n  <p><b>Query stops, routes, real-time arrivals, vehicle positions, and schedules from OneBusAway transit APIs via MCP. STDIO or Streamable HTTP.</b>\n  <div>15 Tools • 2 Resources</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-0.1.14-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/onebusaway-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/onebusaway-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/onebusaway-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun->=1.3.0-blueviolet.svg?style=flat-square)](https://bun.sh/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/onebusaway-mcp-server/releases/latest/download/onebusaway-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=onebusaway-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvb25lYnVzYXdheS1tY3Atc2VydmVyIl0sImVudiI6eyJPTkVCVVNBV0FZX0FQSV9LRVkiOiJURVNUIn19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22onebusaway-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fonebusaway-mcp-server%22%5D%2C%22env%22%3A%7B%22ONEBUSAWAY_API_KEY%22%3A%22TEST%22%7D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n**Public Hosted Server:** [https://onebusaway.caseyjhand.com/mcp](https://onebusaway.caseyjhand.com/mcp)\n\n</div>\n\n---\n\n## Tools\n\n15 tools covering the full OneBusAway transit data surface — discovery, real-time operations, schedules, alerts, and block schedules:\n\n| Tool | Description |\n|:---|:---|\n| `onebusaway_list_agencies` | List all transit agencies on this OneBusAway instance with IDs, contact info, and geographic coverage |\n| `onebusaway_find_stops` | Find bus stops near a lat/lon within a configurable radius, optionally filtered by stop code |\n| `onebusaway_search_stops` | Search stops by name or code string to resolve a human-readable name to a stop ID |\n| `onebusaway_get_stop` | Fetch details for a specific stop by agency-prefixed ID |\n| `onebusaway_find_routes` | Find transit routes near a lat/lon, optionally filtered by name or number |\n| `onebusaway_search_routes` | Search routes by name or number to resolve a route short name to a route ID |\n| `onebusaway_get_route` | Fetch details for a specific route by agency-prefixed ID |\n| `onebusaway_list_routes_for_agency` | List all routes operated by an agency |\n| `onebusaway_get_arrivals` | Real-time arrivals and departures at a stop — GPS-tracked predictions, schedule deviation, vehicle positions, and active alerts |\n| `onebusaway_get_trip` | Real-time status and full stop sequence for an active trip |\n| `onebusaway_get_vehicles` | Real-time positions of all active vehicles for an agency, optionally filtered to one route |\n| `onebusaway_get_schedule_for_stop` | Full-day departure schedule for a stop by route and direction |\n| `onebusaway_get_schedule_for_route` | Full-day schedule for a route — all trips and stop sequences |\n| `onebusaway_get_alert` | Fetch full service alert detail by situation ID — summary, description, reason, affected stops/routes, consequence, and active time windows |\n| `onebusaway_get_block` | Fetch the full-day block schedule for a vehicle by block ID — all trips in order with stop times, useful for fleet tracking |\n\n### `onebusaway_find_stops`\n\nFind bus stops near a geographic location.\n\n- Configurable search radius (default 300m, max ~1600m before results degrade)\n- Optional stop code filter (the number printed on the sign, e.g. `75403`)\n- Returns stop ID, code, name, direction, served route IDs, and wheelchair boarding status\n- `limitExceeded` flag signals when more stops exist beyond the returned set\n- Stop IDs returned here feed directly into `onebusaway_get_arrivals`\n\n---\n\n### `onebusaway_get_arrivals`\n\nReal-time arrivals and departures at a stop.\n\n- Configurable time window (`minutesBefore`, `minutesAfter` — defaults 5/35)\n- `predicted` boolean distinguishes GPS-tracked estimates from schedule-only projections\n- Schedule deviation in seconds (positive = late, negative = early)\n- Vehicle position and stops-away count when available\n- Active service alert summaries included inline\n- `tripId` on each arrival feeds `onebusaway_get_trip` for vehicle tracking\n\n---\n\n### `onebusaway_get_trip`\n\nReal-time status and stop sequence for a specific trip.\n\n- Journey phase (`in_progress`, `layover_before`, `layover_during`)\n- Vehicle GPS position, heading, and schedule deviation\n- Full stop sequence with GTFS arrival/departure times and distance along trip\n- Optional `serviceDateMs` for looking up trips from a prior service day\n\n---\n\n### `onebusaway_get_vehicles`\n\nReal-time positions of all active vehicles for an agency.\n\n- Returns GPS coordinates, heading, schedule deviation, and current trip for every active vehicle\n- Optional `routeId` filter (applied client-side after fetching all agency vehicles)\n- Phase and `predicted` flag distinguish actively-reporting vehicles from stale entries\n\n---\n\n### `onebusaway_search_routes`\n\nSearch for routes by name or number across the instance.\n\n- Falls back gracefully: the Puget Sound instance returns 404 on the search endpoint — `onebusaway_find_routes` (lat/lon) or `onebusaway_list_routes_for_agency` are the alternatives\n- Error contract surfaces this with structured recovery hints\n\n---\n\n### `onebusaway_get_schedule_for_stop` and `onebusaway_get_schedule_for_route`\n\nStatic schedule lookups — full-day timetables without real-time data.\n\n- Date parameter (ISO 8601) defaults to today in the agency's timezone\n- `onebusaway_get_schedule_for_stop`: all departures grouped by route and direction, with trip IDs for follow-up calls\n- `onebusaway_get_schedule_for_route`: all trips for the route with full stop sequences and GTFS stop times\n\n## Resources\n\n| Type | Name | Description |\n|:---|:---|:---|\n| Resource | `onebusaway://stop/{stopId}` | Stop metadata — name, coordinates, served routes, and wheelchair accessibility |\n| Resource | `onebusaway://route/{routeId}` | Route metadata — short name, description, agency, and schedule URL |\n\nAll resource data is also reachable via `onebusaway_get_stop` and `onebusaway_get_route`. Stop and route IDs use agency-prefixed format: `{agencyId}_{localId}` (e.g. `1_75403`, `1_100259`).\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):\n\n- Declarative tool and resource definitions — single file per primitive, framework handles registration and validation\n- Unified error handling — handlers throw, framework catches, classifies, and formats\n- Pluggable auth: `none`, `jwt`, `oauth`\n- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`\n- Structured logging with optional OpenTelemetry tracing\n- STDIO and Streamable HTTP transports\n\nOneBusAway-specific:\n\n- Wraps [`onebusaway-sdk`](https://www.npmjs.com/package/onebusaway-sdk) with typed error classification (`NotFound`, `RateLimited`, `ServiceUnavailable`)\n- Defaults to the Puget Sound instance (`api.pugetsound.onebusaway.org`) — works with `ONEBUSAWAY_API_KEY=TEST` for development\n- Configurable `ONEBUSAWAY_BASE_URL` for any OneBusAway-compatible instance (NYC, Washington DC, Tampa, etc.)\n- Server-level instructions guide agents through stop ID format, recommended workflows, and OneBusAway's limitations (no trip planning)\n\nAgent-friendly output:\n\n- `predicted` boolean on every arrival and vehicle distinguishes GPS-tracked data from schedule-only projections — agents branch on data, not string parsing\n- Schedule deviation in seconds on arrivals, trips, and vehicle positions — structured for countdown timer math\n- Cross-tool linkage: `tripId` from arrivals feeds `onebusaway_get_trip`; `stopId` from searches feeds arrivals; `agencyId` from list feeds vehicles and route listing\n- Structured error contracts with recovery hints (`onebusaway_search_routes` 404 → fallback to `onebusaway_find_routes` or `onebusaway_list_routes_for_agency`)\n\n## Getting started\n\nAdd the following to your MCP client configuration file. `ONEBUSAWAY_API_KEY=TEST` works on the Puget Sound instance without registration.\n\n```json\n{\n  \"mcpServers\": {\n    \"onebusaway-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/onebusaway-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\",\n        \"ONEBUSAWAY_API_KEY\": \"TEST\"\n      }\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"onebusaway-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/onebusaway-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\",\n        \"ONEBUSAWAY_API_KEY\": \"TEST\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"onebusaway-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"-e\", \"ONEBUSAWAY_API_KEY=TEST\",\n        \"ghcr.io/cyanheads/onebusaway-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\nFor Streamable HTTP, set the transport and start the server:\n\n```sh\nMCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 ONEBUSAWAY_API_KEY=TEST bun run start:http\n# Server listens at http://localhost:3010/mcp\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).\n- An OneBusAway API key. `TEST` works on the Puget Sound instance for development. For production use or other instances, register at the relevant agency's developer portal.\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/onebusaway-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd onebusaway-mcp-server\n```\n\n3. **Install dependencies:**\n\n```sh\nbun install\n```\n\n4. **Configure environment:**\n\n```sh\ncp .env.example .env\n# edit .env — set ONEBUSAWAY_API_KEY if needed\n```\n\n## Configuration\n\nAll configuration is validated at startup via Zod schemas. Key environment variables:\n\n| Variable | Description | Default |\n|:---|:---|:---|\n| `ONEBUSAWAY_API_KEY` | OneBusAway API key. `TEST` works on Puget Sound for development. | `TEST` |\n| `ONEBUSAWAY_BASE_URL` | Base URL for the OneBusAway instance. | `https://api.pugetsound.onebusaway.org` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | HTTP server port. | `3010` |\n| `MCP_HTTP_ENDPOINT_PATH` | HTTP endpoint path. | `/mcp` |\n| `MCP_SESSION_MODE` | Session handling: `auto`, `stateful`, or `stateless`. | `stateless` |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_LOG_LEVEL` | Log level (`debug`, `info`, `notice`, `warning`, `error`). | `info` |\n| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |\n| `STORAGE_PROVIDER_TYPE` | Storage backend: `in-memory`, `filesystem`, `supabase`, `cloudflare-kv/r2/d1`. | `in-memory` |\n| `OTEL_ENABLED` | Enable OpenTelemetry instrumentation. | `false` |\n\nSee [`.env.example`](./.env.example) for the full list of optional overrides.\n\n## Running the server\n\n### Local development\n\n- **Build and run the production version:**\n\n  ```sh\n  # One-time build\n  bun run rebuild\n\n  # Run the built server\n  bun run start:http\n  # or\n  bun run start:stdio\n  ```\n\n- **Run checks and tests:**\n\n  ```sh\n  bun run devcheck   # Lint, format, typecheck, security, changelog sync\n  bun run test       # Vitest test suite\n  bun run lint:mcp   # Validate MCP definitions against spec\n  ```\n\n### Docker\n\n```sh\ndocker build -t onebusaway-mcp-server .\ndocker run --rm -e ONEBUSAWAY_API_KEY=TEST -p 3010:3010 onebusaway-mcp-server\n```\n\nThe 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.\n\n## Project structure\n\n| Directory | Purpose |\n|:---|:---|\n| `src/index.ts` | `createApp()` entry point — registers tools/resources and inits the OneBusAway service. |\n| `src/config/server-config.ts` | Server-specific env var parsing: `ONEBUSAWAY_API_KEY`, `ONEBUSAWAY_BASE_URL`. |\n| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`). 15 tools across discovery, real-time, and schedule operations. |\n| `src/mcp-server/resources` | Resource definitions (`*.resource.ts`). Stop and route metadata resources. |\n| `src/services/onebusaway` | OneBusAway service — wraps `onebusaway-sdk`, typed error classification, domain types. |\n| `tests/` | Unit and integration tests mirroring `src/`. 340 tests covering all tools and resources. |\n\n## Development guide\n\nSee [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage\n- Register new tools and resources in the `createApp()` arrays in `src/index.ts`\n- Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks and tests before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n## Data\n\nTransit data is sourced from the [Puget Sound OneBusAway API](https://api.pugetsound.onebusaway.org), operated by Sound Transit and King County Metro. Use of this data is governed by the [Sound Transit Transit Data Terms of Use](https://www.soundtransit.org/help-contacts/business-information/open-transit-data-otd/transit-data-terms-use).\n\nDownstream users of this server's hosted endpoint receive data subject to those terms. Key obligations include:\n\n- **Clause 2** — Usage metrics are available on request.\n- **Clause 3** — Data is fetched live from the OneBusAway API and is not modified or cached beyond the request cycle.\n- **Clause 4** — You agree to pass through substantially similar terms to any users you provide this data to.\n- **Clause 7** — This server does not use Sound Transit trademarks in its name or branding.\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 15265,
  "sha": "2997f2659ab6b41ff71ea883212febbd74e5047904c845151f48c87fe1447419",
  "repo_slug": "cyanheads/onebusaway-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_onebusaway_mcp_serve_ac507f7c/readme"
}