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 "Install 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 Serverwhen 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")
| Name | Required | Description | Default |
|---|---|---|---|
| destination | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Find bus routes') but lacks details on traits like response format, pagination, rate limits, error conditions, or whether it's a read-only operation. This is a significant gap for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, with the core purpose stated first followed by parameter details. The two sentences are efficient and focused, with no wasted words, though the structure is simple without explicit sections.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (1 parameter, no annotations, but with an output schema), the description is partially complete. It covers the purpose and parameter semantics adequately, but lacks behavioral context and usage guidelines. The presence of an output schema reduces the need to explain return values, but more guidance is still warranted.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful context beyond the input schema, which has 0% description coverage. It explains the 'destination' parameter with examples ('Central', 'Mong Kok', 'Airport'), clarifying the expected input format and scope. This compensates well for the schema's lack of documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Find') and resource ('bus routes'), and specifies the target ('to a specified destination'). It doesn't explicitly differentiate from sibling tools like 'get_all_routes_at_stop' or 'get_route_stops_info', but the destination-focused search is reasonably distinct.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'find_stop_by_name' or 'get_all_routes_at_stop', nor does it specify prerequisites or exclusions (e.g., whether it requires real-time data or works with schedules only).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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
| Name | Required | Description | Default |
|---|---|---|---|
| stop_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes a search operation but lacks details on permissions, rate limits, pagination, or return format. The description does not contradict annotations, but it provides minimal behavioral context beyond the basic operation, which is insufficient for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, with the first sentence stating the tool's purpose clearly. The second sentence provides essential parameter details without redundancy. Every sentence earns its place, making it efficient and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 parameter) and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose and parameter semantics adequately. However, the lack of behavioral details (e.g., search behavior, limitations) and usage guidelines slightly reduces completeness, though the output schema mitigates some gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds significant meaning beyond the input schema, which has 0% description coverage. It explicitly explains that 'stop_name' is for 'Full or partial name of the bus stop to search for', clarifying the parameter's purpose and usage, which compensates fully for the schema's lack of documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Find') and resource ('bus stops'), specifying it matches by 'name or partial name'. It distinguishes from siblings like 'get_all_routes_at_stop' (which focuses on routes) and 'find_buses_to_destination' (which focuses on buses), making it highly specific and differentiated.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for searching bus stops by name, but does not explicitly state when to use this tool versus alternatives like 'get_route_stops_info' (which might provide stop details within a route context) or 'get_all_routes_at_stop' (which focuses on routes at a specific stop). No exclusions or prerequisites are mentioned, leaving usage context somewhat inferred.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_all_routes_at_stopB
Get all bus routes that pass through a specified bus stop.
Args:
stop_name: Name of the bus stop
| Name | Required | Description | Default |
|---|---|---|---|
| stop_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It states what the tool does but doesn't describe response format, error handling, rate limits, or whether it requires authentication. For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized with two sentences: one stating the purpose and another documenting the parameter. It's front-loaded with the core functionality, though the parameter documentation could be integrated more seamlessly rather than as a separate 'Args' section.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (one parameter) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and incomplete behavioral transparency, it doesn't fully prepare an agent for edge cases or system constraints, leaving room for improvement in completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful context for the single parameter 'stop_name' by explaining it's 'Name of the bus stop', which clarifies its purpose beyond the schema's basic title. With 0% schema description coverage and only one parameter, this adequately compensates, though it doesn't detail format constraints (e.g., case sensitivity).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Get all bus routes') and resource ('that pass through a specified bus stop'), making the purpose immediately understandable. It distinguishes from sibling tools like 'find_stop_by_name' (which finds stops) and 'get_next_bus' (which provides timing information) by focusing on route enumeration at a stop.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'find_buses_to_destination' or 'get_route_stops_info'. It lacks context about prerequisites (e.g., whether the stop must exist in the system) or exclusions (e.g., not for real-time bus tracking).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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
| Name | Required | Description | Default |
|---|---|---|---|
| route | Yes | ||
| stop_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes what the tool does (retrieves arrival time) but lacks critical behavioral details: it doesn't specify if this requires real-time data access, whether results are cached, what happens if the route/stop doesn't exist, or if there are rate limits. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded: the first sentence states the core purpose clearly, followed by a structured 'Args' section that efficiently documents parameters with examples. Every sentence earns its place without redundancy or fluff, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 required parameters, no annotations, but with an output schema), the description is minimally adequate. It covers the basic purpose and parameters but lacks behavioral context (e.g., error handling, data freshness). The presence of an output schema means the description doesn't need to explain return values, but it should still address usage guidelines and operational traits to be more complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful semantics beyond the input schema. The schema has 0% description coverage (only titles 'Route' and 'Stop Name'), but the description provides concrete examples for 'route' (e.g., '1A', '6', '960') and clarifies that 'stop_name' is the name of the bus stop. This compensates well for the low schema coverage, though it doesn't detail format constraints (e.g., case sensitivity).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Get the next arrival time for a specified bus route at a stop.' It includes a specific verb ('Get'), resource ('next arrival time'), and scope ('bus route at a stop'). However, it doesn't explicitly differentiate from sibling tools like 'get_all_routes_at_stop' or 'find_buses_to_destination', which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_all_routes_at_stop' (which might list all routes at a stop) or 'find_buses_to_destination' (which might prioritize destination over route). Without any context on usage scenarios or exclusions, the agent must infer based on tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_route_stops_infoB
Get all stops along a specified bus route.
Args:
route: The bus route number (e.g., "1A", "6", "960")
| Name | Required | Description | Default |
|---|---|---|---|
| route | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It only states what the tool does ('Get all stops') without mentioning any behavioral traits such as whether it's read-only, potential rate limits, error handling, or what the output contains. This is inadequate for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, with the core purpose stated clearly in the first sentence. The parameter explanation is concise and directly relevant. It could be slightly improved by integrating the parameter details more seamlessly, but it avoids unnecessary verbosity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 parameter) and the presence of an output schema, the description is minimally adequate. However, it lacks context about behavioral aspects (e.g., read-only nature, error cases) and doesn't leverage sibling tool names to guide usage, leaving gaps in completeness despite the output schema handling return values.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds significant value beyond the input schema, which has 0% description coverage. It explains the 'route' parameter as 'The bus route number' and provides concrete examples (e.g., '1A', '6', '960'), clarifying the expected format and semantics that the schema alone does not cover.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('all stops along a specified bus route'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_all_routes_at_stop' or 'find_stop_by_name', which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_all_routes_at_stop' (which might provide overlapping information) or clarify scenarios where this tool is preferred, leaving the agent to infer usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
5 tool updates
v1.0.0- Changed
find_buses_to_destination1 field changed- changed
Output schema / (root)Previous value: -nullNew value: +{ + "properties": { + "result": { + "title": "Result", + "type": "string" + } + }, + "required": [ + "result" + ], + "title": "find_buses_to_destinationOutput", + "type": "object" +}
- Changed
find_stop_by_name1 field changed- changed
Output schema / (root)Previous value: -nullNew value: +{ + "properties": { + "result": { + "title": "Result", + "type": "string" + } + }, + "required": [ + "result" + ], + "title": "find_stop_by_nameOutput", + "type": "object" +}
- Changed
get_all_routes_at_stop1 field changed- changed
Output schema / (root)Previous value: -nullNew value: +{ + "properties": { + "result": { + "title": "Result", + "type": "string" + } + }, + "required": [ + "result" + ], + "title": "get_all_routes_at_stopOutput", + "type": "object" +}
- Changed
get_next_bus1 field changed- changed
Output schema / (root)Previous value: -nullNew value: +{ + "properties": { + "result": { + "title": "Result", + "type": "string" + } + }, + "required": [ + "result" + ], + "title": "get_next_busOutput", + "type": "object" +}
- Changed
get_route_stops_info1 field changed- changed
Output schema / (root)Previous value: -nullNew value: +{ + "properties": { + "result": { + "title": "Result", + "type": "string" + } + }, + "required": [ + "result" + ], + "title": "get_route_stops_infoOutput", + "type": "object" +}
5 tool updates
- First observed
find_buses_to_destination - First observed
find_stop_by_name - First observed
get_all_routes_at_stop - First observed
get_next_bus - First observed
get_route_stops_info
TDQS
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
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.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
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 gradedqualityDmaintenanceAn 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.4MIT
- AlicenseAqualityBmaintenanceMCP server for Atlanta MARTA real-time transit data, enabling queries about train arrivals and bus positions via natural language.4MIT
- AlicenseNot gradedqualityBmaintenanceMCP 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.12MIT
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kennyckk/mcp_hkbus'
If you have feedback or need assistance with the MCP directory API, please join our Discord server