Skip to main content
Glama

KMB Bus MCP Server

九巴巴士MCP服务器

一个模型上下文协议 (MCP) 服务器,可实时访问香港九龙巴士 (KMB) 和龙运巴士 (Long Win Bus) 的路线信息和到达时间。该服务器支持语言模型查询香港公交服务信息,以解答用户关于公交路线、站点和预计到达时间的问题。

特征

  • 实时公交车到站信息(ETA)
  • 综合公交线路查询
  • 公交车站信息和搜索
  • 路线站点映射
  • 缓存系统优化 API 调用
  • 双语支持(英语和繁体中文)

数据源

该项目利用 KMB/LWB 官方开放数据 API:

先决条件

  • Python 3.10 或更高版本
  • uv 包管理器

安装

  1. 首先,如果尚未安装 uv,请安装它:
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. 克隆存储库:
git clone git@github.com:kennyckk/mcp_hkbus.git cd mcp_hkbus
  1. 使用uv处理python包:
uv sync #using uv.lock

用法

  1. 在您的 MCP 客户端(例如 Claude Desktop)中编辑配置:
{ "mcpServers": { "bus_service": { "command": "path/to/uv.exe", "args": ["--directory", "path/to/kmb_bus", "run", "kmb_mcp.py"], "background": true } } }
  1. 服务器提供了几种可供语言模型用来查询公交车信息的工具:
  • get_route_list() :获取所有公交路线列表
  • get_stop_list() :获取所有公交车站列表
  • get_route_stops() :获取特定路线的站点
  • find_stops_by_name() :按名称搜索公交车站
  • get_all_routes_at_stop() :获取服务特定站点的所有路线
  • get_eta() :获取预计到达时间

测试

使用 pytest 运行测试套件:

pytest test/kmb-mcp-tests.py

依赖项

  • httpx :用于异步 HTTP 请求
  • fastmcp :用于 MCP 服务器实现
  • pytest :用于测试(仅限开发)

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

致谢

  • 九巴/龙运巴士提供开放数据API
  • MCP 协议开发者

笔记

此服务依赖于 KMB/LWB 开放数据 API。请注意 API 的速率限制,并在生产环境中实施适当的错误处理。

-
security - not tested
A
license - permissive license
-
quality - not tested

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.

模型上下文协议服务器可实时访问香港九巴和龙运巴士的路线信息和到达时间,使语言模型能够回答用户关于公交路线、站点和预计到达时间的问题。

  1. 特征
    1. 数据源
      1. 先决条件
        1. 安装
          1. 用法
            1. 测试
              1. 依赖项
                1. 贡献
                  1. 致谢
                    1. 笔记

                      Related MCP Servers

                      • A
                        security
                        F
                        license
                        A
                        quality
                        Enables Large Language Models to access real-time data on Vilnius public transport stops and routes through the Model Context Protocol.
                        Last updated -
                        2
                        1
                        Python
                      • A
                        security
                        A
                        license
                        A
                        quality
                        A Model Context Protocol server providing utility tools for development and testing, offering functionalities like personalized greetings, random card drawing, and datetime formatting with an extensible architecture.
                        Last updated -
                        19
                        215
                        2
                        TypeScript
                        MIT License
                        • Apple
                        • Linux
                      • -
                        security
                        F
                        license
                        -
                        quality
                        A Model Context Protocol server that enables Large Language Models to access and interact with database connections, including viewing schemas and performing CRUD operations on connected databases.
                        Last updated -
                        • Apple
                      • A
                        security
                        F
                        license
                        A
                        quality
                        An implementation of the Model Context Protocol (MCP) server using Server-Sent Events (SSE) for real-time communication, providing tools for calculations and dynamic resource templates.
                        Last updated -
                        1
                        JavaScript

                      View all related MCP servers

                      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