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.
- 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 availabilitylist_resources
: Query all volume resources in the storage systemlist_nodes
: Query all nodes in the Linstor cluster
- Environment-based Configuration: Configuration via environment variables
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
- Python 3.10 or higher
- Access to a Linstor cluster with REST API enabled
-
Clone or navigate to the project directory:
cd /path/to/mcp-linstor
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On macOS/Linux # or venv\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt
-
For development (includes testing tools):
pip install -r requirements-dev.txt
Configure the server using environment variables:
Variable | Description | Default |
---|---|---|
LINSTOR_BASE_URL |
Base URL of the Linstor REST API | http://localhost:3370 |
LINSTOR_TIMEOUT |
Request timeout in seconds | 30 |
LINSTOR_DEBUG |
Enable debug logging | false |
LINSTOR_USERNAME |
Optional: Username for authentication | None |
LINSTOR_PASSWORD |
Optional: Password for authentication | None |
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
# 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.
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