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.4.tar.gz (18.4 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.4-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_gs_robot-0.1.4.tar.gz
  • Upload date:
  • Size: 18.4 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.4.tar.gz
Algorithm Hash digest
SHA256 4130077c0a60afdd0d603cd8b764ef8d6307cf5089529b77fa26cfdb03c121c2
MD5 8190fe32c2c4f51535764e1ea90d9a0d
BLAKE2b-256 3c7b7335ea3c00101f66ffbd50591bfba64e8dcb546488ff6599c69f8eb9c7b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_gs_robot-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 23.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b0f2875db42e9d366359dd501b78be104767ac68d44c72a1ffcafccb72c3a691
MD5 e773379168d74b6403fbbbfeadfe2ad3
BLAKE2b-256 f6c710ed4ccf860c64ecd8650759d4c83ec46fed3e531d57f5df803522eaef64

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