Skip to main content
Glama

OpenBusData MCP Server

mcp-name: io.github.AndrewAubury/openbusdata

MCP server for the UK Bus Open Data Service with rich timetable parsing, stop search, route discovery, journey planning and real-time bus tracking.

Features

  • Live API tools — query timetables, fares, disruptions, cancellations and real-time bus locations

  • Coverage tools — departures board, live ETA at a stop, filtered live buses, disruption-aware journey planning, and fares price extraction

  • Stop search — fuzzy text search across every bus stop in the UK

  • Route finder — discover all routes serving a pair of stops

  • Journey planner — "get to X by Y o'clock" with support for direct and chained multi-leg journeys

  • Live tracking — see exactly where buses are right now

Related MCP server: BVG MCP Server

Installation

Option 1: via uvx (recommended — no install needed)

uvx openbusdata-mcp

Option 2: via pip

pip install openbusdata-mcp
docker build -f Dockerfile.image -t openbusdata-mcp:latest .

# The named volume persists the SQLite timetable index across container
# restarts — first bootstrap downloads ~940 datasets, after that startup is
# instant with no re-download.
docker run -i --rm \
  -e OPENBUS_API_KEY \
  -v openbusdata-cache:/root/.cache/openbusdata \
  openbusdata-mcp

Configuration

Set your Bus Open Data Service API key as an environment variable:

export OPENBUS_API_KEY="your-api-key-here"

Get a free key at data.bus-data.dft.gov.uk.

Usage

With uvx (recommended)

Add to your MCP client (Claude Desktop, Cursor, etc.):

{
  "mcpServers": {
    "openbusdata": {
      "command": "uvx",
      "args": ["openbusdata-mcp"],
      "env": {
        "OPENBUS_API_KEY": "your-api-key-here"
      }
    }
  }
}

With pip install

{
  "mcpServers": {
    "openbusdata": {
      "command": "openbusdata-mcp",
      "env": {
        "OPENBUS_API_KEY": "your-api-key-here"
      }
    }
  }
}

With Docker

{
  "mcpServers": {
    "openbusdata": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "OPENBUS_API_KEY",
               "-v", "openbusdata-cache:/root/.cache/openbusdata",
               "openbusdata-mcp"],
      "env": {
        "OPENBUS_API_KEY": "your-api-key-here"
      }
    }
  }
}

For the full ops detail — initial bootstrap (~940 datasets), scheduled delta refreshes, key rotation and verification — see docs/RUNBOOK.md.

Development

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows

# Install in editable mode with test dependencies
pip install -e ".[dev]"

# Run the test suite
pytest

# Run server
python -m openbusdata_mcp.server

License

MIT

Available Tools

22 tools
Data_set_api_v1_fares_datasetC

Returns all fares datasets

Parameters: noc: Operators can operate using a single National Operator Code (NOC) or have multiple NOCs associated. Download the data catalogue to see the relationship between operators and NOCs within the service. To limit results to operators associated with multiple NOCs, input a comma separated list of the relevant NOCs. status: Limit results to data sets with the specified status string, accepted values are published, inactive. boundingBox: Limit results to fares data sets that contain information for the area within the rectangular boundingBox you set using co-ordinates. [minLatitude, maxLatitude, minLongitude, maxLongitude]. The default values shown are for the Liverpool area. limit: The maximum number of records to return. The default value shown is 25. offset: Return results that match the query starting from the specified offset. e.g. If the offset=10 and limit=25, then results from 11 to 35 will be returned The default value shown is 0.

Inputs: kwargs (required). Returns: result

Data_set_api_v1_fares_dataset_by_datasetIDB

Returns a single dataset

Parameters: datasetID (required): Limit results to a specific data set of a publisher using the data set ID.

Inputs: kwargs (required). Returns: result

estimate_live_etaA

Estimate when live buses on a route will reach a stop. Each vehicle is matched to its nearest stop on the timetable route; the ETA is the schedule offset from that position (or, when the next service hasn't reached the vehicle's position yet, its scheduled arrival). Honest estimation, not prediction: it assumes vehicles run to schedule from their matched position. Route stop lists are direction-merged and past-midnight times compare as published.

Parameters: stop: Target stop (NaPTAN code or name). operator_ref: Operator NOC code (e.g. ARHE), or the operator name as it appears in the timetable index. The two are resolved to the same route; the NOC is what reaches the live feed. line_ref: Route number. day: Optional day filter: mon, tue, wed, thu, fri, sat, sun. Defaults to today.

Inputs: stop (required), line_ref (required), operator_ref (required), day. Returns: result

find_buses_by_arrival_timeA

Find scheduled buses that board at stop_a and arrive at stop_b by the given time.

Parameters: stop_a: Boarding stop (NaPTAN code or name). stop_b: Alighting stop (NaPTAN code or name). arrive_by: Target arrival time (HH:MM, 24h format). day: Optional day filter: mon, tue, wed, thu, fri, sat, sun. Defaults to today.

