CATA Bus MCP Server

CATA Bus MCP Server

Provides real-time and scheduled bus data for the Centre Area Transportation Authority (CATA) in State College, PA. Enables users to track live bus positions, get arrival predictions, search stops, view routes, and receive service alerts through natural language queries.

Category
访问服务器

README

🚌 CATA Bus MCP Server

A Model Context Protocol (MCP) server that provides live and static schedule data for the Centre Area Transportation Authority (CATA) bus system in State College, PA.

🌟 Features

  • Real-time vehicle positions - Track buses live on their routes
  • Trip updates - Get delay information and predicted arrivals
  • Service alerts - Stay informed about detours and disruptions
  • Static schedule data - Access routes, stops, and scheduled times
  • Fast in-memory storage - No database required, pure Python performance

🚀 Quick Start

Installation

# Clone the repository
git clone https://github.com/yourusername/catabus-mcp.git
cd catabus-mcp

# Install dependencies
pip install -e .

Running the Server

# Run in stdio mode (for MCP clients)
python -m catabus_mcp.server

# Run in HTTP mode (for testing)
python -m catabus_mcp.server --http

The HTTP server will be available at http://localhost:7000

🛠️ Available Tools

Tool Description Parameters
list_routes Get all bus routes None
search_stops Find stops by name/ID query: string
next_arrivals Get upcoming arrivals at a stop stop_id: string, horizon_minutes?: int
vehicle_positions Track buses on a route route_id: string
trip_alerts Get service alerts route_id?: string

💻 API Examples

Using with cURL (HTTP mode)

# List all routes
curl -X POST http://localhost:7000/mcp \
  -H "Content-Type: application/json" \
  -d '{"method":"list_routes_tool","params":{}}'

# Search for stops
curl -X POST http://localhost:7000/mcp \
  -H "Content-Type: application/json" \
  -d '{"method":"search_stops_tool","params":{"query":"HUB"}}'

# Get next arrivals
curl -X POST http://localhost:7000/mcp \
  -H "Content-Type: application/json" \
  -d '{"method":"next_arrivals_tool","params":{"stop_id":"PSU_HUB","horizon_minutes":30}}'

Integration with ChatGPT

  1. Install the MCP client in ChatGPT
  2. Add this server configuration:
{
  "name": "catabus",
  "command": "python",
  "args": ["-m", "catabus_mcp.server"],
  "description": "CATA bus schedule and realtime data"
}
  1. Ask questions like:
    • "When is the next N route bus from the HUB?"
    • "Are there any service alerts for the V route?"
    • "Show me all buses currently on the W route"

Integration with Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "catabus": {
      "command": "python",
      "args": ["-m", "catabus_mcp.server"]
    }
  }
}

🧪 Development

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=catabus_mcp

Code Quality

# Format code
black src/

# Lint
ruff check src/

# Type checking
mypy src/catabus_mcp/

📊 Data Sources

This server uses official CATA data feeds:

  • Static GTFS: https://catabus.com/wp-content/uploads/google_transit.zip
  • GTFS-Realtime Vehicle Positions: https://realtime.catabus.com/InfoPoint/GTFS-Realtime.ashx?Type=VehiclePosition
  • GTFS-Realtime Trip Updates: https://realtime.catabus.com/InfoPoint/GTFS-Realtime.ashx?Type=TripUpdate
  • GTFS-Realtime Alerts: https://realtime.catabus.com/InfoPoint/GTFS-Realtime.ashx?Type=Alert

Data is cached locally and updated:

  • Static GTFS: Daily
  • Realtime feeds: Every 15 seconds

🏗️ Architecture

catabus-mcp/
├── src/catabus_mcp/
│   ├── ingest/          # Data loading and polling
│   │   ├── static_loader.py
│   │   └── realtime_poll.py
│   ├── tools/           # MCP tool implementations
│   │   ├── list_routes.py
│   │   ├── search_stops.py
│   │   ├── next_arrivals.py
│   │   ├── vehicle_positions.py
│   │   └── trip_alerts.py
│   └── server.py        # FastMCP server
└── tests/               # Test suite

⚡ Performance

  • Warm cache response time: < 100ms for all queries
  • Memory usage: ~50MB with full GTFS data loaded
  • Rate limiting: Respects CATA's 10-second minimum between requests

📝 License

MIT License - See LICENSE file

🙏 Attribution

Transit data provided by Centre Area Transportation Authority (CATA). This project is not affiliated with or endorsed by CATA.

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

📞 Support

🎯 Roadmap

  • [ ] Add trip planning capabilities
  • [ ] Support for accessibility features
  • [ ] Historical data analysis
  • [ ] Geospatial queries (nearest stop)
  • [ ] Multi-agency support

✅ Manual Acceptance Checklist

  • [ ] pip install -e . completes without errors
  • [ ] python -m catabus_mcp.server starts successfully
  • [ ] Static GTFS data loads on startup
  • [ ] Realtime polling begins automatically
  • [ ] list_routes_tool returns CATA routes
  • [ ] search_stops_tool finds stops by query
  • [ ] next_arrivals_tool returns predictions with delays
  • [ ] vehicle_positions_tool shows bus locations
  • [ ] trip_alerts_tool displays active alerts
  • [ ] Tests pass with pytest
  • [ ] Type checking passes with mypy

Version: 0.1.0
Status: Production Ready
Last Updated: 2024

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选