UK Bus Departures MCP Server

UK Bus Departures MCP Server

Enables users to get real-time UK bus departure information and validate bus stop ATCO codes by scraping bustimes.org. Provides structured data including service numbers, destinations, scheduled and expected departure times for any UK bus stop.

Category
Visit Server

README

UK Bus Departures MCP Server

An MCP (Model Context Protocol) server that provides real-time UK bus departure information by scraping bustimes.org.

Features

  • 🚌 Real-time bus departure information for UK stops
  • 🔍 ATCO code validation
  • ⚡ Built-in caching and rate limiting
  • 🌐 Cloudflare Workers compatible
  • 📊 Structured JSON responses

Usage

This MCP server provides the following tools:

get_bus_departures

Fetches real-time bus departures for a UK bus stop.

Parameters:

  • stop_code (string): UK bus stop ATCO code (e.g., '0100BRP90023')

Example:

{
  "tool": "get_bus_departures",
  "arguments": {
    "stop_code": "0100BRP90023"
  }
}

Response:

{
  "departures": [
    {
      "service_number": "75",
      "destination": "Hengrove Park",
      "scheduled_time": "15:02",
      "expected_time": "15:14"
    }
  ],
  "stop_name": "Bishopston Sommerville Road (S-bound)",
  "stop_code": "0100BRP90023",
  "location": [-2.59102, 51.47324],
  "last_updated": "2025-09-13T14:28:00.000Z"
}

validate_atco_code

Validates an ATCO code format and returns stop metadata if valid.

Parameters:

  • stop_code (string): ATCO code to validate

Response:

{
  "stop_code": "0100BRP90023",
  "is_valid": true,
  "metadata": {
    "name": "Bishopston Sommerville Road",
    "common_name": "Sommerville Road",
    "long_name": "Bishopston Sommerville Road (S-bound)",
    "location": [-2.59102, 51.47324],
    "indicator": "S-bound",
    "bearing": "S",
    "active": true
  }
}

ATCO Codes

UK bus stops use ATCO (Association of Transport Coordinating Officers) codes with the format:

  • 13 characters: NNNNAAANNNNN[A]
  • 4 digits + 3 letters + 5 digits + optional letter
  • Example: 0100BRP90023

Rate Limiting

The server implements:

  • 2-second delay between requests to bustimes.org
  • 5-minute caching for stop metadata (departures are always fresh)
  • Respectful scraping practices

Development

Prerequisites

  • Node.js 18+
  • Wrangler CLI

Local Development

npm install
npm run dev

Deployment

npm run deploy

Type Checking

npm run type-check

API Endpoints

When deployed as a Cloudflare Worker:

  • GET /mcp - MCP protocol endpoint
  • GET /sse - Server-Sent Events endpoint

Connect to Claude Desktop

To connect this MCP server to Claude Desktop:

  1. Follow Anthropic's Quickstart
  2. In Claude Desktop go to Settings > Developer > Edit Config
  3. Update with this configuration:
{
  "mcpServers": {
    "uk-bus-departures": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8787/sse"
      ]
    }
  }
}

For deployed version, replace localhost URL with your Workers domain.

Technical Details

Data Sources

  • bustimes.org API: Stop metadata (names, coordinates, etc.)
  • bustimes.org HTML: Real-time departure information via scraping

Architecture

  • Parser: Robust HTML parsing with multiple fallback strategies
  • Service: HTTP client with rate limiting and caching
  • Models: Type-safe data structures using Zod schemas

Error Handling

  • Invalid ATCO codes (format validation)
  • Missing bus stops (404 responses)
  • Network timeouts and failures
  • HTML structure changes

Limitations

  • UK Only: Limited to UK bus stops with ATCO codes
  • HTML Dependency: Fragile to website structure changes
  • Rate Limited: 2-second delays between requests
  • No Historical Data: Real-time and scheduled data only

License

MIT License

Disclaimer

This server scrapes public data from bustimes.org for informational purposes. Please use responsibly and respect the website's terms of service.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured