Bangalore BMTC Mobility Connectivity Platform

Bangalore BMTC Mobility Connectivity Platform

Provides real-time access to Bangalore's public transportation information including bus tracking, schedules, routes, and service updates to improve passenger experience.

Category
访问服务器

README

Bengaluru BMTC MCP Server

An implementation of a Mall Connector Program (MCP) server for Bangalore Metropolitan Transport Corporation (BMTC) bus services.

Architecture

BMTC MCP Architecture

The BMTC MCP server follows a modular, layered architecture that separates concerns and promotes maintainability. The system is designed to handle real-time transit data from Bangalore Metropolitan Transport Corporation buses and provide it through a standardized API.

Core Components

  1. API Layer: RESTful endpoints for authentication, routes, stops, bus locations, and ETA information
  2. Service Layer: Business logic, data transformation, and ETA calculations
  3. Data Access Layer: MongoDB integration via Mongoose ODM
  4. Caching Layer: Redis-based caching for improved performance
  5. External Integration Layer: BMTC API integration

Read the full architecture documentation

Features

  • Real-time bus location tracking
  • Route information and scheduling
  • Stop details and ETA (Estimated Time of Arrival)
  • Support for over 2,200 bus routes and 8,400+ bus stops in Bengaluru
  • Authentication and authorization
  • Data caching and optimization
  • GeoSpatial queries for nearby stops and buses

Prerequisites

  • Node.js (v14 or later)
  • npm or yarn
  • MongoDB
  • Redis (optional, for caching)
  • Git

Installation and Setup

Method 1: Standard Installation

  1. Clone the repository
git clone https://github.com/ajeetraina/bengaluru-bmtc-mcp.git
cd bengaluru-bmtc-mcp
  1. Install dependencies
npm install
  1. Configure environment variables
cp .env.example .env

Edit the .env file with your configuration:

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. Seed the database with mock data (optional)
node src/scripts/seed.js
  1. Start the server
npm start

For development with auto-restart:

npm run dev

Method 2: Using Docker Compose

  1. Clone the repository
git clone https://github.com/ajeetraina/bengaluru-bmtc-mcp.git
cd bengaluru-bmtc-mcp
  1. Configure environment variables (optional)

You can modify the environment variables directly in the docker-compose.yml file or create a .env file:

cp .env.example .env
  1. Build and start the containers
docker-compose up -d

This will start three containers:

  • bmtc-mcp-api: The Node.js API server
  • bmtc-mcp-mongo: MongoDB database
  • bmtc-mcp-redis: Redis cache server
  1. Seed the database with mock data (optional)
docker-compose exec api node src/scripts/seed.js
  1. View logs
docker-compose logs -f api
  1. Stop the containers
docker-compose down

To remove volumes as well:

docker-compose down -v

Using the API

Once the server is running, you can access the API at:

http://localhost:3000/api/v1

For API documentation, visit:

http://localhost:3000/api-docs

Example API Endpoints

# 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 Keys

JWT Secret

The JWT secret is used for signing authentication tokens. Generate a secure random string:

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

Add this to your .env file:

JWT_SECRET=your_generated_secret_here

BMTC API Key

For development, you can use mock data without an actual BMTC API key:

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

For production, you would need to contact BMTC directly to request official API access.

Development

Testing

Run the tests:

npm test

Run tests with coverage:

npm run test:coverage

Linting

Check code style:

npm run lint

Fix code style issues:

npm run lint:fix

Project Structure

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

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选