Skip to main content

Gausium OpenAPI MCP Server - Control Gausium robots through Claude

Project description

Gausium OpenAPI MCP Server

This project implements an MCP (Model Control Protocol) server that acts as a bridge to the Gausium OpenAPI, allowing AI models or other clients to interact with Gausium robots through a standardized interface.

Repository: https://github.com/cfrs2005/mcp-gs-robot

Architecture

The server follows a layered architecture that separates concerns and promotes maintainability:

Architecture Diagram

MCP Protocol Flow

The diagram below shows how AI models interact with Gausium robots through the MCP protocol:

MCP Protocol Flow

Features

The server currently supports the following functionalities as MCP tools:

  • list_robots: Lists robots accessible via the API key. (Based on: List Robots API)
  • get_robot_status: Fetches the detailed status of a specific robot by its serial number. (Based on: Get Robot Status API)
  • list_robot_task_reports: Retrieves cleaning task reports for a specific robot, with optional time filtering. (Based on: List Robot Task Reports API)
  • list_robot_maps: Lists the maps associated with a specific robot. (Based on: List Robot Maps API)

Project Structure

The project follows a structured layout based on Python best practices:

. 
├── .venv/                # Virtual environment directory
├── src/
│   └── gs_openapi/
│       ├── __init__.py
│       ├── api/            # Modules for direct API interactions
│       │   ├── __init__.py
│       │   ├── maps.py
│       │   └── robots.py
│       ├── auth/           # Authentication related modules
│       │   ├── __init__.py
│       │   └── token_manager.py # Handles OAuth token lifecycle
│       ├── config.py       # Configuration (URLs, Env Vars)
│       └── mcp/            # MCP server specific implementations
│           ├── __init__.py
│           └── gausium_mcp.py # GausiumMCP class extending FastMCP
├── .gitignore
├── docs/
│   └── images/            # Documentation images
├── main.py               # Main application entry point, tool registration, server run
├── README.md             # This file
└── requirements.txt      # Project dependencies
  • src/gs_openapi/config.py: Contains base URLs, API paths, and environment variable names.
  • src/gs_openapi/auth/token_manager.py: Manages acquiring and refreshing OAuth tokens.
  • src/gs_openapi/api/: Contains modules (robots.py, maps.py) with functions that directly call the Gausium OpenAPI endpoints using httpx.
  • src/gs_openapi/mcp/gausium_mcp.py: Defines the GausiumMCP class which integrates the API calls and token management.
  • main.py: Initializes GausiumMCP, registers the API functionalities as MCP tools using @mcp.tool(), configures basic logging, and starts the server using mcp.run().

Setup and Running

  1. Clone the repository:

    git clone https://github.com/cfrs2005/mcp-gs-robot.git
    cd mcp-gs-robot
    
  2. Create and activate a virtual environment using uv:

    uv venv
    source .venv/bin/activate  # On Windows use `.venv\Scripts\activate`
    
  3. Install dependencies using uv:

    uv pip install -r requirements.txt 
    # Or, if you prefer adding specific core packages:
    # uv add httpx "mcp[cli]"
    
  4. Configure Credentials: The application expects Gausium API credentials to be set as environment variables:

    • GS_CLIENT_ID: Your Gausium Application Client ID.
    • GS_CLIENT_SECRET: Your Gausium Application Client Secret.
    • GS_OPEN_ACCESS_KEY: Your Gausium OpenAPI Access Key.

    You can set these directly in your shell:

    export GS_CLIENT_ID="your_client_id"
    export GS_CLIENT_SECRET="your_client_secret"
    export GS_OPEN_ACCESS_KEY="your_access_key"
    

    (Alternatively, modify src/gs_openapi/config.py for development, but do not commit credentials).

  5. Run the server:

    python main.py
    

    By default, this starts the server using SSE transport on http://0.0.0.0:8000. You can modify main.py to use stdio transport if needed.

Connecting an MCP Client

Once the server is running, an MCP client (like Cursor or another compatible tool) can connect to it via the appropriate transport (SSE or stdio) to utilize the defined tools.

Usage with Cursor

Below is an example of how Cursor interacts with this MCP server:

Cursor Usage Screenshot

Debugging

You can monitor the server logs for debugging information. The basic logging configuration in main.py provides timestamps, levels, and source information.

Below is an example of the server log output during operation:

MCP Debug Screenshot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_gs_robot-0.1.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_gs_robot-0.1.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_gs_robot-0.1.1.tar.gz.

File metadata

  • Download URL: mcp_gs_robot-0.1.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for mcp_gs_robot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cc6308a1607935671e05a9aa1f3e1e38144b2f9538e6708fc326fafd3e42b9af
MD5 4915318814348bb0fa3a36ff077b6b5c
BLAKE2b-256 e9f293a9bd89243722e01a7a54476825621d9609dedb34971b41c27c6461c560

See more details on using hashes here.

File details

Details for the file mcp_gs_robot-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcp_gs_robot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for mcp_gs_robot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97a96fa57585552544cd11130c51d8b973bd1f90a5f6bd677c90a20a1e6ee53c
MD5 0c36b388973895ba07cafaa2fe72dc81
BLAKE2b-256 795f4fccf109b403eb634bddfa9627053499d34245b8adc308b926667b2a6958

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page