KMB Bus MCP Server
The KMB Bus MCP Server provides comprehensive real-time access to Hong Kong's KMB and Long Win Bus information. You can:
Get estimated arrival times for specific bus routes at particular stops
Find bus routes that serve a specified destination
Retrieve all stops along a specific bus route
Search for bus stops by full or partial name
Find all bus routes that pass through a given bus stop
Get comprehensive lists of all bus routes and stops
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@KMB Bus MCP Server when is the next bus for route 101 from Central?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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)
Related MCP server: Hong Kong Transportation MCP Server
Data Source
This project utilizes the official KMB/LWB Open Data API:
Prerequisites
Python 3.10 or higher
uv package manager
Installation
Installing via Smithery
To install KMB Bus MCP for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @kennyckk/mcp_hkbus --client claudeManual Installation
First, install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | shClone the repository:
git clone git@github.com:kennyckk/mcp_hkbus.git
cd mcp_hkbusUse uv to handle the python package:
uv sync #using uv.lockUsage
Edit the Config in your MCP Client (e.g. Claude Desktop):
{
"mcpServers": {
"bus_service": {
"command": "path/to/uv.exe",
"args": ["--directory", "path/to/kmb_bus", "run", "kmb_mcp.py"],
"background": true
}
}
}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:
pytest test/kmb-mcp-tests.pyDependencies
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.
Available Tools
5 toolsfind_buses_to_destinationB
Find bus routes that go to a specified destination.
Args:
destination: The destination to search for (e.g., "Central", "Mong Kok", "Airport")
Inputs: destination (required). Returns: result
find_stop_by_nameA
Find bus stops matching a name or partial name.
Args:
stop_name: Full or partial name of the bus stop to search for
Inputs: stop_name (required). Returns: result
get_all_routes_at_stopB
Get all bus routes that pass through a specified bus stop.
Args:
stop_name: Name of the bus stop
Inputs: stop_name (required). Returns: result
get_next_busB
Get the next arrival time for a specified bus route at a stop.
Args:
route: The bus route number (e.g., "1A", "6", "960")
stop_name: The name of the bus stop
Inputs: route (required), stop_name (required). Returns: result
get_route_stops_infoB
Get all stops along a specified bus route.
Args:
route: The bus route number (e.g., "1A", "6", "960")
Inputs: route (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: finding buses to destinations, searching stops by name, getting routes at a stop, checking next bus arrivals, and listing stops on a route. The descriptions reinforce these unique functions, making misselection unlikely.
All tools follow a consistent verb_noun pattern with underscores (e.g., find_buses_to_destination, get_route_stops_info). The naming is uniform and predictable, using clear action verbs like 'find' and 'get' paired with descriptive nouns.
With 5 tools, this server is well-scoped for a bus information system. Each tool serves a specific, necessary function in querying routes, stops, and schedules, avoiding bloat while covering core use cases effectively.
The tool set covers essential bus information queries: route discovery, stop lookup, schedule checking, and route details. A minor gap exists in lacking tools for broader operations like route planning or real-time updates, but agents can work around this with the provided tools.
Maintenance
Related MCP Connectors
The official Model Context Protocol server for Ambee. It gives any MCP-compatible AI assistant — Claude, ChatGPT, Cursor, VS Code, Ollama, and more direct access to live air quality, pollen, and weather data. To get started, including information on signing up and obtaining your Ambee key, check out the Ambee documentation on https://docs.ambeedata.com
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
The Ferryhopper MCP server is a connector for LLMs and AI Agents in maritime travel that exposes ferry routes, schedules, and booking options. It enables AI assistants to search ports and connections across 33 countries and 190+ ferry operators, provide real-time ferry itineraries with indicative prices, and assist users with planning island-hopping or multi-leg journeys by processing natural language queries about ferry times, passenger counts, and travel durations.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables Large Language Models to access real-time data on Vilnius public transport stops and routes through the Model Context Protocol.21-
- AlicenseNot gradedqualityCmaintenanceAn MCP server providing access to Hong Kong transportation data, including passenger traffic statistics at control points and real-time bus arrival information for KMB and Long Win Bus services.5MIT
- AlicenseAqualityCmaintenanceMCP server for Atlanta MARTA real-time transit data, enabling queries about train arrivals and bus positions via natural language.4MIT
- AlicenseBqualityDmaintenanceMCP server that integrates with the transport12 API to provide tools for searching stops, routes, arrivals, and vehicle forecasts, enabling natural language interaction with public transport data.1712 npmMIT