Skip to main content
Glama

Bangalore BMTC Mobility Connectivity Platform

by ajeetraina

ベンガルール BMTC MCP サーバー

バンガロール都市圏交通公社 (BMTC) のバス サービス用のモール コネクタ プログラム (MCP) サーバーの実装。

建築

BMTC MCPアーキテクチャ

BMTC MCPサーバーは、モジュール式の階層化アーキテクチャを採用しており、懸念事項を分離し、保守性を向上させます。このシステムは、バンガロール都市圏交通公社のバスからのリアルタイムの交通データを処理し、標準化されたAPIを通じて提供するように設計されています。

コアコンポーネント

  1. API レイヤー: 認証、ルート、停留所、バスの位置、到着予定時刻情報のための RESTful エンドポイント

  2. サービス層: ビジネスロジック、データ変換、ETA計算

  3. データ アクセス層: Mongoose ODM 経由の MongoDB 統合

  4. キャッシュ層: パフォーマンス向上のためのRedisベースのキャッシュ

  5. 外部統合レイヤー:BMTC API統合

完全なアーキテクチャドキュメントを読む

Related MCP server: Singapore LTA MCP Server

特徴

  • リアルタイムバス位置追跡

  • ルート情報とスケジュール

  • 停留所の詳細と到着予定時刻(ETA)

  • バンガロールの2,200以上のバス路線と8,400以上のバス停をサポート

  • 認証と承認

  • データのキャッシュと最適化

  • 近くの停留所やバスの地理空間クエリ

前提条件

  • Node.js (v14以降)

  • npmまたはyarn

  • モンゴDB

  • Redis(オプション、キャッシュ用)

  • ギット

インストールとセットアップ

方法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

これにより、3 つのコンテナが起動します。

  • 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

Latest Blog Posts

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/ajeetraina/bengaluru-bmtc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server