um-bus-mcp

thomaswlh/um-bus-mcp

3.1

If you are the rightful owner of um-bus-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This is an MPC server for the UM campus loop bus service and related information, which can be used with various LLM clients that support MCP to act as a part of LLM assistant chatbot for staff and students in UM.

๐Ÿ“˜ 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:
  1. get_bus_is_active()

    • Checks if the bus service is currently active
    • Returns status and message about service availability
  2. get_bus_next_run()

    • Gets the time of the next bus run
    • Returns status, time, and message about the next run
  3. get_bus_location()

    • Tracks the current location of the bus
    • Returns the bus plate number, current stop, and next stop
Resources:
  1. image://bus-timetable

    • Retrieves the bus timetable image
    • Returns a base64-encoded image of the timetable
  2. image://bus-route

    • Retrieves the bus route map
    • Returns a base64-encoded image of the route
  3. text://bus-user-note

    • Gets important user notes and guidelines
    • Returns text containing bus usage rules
  4. 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