九巴巴士MCP服务器
一个模型上下文协议 (MCP) 服务器,可实时访问香港九龙巴士 (KMB) 和龙运巴士 (Long Win Bus) 的路线信息和到达时间。该服务器支持语言模型查询香港公交服务信息,以解答用户关于公交路线、站点和预计到达时间的问题。
特征
实时公交车到站信息(ETA)
综合公交线路查询
公交车站信息和搜索
路线站点映射
缓存系统优化 API 调用
双语支持(英语和繁体中文)
数据源
该项目利用 KMB/LWB 官方开放数据 API:
先决条件
Python 3.10 或更高版本
uv 包管理器
安装
首先,如果尚未安装 uv,请安装它:
克隆存储库:
使用uv处理python包:
用法
在您的 MCP 客户端(例如 Claude Desktop)中编辑配置:
服务器提供了几种可供语言模型用来查询公交车信息的工具:
get_route_list()
:获取所有公交路线列表get_stop_list()
:获取所有公交车站列表get_route_stops()
:获取特定路线的站点find_stops_by_name()
:按名称搜索公交车站get_all_routes_at_stop()
:获取服务特定站点的所有路线get_eta()
:获取预计到达时间
测试
使用 pytest 运行测试套件:
依赖项
httpx
:用于异步 HTTP 请求fastmcp
:用于 MCP 服务器实现pytest
:用于测试(仅限开发)
贡献
欢迎贡献代码!欢迎提交 Pull 请求。
致谢
九巴/龙运巴士提供开放数据API
MCP 协议开发者
笔记
此服务依赖于 KMB/LWB 开放数据 API。请注意 API 的速率限制,并在生产环境中实施适当的错误处理。
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.
Tools
模型上下文协议服务器可实时访问香港九巴和龙运巴士的路线信息和到达时间,使语言模型能够回答用户关于公交路线、站点和预计到达时间的问题。
Related Resources
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 -21
- -securityAlicense-qualityA Model Context Protocol Server search realtime flight detail with multiple fligh carrier, price , stop , time duration for any given date using simple promptLast updated -31MIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that allows large language models to search for and analyze Chinese railway (12306) tickets through a simple API interface.Last updated -85919MIT License
- -securityAlicense-qualityAn 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.Last updated -3MIT License