KMB Bus MCP Server
A Model Context Protocol (MCP) server that provides real-time access to Hong Kong's KMB (九龍巴士) and Long Win Bus (龍運巴士) route information and arrival times. This server enables Language Models to query Hong Kong bus service information to answer user questions about bus routes, stops, and estimated arrival times.
Features
- Real-time bus arrival information (ETA)
- Comprehensive bus route queries
- Bus stop information and searches
- Route-stop mapping
- Caching system to optimize API calls
- Bilingual support (English and Traditional Chinese)
Data Source
This project utilizes the official KMB/LWB Open Data API:
Prerequisites
- Python 3.10 or higher
- uv package manager
Installation
- First, install uv if you haven't already:
- Clone the repository:
- Use uv to handle the python package:
Usage
- Edit the Config in your MCP Client (e.g. Claude Desktop):
- The server provides several tools that can be used by Language Models to query bus information:
get_route_list()
: Get a list of all bus routesget_stop_list()
: Get a list of all bus stopsget_route_stops()
: Get stops for a specific routefind_stops_by_name()
: Search for bus stops by nameget_all_routes_at_stop()
: Get all routes serving a specific stopget_eta()
: Get estimated arrival times
Testing
Run the test suite using pytest:
Dependencies
httpx
: For async HTTP requestsfastmcp
: For MCP server implementationpytest
: For testing (development only)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
- KMB/LWB for providing the open data API
- The MCP protocol developers
Note
This service relies on the KMB/LWB Open Data API. Please be mindful of API rate limits and implement appropriate error handling in production environments.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A Model Context Protocol server that provides real-time access to Hong Kong's KMB and Long Win Bus route information and arrival times, enabling Language Models to answer user questions about bus routes, stops, and ETAs.
Related MCP Servers
- AsecurityFlicenseAqualityEnables Large Language Models to access real-time data on Vilnius public transport stops and routes through the Model Context Protocol.Last updated -21Python
- AsecurityAlicenseAqualityA Model Context Protocol server providing utility tools for development and testing, offering functionalities like personalized greetings, random card drawing, and datetime formatting with an extensible architecture.Last updated -191232TypeScriptMIT License
MCP TapData Serverofficial
-securityFlicense-qualityA Model Context Protocol server that enables Large Language Models to access and interact with database connections, including viewing schemas and performing CRUD operations on connected databases.Last updated -TypeScript- AsecurityFlicenseAqualityAn implementation of the Model Context Protocol (MCP) server using Server-Sent Events (SSE) for real-time communication, providing tools for calculations and dynamic resource templates.Last updated -1JavaScript