Bangalore BMTC Mobility Connectivity Platform

Integrations

  • Manages environment configuration for the BMTC MCP server deployment.

  • Provides version control for the BMTC MCP server codebase.

  • Hosts the repository for the BMTC MCP server code and documentation.

班加罗尔 BMTC MCP 服务器

为班加罗尔都市运输公司 (BMTC) 公交服务实施购物中心连接器程序 (MCP) 服务器。

建筑学

BMTC MCP 服务器采用模块化分层架构,有效分离关注点并提升可维护性。该系统旨在处理班加罗尔都市交通公司公交车的实时交通数据,并通过标准化 API 提供。

核心组件

  1. API 层:用于身份验证、路线、站点、公交车位置和预计到达时间 (ETA) 信息的 RESTful 端点
  2. 服务层:业务逻辑、数据转换和ETA计算
  3. 数据访问层:通过 Mongoose ODM 集成 MongoDB
  4. 缓存层:基于 Redis 的缓存,以提高性能
  5. 外部集成层:BMTC API 集成

阅读完整的架构文档

特征

  • 实时公交车位置追踪
  • 路线信息和时间安排
  • 停靠站详情和预计到达时间 (ETA)
  • 支持班加罗尔 2,200 多条公交线路和 8,400 多个公交车站
  • 身份验证和授权
  • 数据缓存和优化
  • 附近站点和公交车的地理空间查询

先决条件

  • Node.js(v14 或更高版本)
  • npm 或 yarn
  • MongoDB
  • Redis(可选,用于缓存)
  • Git

安装和设置

方法 1:标准安装

  1. 克隆存储库
git clone https://github.com/ajeetraina/bengaluru-bmtc-mcp.git cd bengaluru-bmtc-mcp
  1. 安装依赖项
npm install
  1. 配置环境变量
cp .env.example .env

使用您的配置编辑.env文件:

PORT=3000 NODE_ENV=development MONGO_URI=mongodb://localhost:27017/bmtc-mcp REDIS_URI=redis://localhost:6379 API_KEY=your_api_key_here JWT_SECRET=your_jwt_secret_here JWT_EXPIRES_IN=86400 BMTC_API_ENDPOINT=https://bmtc-api-endpoint.example BMTC_API_KEY=your_bmtc_api_key_here CACHE_DURATION=300 LOG_LEVEL=info
  1. 使用模拟数据填充数据库(可选)
node src/scripts/seed.js
  1. 启动服务器
npm start

对于自动重启的开发:

npm run dev

方法 2:使用 Docker Compose

  1. 克隆存储库
git clone https://github.com/ajeetraina/bengaluru-bmtc-mcp.git cd bengaluru-bmtc-mcp
  1. 配置环境变量(可选)

可以直接在docker-compose.yml文件中修改环境变量,或者创建.env文件:

cp .env.example .env
  1. 构建并启动容器
docker-compose up -d

这将启动三个容器:

  • bmtc-mcp-api :Node.js API 服务器
  • bmtc-mcp-mongo :MongoDB 数据库
  • bmtc-mcp-redis :Redis缓存服务器
  1. 使用模拟数据填充数据库(可选)
docker-compose exec api node src/scripts/seed.js
  1. 查看日志
docker-compose logs -f api
  1. 停止容器
docker-compose down

要删除卷:

docker-compose down -v

使用 API

服务器运行后,您可以访问以下 API:

http://localhost:3000/api/v1

如需 API 文档,请访问:

http://localhost:3000/api-docs

示例 API 端点

# Authentication POST /api/v1/auth/login GET /api/v1/auth/me # Routes GET /api/v1/routes GET /api/v1/routes/:routeId GET /api/v1/routes/search?source=Kempegowda&destination=Electronic # Stops GET /api/v1/stops GET /api/v1/stops/:stopId GET /api/v1/stops/near?lat=12.9767&lng=77.5713&radius=500 GET /api/v1/stops/search?query=Lalbagh # Bus Locations GET /api/v1/bus-locations GET /api/v1/bus-locations/:busId GET /api/v1/bus-locations/near?lat=12.9767&lng=77.5713&radius=1000 # ETA GET /api/v1/eta/:stopId GET /api/v1/eta/:stopId/:routeId

API 密钥

JWT 秘密

JWT 密钥用于签署身份验证令牌。生成一个安全的随机字符串:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

将其添加到您的.env文件中:

JWT_SECRET=your_generated_secret_here

BMTC API 密钥

对于开发,您可以使用模拟数据,而无需实际的 BMTC API 密钥:

BMTC_API_ENDPOINT=https://bmtc-api-endpoint.example BMTC_API_KEY=your_bmtc_api_key_here

对于生产,您需要直接联系 BMTC 来请求官方 API 访问权限。

发展

测试

运行测试:

npm test

运行覆盖测试:

npm run test:coverage

代码检查

检查代码风格:

npm run lint

修复代码风格问题:

npm run lint:fix

项目结构

bengaluru-bmtc-mcp/ ├── .env.example # Environment variables template ├── .eslintrc.json # ESLint configuration ├── .github/ # GitHub configuration │ └── workflows/ # GitHub Actions workflows ├── .gitignore # Git ignore file ├── CONTRIBUTING.md # Contribution guidelines ├── Dockerfile # Docker configuration ├── LICENSE # MIT License ├── README.md # Project documentation ├── docker-compose.yml # Docker Compose configuration ├── docs/ # Documentation │ ├── api.md # API documentation │ └── setup.md # Setup guide ├── jest.config.js # Jest configuration ├── package.json # Project dependencies └── src/ # Source code ├── config/ # Configuration files ├── controllers/ # Request handlers ├── index.js # Application entry point ├── middlewares/ # Express middlewares ├── models/ # MongoDB models ├── public/ # Static files ├── routes/ # API routes ├── scripts/ # Utility scripts ├── services/ # External service integrations ├── tests/ # Test files └── utils/ # Utility functions

贡献

请阅读CONTRIBUTING.md了解我们的行为准则和提交拉取请求的流程的详细信息。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

致谢

-
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. 核心组件
  2. 特征
    1. 先决条件
      1. 安装和设置
        1. 方法 1:标准安装
        2. 方法 2:使用 Docker Compose
      2. 使用 API
        1. 示例 API 端点
      3. API 密钥
        1. JWT 秘密
        2. BMTC API 密钥
      4. 发展
        1. 测试
        2. 代码检查
        3. 项目结构
      5. 贡献
        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
              F
              license
              A
              quality
              Facilitates real-time access to Singapore's Land Transport Authority (LTA) transportation data, offering insights into bus arrivals, train services, traffic conditions, and more through integration with the LTA DataMall API.
              Last updated -
              7
              JavaScript
            • -
              security
              A
              license
              -
              quality
              This server enables large language models to access and interact with real-time transport alerts from Transport for NSW's network, supporting filtering by transport mode and returning formatted alert information about disruptions and planned works.
              Last updated -
              11
              5
              JavaScript
              MIT License
              • Apple
            • -
              security
              F
              license
              -
              quality
              A Model Context Protocol server that provides real-time access to Hong Kong's KMB and Long Win Bus route information and arrival times, enabling Language Models to answer user questions about bus routes, stops, and ETAs.
              Last updated -
              3
              Python
              • Linux
              • Apple

            View all related MCP servers

            ID: 2l0m5ujizz