Provides real-time access to Hong Kong KMB and Long Win bus routes, stops, and estimated arrival times via Model Context Protocol, supporting bilingual queries and optimized API usage.
Unlock the full potential of KMB Bus MCP Server through LangDB's AI Gateway. Get enterprise-grade security, analytics, and seamless integration with zero configuration.
Free tier available • No credit card required
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.
This project utilizes the official KMB/LWB Open Data API:
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone git@github.com:kennyckk/mcp_hkbus.git cd mcp_hkbus
uv sync #using uv.lock
{ "mcpServers": { "bus_service": { "command": "path/to/uv.exe", "args": ["--directory", "path/to/kmb_bus", "run", "kmb_mcp.py"], "background": true } } }
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 timesRun the test suite using pytest:
pytest test/kmb-mcp-tests.py
httpx
: For async HTTP requestsfastmcp
: For MCP server implementationpytest
: For testing (development only)Contributions are welcome! Please feel free to submit a Pull Request.
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.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!