mcp-linstor

moandersson/mcp-linstor

3.2

If you are the rightful owner of mcp-linstor 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.

A Model Context Protocol (MCP) server for the Linstor storage system, enabling interaction with a Linstor cluster via its REST API.

Tools
3
Resources
0
Prompts
0

Linstor MCP Server

A Model Context Protocol (MCP) server for Linstor storage system. This server provides MCP tools to interact with a Linstor cluster via its REST API, enabling AI assistants and other MCP clients to query and manage Linstor storage resources.

Features

  • MCP Standard Compliance: Implements the MCP specification using FastMCP
  • Streamable HTTP Transport: Uses streamable-http transport for efficient communication
  • Tools:
    • ping: Health check for Linstor API availability
    • list_resources: Query all volume resources in the storage system
    • list_nodes: Query all nodes in the Linstor cluster
  • Environment-based Configuration: Configuration via environment variables

Architecture

The project is structured for maintainability and testability:

mcp-linstor/
ā”œā”€ā”€ server.py              # Main MCP server with FastMCP
ā”œā”€ā”€ config.py              # Configuration management
ā”œā”€ā”€ linstor_client.py      # Linstor REST API client
ā”œā”€ā”€ requirements.txt       # Production dependencies
ā”œā”€ā”€ requirements-dev.txt   # Development dependencies
└── tests/                 # Comprehensive test suite
    ā”œā”€ā”€ test_config.py
    ā”œā”€ā”€ test_linstor_client.py
    └── test_server.py

Installation

Prerequisites

  • Python 3.10 or higher
  • Access to a Linstor cluster with REST API enabled

Setup

  1. Clone or navigate to the project directory:

    cd /path/to/mcp-linstor
    
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On macOS/Linux
    # or
    venv\Scripts\activate  # On Windows
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. For development (includes testing tools):

    pip install -r requirements-dev.txt
    

Configuration

Configure the server using environment variables:

VariableDescriptionDefault
LINSTOR_BASE_URLBase URL of the Linstor REST APIhttp://localhost:3370
LINSTOR_TIMEOUTRequest timeout in seconds30
LINSTOR_DEBUGEnable debug loggingfalse
LINSTOR_USERNAMEOptional: Username for authenticationNone
LINSTOR_PASSWORDOptional: Password for authenticationNone

Example Configuration

export LINSTOR_BASE_URL="http://linstor-controller.example.com:3370"
export LINSTOR_TIMEOUT="60"
export LINSTOR_DEBUG="true"

Or create a .env file:

LINSTOR_BASE_URL=http://linstor-controller.example.com:3370
LINSTOR_TIMEOUT=60
LINSTOR_DEBUG=true
LINSTOR_USERNAME=admin
LINSTOR_PASSWORD=secret

Usage

Running the Server

# Activate virtual environment
source venv/bin/activate

# Run the server
python server.py

The server will start on the default MCP streamable-http transport and will be ready to accept MCP client connections.

MCP Specification

This server implements the Model Context Protocol specification for tools:

  • tool/list: Lists available tools (ping, list_resources, list_nodes)
  • tool/call: Executes a tool with given parameters
  • tool/results: Returns tool execution results

The server uses:

  • Transport: streamable-http (stateless with JSON responses)
  • FastMCP: Simplified MCP server implementation from the official Python SDK

References