Inputs: stop_a (required), stop_b (required), arrive_by (required), day. Returns: result

find_routes_between_stopsA

Find all bus routes that serve BOTH of the given stops. Stops can be specified by NaPTAN code or by name.

Parameters: stop_a: First stop (NaPTAN code or name substring). stop_b: Second stop (NaPTAN code or name substring).

Inputs: stop_a (required), stop_b (required). Returns: result

get_cancellationsA

Get published operator cancellations (SIRI-SX /cancellations) as structured JSON. Filtering is client-side and exact-match.

Parameters: operator: Optional operator NOC code (exact match). line: Optional line/route number (exact match).

Inputs: line, operator. Returns: result

get_departures_boardA

Get the next scheduled departures at a stop (a departures board).

Parameters: stop: Stop (NaPTAN code or name). day: Optional day filter: mon, tue, wed, thu, fri, sat, sun. Defaults to today. from_time: Optional start time HH:MM (24h). Defaults to now. limit: Max departures to return (1-50, default 20).

Inputs: stop (required), day, limit, from_time. Returns: result

get_disruptionsA

Get active SIRI-SX disruption messages as structured JSON, optionally filtered (client-side — the endpoint itself accepts no query parameters).

Parameters: operator: Optional operator NOC code. Matched by EXACT membership of the message's operator refs — not a substring, so "OPX" matches a message carrying OPX and nothing else does. line: Optional line/route number, matched by exact membership of the message's line refs. stop: Optional NaPTAN stop ref, matched by exact membership of the message's stop point refs.

Inputs: line, stop, operator. Returns: result

get_fare_pricesA

Download a BODS fares dataset (NeTEx) and extract its published fare prices as structured JSON, optionally filtered by tariff zone. Find dataset ids with the fares catalogue passthrough tool (Data_set_api_v1_fares_dataset).

Parameters: dataset_id: Fares dataset id from the fares catalogue. origin_zone: Optional start tariff zone ref to filter by. destination_zone: Optional end tariff zone ref to filter by.

Inputs: dataset_id (required), origin_zone, destination_zone. Returns: result

get_live_buses_on_routeA

Get real-time bus locations for a specific operator and route. Filters are applied server-side by the BODS datafeed, shrinking payloads.

Parameters: operator_ref: Operator NOC code (e.g. ARBB, SCCM, CBBH). line_ref: Route number (e.g. 12, MK1, 100). origin_ref: Optional origin stop ref filter. destination_ref: Optional destination stop ref filter. vehicle_ref: Optional single-vehicle filter. bounding_box: Optional filter "minLon,minLat,maxLon,maxLat" (WGS84).

Inputs: line_ref (required), operator_ref (required), origin_ref, vehicle_ref, +2 more. Returns: result

get_route_stopsA

Get the full ordered list of stops for a specific bus route.

Parameters: operator: Operator name (exact or partial match). route: Route number/identifier. direction: Optional filter: 'inbound', 'outbound', or leave blank for all.

Inputs: route (required), operator (required), direction. Returns: result

GTFS_RT_Data_feed_api_v1_gtfsrtdatafeedD

Returns all published datafeeds

Parameters: boundingBox: Limit results to bus location data with vehicle position within the rectangular boundingBox you set using co-ordinates. [minLongitude, minLatitude, maxLongitude, maxLatitude] The default values shown are for the Liverpool area. routeId: Limit results to bus location data with the specified routeId. Use a comma-separated list to specify multiple routeId values. startTimeAfter: Limit results to bus location data with a start time after startTimeAfter. startTimeBefore: Limit results to bus location data with a start time before startTimeBefore.

Inputs: kwargs (required). Returns: result

load_timetable_deltaA

Incrementally refresh the timetable index using the catalogue's modifiedDate filter: re-download only datasets changed since the last refresh (default watermark; pass an ISO timestamp to override) and purge datasets withdrawn from the catalogue. Minutes instead of hours versus a full load. No-op fallback to a full load if no cache exists. Catalogue sweeps are server-side filtered by modifiedDate when the index is fresh; a full (unfiltered) sweep - needed to detect withdrawn datasets - runs at most every 7 days. reconcile=True does not force a full sweep, but withdrawal purges happen only on full sweeps, so with a fresh watermark withdrawals linger up to 7 days (self-heals on the next full sweep).

Parameters: since: Optional ISO timestamp (YYYY-MM-DDTHH:MM:SS). Empty = use the watermark left by the last full load / delta. reconcile: If true (default), also purge datasets that vanished from the catalogue.

Inputs: since, reconcile. Returns: result

load_timetable_indexA

Download and index all accessible timetable datasets. Call this first if stop/route search tools return no results.

Parameters: force_refresh: If true, re-download all data instead of using cache.

Inputs: force_refresh. Returns: result

plan_journeyA

Plan a journey from stop_a to stop_b arriving by a given time. Supports direct routes and single changes.

