Skip to main content
Glama
ajeetraina

Bangalore BMTC Mobility Connectivity Platform

by ajeetraina

벵갈루루 BMTC MCP 서버

방갈로르 도시 교통 공사(BMTC) 버스 서비스를 위한 몰 커넥터 프로그램(MCP) 서버 구현.

건축학

BMTC MCP 아키텍처

BMTC MCP 서버는 모듈식 계층 구조를 기반으로 문제를 분리하고 유지 관리 편의성을 높입니다. 이 시스템은 방갈로르 도시 교통 공사(Bangalore Metropolitan Transport Corporation) 버스의 실시간 교통 데이터를 처리하고 표준화된 API를 통해 제공하도록 설계되었습니다.

핵심 구성 요소

  1. API 계층 : 인증, 경로, 정류장, 버스 위치 및 ETA 정보를 위한 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

  • 몽고디비

  • Redis(캐싱용 선택 사항)

설치 및 설정

방법 1: 표준 설치

  1. 저장소를 복제합니다

지엑스피1

  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

생산의 경우, 공식 API 액세스를 요청하려면 BMTC에 직접 문의해야 합니다.

개발

테스트

테스트를 실행하세요:

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 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

감사의 말

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

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

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