um-bus-mcp
The um-bus-mcp project is an MCP server that provides real-time information about the UM Campus Loop shuttle bus service, designed for integration with LLM clients. It offers features such as current service status, next bus times, location tracking, and special arrangements for typhoons.
📘 um-bus-mcp
This is an MPC server for the UM campus loop bus service and related information, which can be used with various LLM client that supports MCP to act as a part of LLM assistant chatbot for staffs and students in UM.
📋 Table of Contents
🧐 About
Provide an in-depth overview of your project. Explain the problem it solves, the motivation behind it, and any other relevant details.
🚀 Features
- Get the current and next stop of UM Campus Loop shuttle bus
- Get the time of next run of UM Campus Loop shuttle bus
- Get the special arrangement of UM Campus Loop shuttle bus during typhoon special weather
- Get the timetable image of UM Campus Loop shuttle bus
- Get the route image of UM Campus Loop shuttle bus
- Get the user note of UM Campus Loop shuttle bus
🛠️ Getting Started
Prerequisites
List any software, libraries, or tools required to run your project.
Python >= 3.10 fastmcp>=0.1.0 crawl4ai>=0.1.0 requests>=2.31.0 aiohttp>=3.9.0 beautifulsoup4>=4.12.0
Installation
Just use pip intall -r requirements.txt to install the required package
💻 Usage
This project provides an MCP (Multi-Client Protocol) server for querying UM Campus Loop shuttle bus information. Here's how to use it:
1. Start the MCP Server
Run the main Python file to start the MCP server:
python um_bus_mcp.py
2. Available Commands
The server provides several tools and resources for querying bus information:
Tools:
-
get_bus_is_active()
- Checks if the bus service is currently active
- Returns status and message about service availability
-
get_bus_next_run()
- Gets the time of the next bus run
- Returns status, time, and message about the next run
-
get_bus_location()
- Tracks the current location of the bus
- Returns the bus plate number, current stop, and next stop
Resources:
-
image://bus-timetable
- Retrieves the bus timetable image
- Returns a base64-encoded image of the timetable
-
image://bus-route
- Retrieves the bus route map
- Returns a base64-encoded image of the route
-
text://bus-user-note
- Gets important user notes and guidelines
- Returns text containing bus usage rules
-
text://bus-typhoon-arrangement
- Gets special arrangements during typhoon weather
- Returns text containing typhoon-related service information
3. Example Usage
Here are some example queries you can make to the MCP server:
# Check if bus is active
response = await mcp.call('get_bus_is_active')
print(f"Bus Status: {response['status']}")
print(f"Message: {response['message']}")
# Get next bus run time
next_run = await mcp.call('get_bus_next_run')
print(f"Next Run Status: {next_run['status']}")
if 'time' in next_run:
print(f"Next Run Time: {next_run['time']}")
# Get bus location
location = await mcp.call('get_bus_location')
print(f"Bus Plate: {location['plate']}")
print(f"Current Stop: {location['current_stop']}")
print(f"Next Stop: {location['next_stop']}")
# Get timetable image
img_data = await mcp.call('image://bus-timetable')
# The image data is in base64 format and can be decoded and displayed
# Get user notes
guidelines = await mcp.call('text://bus-user-note')
print("Bus Usage Guidelines:")
print(guidelines['data'])
4. Integration
You can integrate this MCP server with any client that supports the MCP protocol. The server provides real-time information about the UM Campus Loop shuttle bus service, including:
- Service status
- Next run times
- Current location tracking
- Timetable and route information
- Usage guidelines and special arrangements
The information is updated in real-time by scraping the official UM Campus Loop website at https://campusloop.cmdo.um.edu.mo