KMB Bus MCP Server
Servidor MCP de bus KMB
Un servidor de Protocolo de Contexto de Modelo (MCP) que proporciona acceso en tiempo real a la información de rutas y horarios de llegada de los autobuses KMB (九龍巴士) y Long Win (龍運巴士) de Hong Kong. Este servidor permite a los Modelos de Lenguaje consultar la información del servicio de autobuses de Hong Kong para responder a las preguntas de los usuarios sobre rutas, paradas y horarios de llegada estimados.
Características
Información de llegada de autobuses en tiempo real (ETA)
Consultas completas de rutas de autobús
Información y búsquedas de paradas de autobús
Mapeo de rutas y paradas
Sistema de almacenamiento en caché para optimizar las llamadas API
Soporte bilingüe (inglés y chino tradicional)
Related MCP server: Hong Kong Transportation MCP Server
Fuente de datos
Este proyecto utiliza la API oficial de datos abiertos KMB/LWB:
Prerrequisitos
Python 3.10 o superior
administrador de paquetes uv
Instalación
Primero, instala uv si aún no lo has hecho:
curl -LsSf https://astral.sh/uv/install.sh | shClonar el repositorio:
git clone git@github.com:kennyckk/mcp_hkbus.git
cd mcp_hkbusUtilice uv para manejar el paquete de Python:
uv sync #using uv.lockUso
Edite la configuración en su cliente MCP (por ejemplo, Claude Desktop):
{
"mcpServers": {
"bus_service": {
"command": "path/to/uv.exe",
"args": ["--directory", "path/to/kmb_bus", "run", "kmb_mcp.py"],
"background": true
}
}
}El servidor proporciona varias herramientas que los modelos de lenguaje pueden utilizar para consultar información del bus:
get_route_list(): obtiene una lista de todas las rutas de autobúsget_stop_list(): Obtener una lista de todas las paradas de autobúsget_route_stops(): Obtener paradas para una ruta específicafind_stops_by_name(): busca paradas de autobús por nombreget_all_routes_at_stop(): Obtener todas las rutas que sirven a una parada específicaget_eta(): Obtener los tiempos de llegada estimados
Pruebas
Ejecute el conjunto de pruebas usando pytest:
pytest test/kmb-mcp-tests.pyDependencias
httpx: para solicitudes HTTP asíncronasfastmcp: Para la implementación del servidor MCPpytest: para pruebas (solo desarrollo)
Contribuyendo
¡Agradecemos sus contribuciones! No dude en enviar una solicitud de incorporación de cambios.
Expresiones de gratitud
KMB/LWB por proporcionar la API de datos abiertos
Los desarrolladores del protocolo MCP
Nota
Este servicio se basa en la API de datos abiertos KMB/LWB. Tenga en cuenta los límites de velocidad de la API e implemente un manejo de errores adecuado en entornos de producción.
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.68 PyPI5MIT
- 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.1711 npmMIT