Parameters: stop_a: Starting stop (NaPTAN code or name). stop_b: Destination stop (NaPTAN code or name). arrive_by: Target arrival time (HH:MM, 24h format). day: Optional day filter: mon, tue, wed, thu, fri, sat, sun. Defaults to today. max_changes: Maximum number of bus changes (0 = direct only, 1 = one change). Default 1. check_disruptions: If true (default), plans whose route or operator appears in the live SIRI-SX disruptions feed are annotated with a "disruption_alerts" list. Annotation never drops or reorders a plan and never changes the returned count; a feed failure degrades silently. At most the 15 earliest-arriving plans are returned, with or without annotation.

Inputs: stop_a (required), stop_b (required), arrive_by (required), day, +2 more. Returns: result

search_stopsA

Search for bus stops by name across all loaded timetable data. Returns matching stops with their NaPTAN codes.

Parameters: query: Substring to search for in stop names (case-insensitive).

Inputs: query (required). Returns: result

SIRI_SX_Cancellations_siri_sx_cancellationsD

Returns all cancellations

Parameters:

Inputs: kwargs (required). Returns: result

SIRI_SX_Disruptions_siri_sxC

Returns all disruptions

Parameters:

Inputs: kwargs (required). Returns: result

SIRI_VM_Data_feed_api_v1_datafeedA

Returns all published datafeeds

Parameters: boundingBox: Limit results to bus location data with vehicle position within the rectangular boundingBox you set using co-ordinates. [minLongitude, minLatitude, maxLongitude, maxLatitude]. The default values shown are for the Liverpool area. operatorRef: Limit results to bus location data with the specified operatorRef. The National Operator Code is often used as the input for operatorRef. Comma separated list of values can be used for querying. vehicleRef: Limit results to bus location data with the specified vehicleRef. lineRef: Limit results to bus location data with the specified lineRef. producerRef: Limit results to bus location data with the specified producerRef. originRef: Limit results to bus location data with the specified originRef. destinationRef: Limit results to bus location data with the specified destinationRef.

Inputs: kwargs (required). Returns: result

SIRI_VM_Data_feed_api_v1_datafeed_by_datafeedIDC

Returns a single datafeed

Parameters: datafeedID (required): Limit results to a specific data feed of a publisher using the data feed ID.

Inputs: kwargs (required). Returns: result

timetables_api_v1_datasetC

Returns all timetables

Parameters: adminArea: Limit results to datasets with services that stop within the specified area(s). The adminAreas entered will be inserted into a comma delimited query in the API. noc: Limit results to data sets published by an operator identified by the specified National Operator Code (NOC). The NOCs entered will be inserted into a comma delimited query in the API. limit: The maximum number of records to return. The default value shown is 25. offset: Return results that match the query starting from the specified offset e.g. If the offset=10 and limit=25, then results from 11 to 35 will be returned. The default value shown is 0. search: Return data sets where the data set name, data set description, organisation name, or admin area name contain the specified value. status: Limit results to data sets with the specified status. endDateStart: Limit results to data sets with services with end dates after this date. endDateEnd: Limit results to data sets with services with end dates before this date. modifiedDate: Limit results to data sets that have been created/updated since the specified date. startDateStart: Limit results to data sets with services with start dates after this date. startDateEnd: Limit results to data sets with services with start dates before this date. dqRag: Limit results to data sets with the specified String. bodsCompliance: Limit results to data sets with the specified boolean value.

Inputs: kwargs (required). Returns: result

timetables_api_v1_dataset_by_datasetIDC

Returns a single dataset

Parameters: datasetID (required): Limit results to a specific data set of a publisher using the data set ID.

Inputs: kwargs (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.6/5.0

    Scored across 22 tools

    Disambiguation2/5

    There are several overlapping tools: get_disruptions overlaps SIRI_SX_Disruptions_siri_sx, get_cancellations overlaps SIRI_SX_Cancellations_siri_sx_cancellations, and get_live_buses_on_route overlaps both SIRI_VM_Data_feed_api_v1_datafeed and GTFS_RT_Data_feed_api_v1_gtfsrtdatafeed. The high-level wrappers are distinguishable from raw passthroughs only after reading descriptions carefully, so an agent could easily choose the wrong endpoint.

    Naming Consistency2/5

    Most high-level tools follow a readable verb_noun snake_case pattern, such as search_stops, get_route_stops, and plan_journey. However, the raw API passthroughs use inconsistent path-derived names with mixed acronym casing and embedded camelCase, such as SIRI_VM_Data_feed_api_v1_datafeed_by_datafeedID and Data_set_api_v1_fares_dataset.

    Tool Count3/5

    The 22-tool surface is broad but borderline heavy for a bus-data server. Much of the count comes from raw API passthroughs that duplicate or partially duplicate the higher-level tools, making the set feel larger than necessary.

    Completeness4/5

    The surface covers the core bus-data domain well: timetable loading, stop and route lookup, journey planning, departures, live vehicle positions, disruptions, cancellations, fares, and dataset catalogues. There are minor gaps around direct stop/operator detail lookup, but most workflows are supported.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers