loading…
Search for a command to run...
loading…
Enables AI assistants to manage LXD containers and virtual machines through a standardized MCP interface for lifecycle management, image operations, and server
Enables AI assistants to manage LXD containers and virtual machines through a standardized MCP interface for lifecycle management, image operations, and server monitoring.
A Model Context Protocol (MCP) server for managing LXD containers and virtual machines. Enable AI assistants to interact with LXD through a standardized interface for container lifecycle management, image operations, and server monitoring.
Choose one of the following methods to install and run the LXD MCP Server.
This is the recommended method for production use. The service runs automatically on boot and handles logging and auto-restart.
# Install the server globally
npm install -g lxd-mcp
# Copy the service file to systemd directory
sudo cp lxd-mcp.service /etc/systemd/system/
# Reload systemd to pick up the new service
sudo systemctl daemon-reload
# Start the service
sudo systemctl start lxd-mcp
# Enable auto-start on boot
sudo systemctl enable lxd-mcp
If you prefer to run the server manually (for development or testing):
# Install globally
npm install -g lxd-mcp
# Run with default settings
lxd-mcp --port 3000
# Or run directly without installing
npx lxd-mcp --port 3000
⚠️ Important: LXD Group Membership Required
When running manually (not as a systemd service), your user must be a member of the
lxdgroup to access the LXD Unix socket. Without this, you'll get a "LXD socket not found" error.To add your user to the LXD group:
sudo usermod -a -G lxd $USERImportant: You must log out and log back in (or run
newgrp lxd) for group changes to take effect.
The LXD MCP Server exposes an HTTP endpoint at /mcp. Configure your AI agent to connect to it as a remote MCP server.
{
"mcp": {
"servers": {
"lxd": {
"type": "remote",
"url": "http://localhost:3000/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:ACCESS_TOKEN}"
}
}
}
}
}
Claude supports remote MCP servers via the Connectors UI. Go to Settings > Connectors in claude.ai to add your server:
http://localhost:3000/mcpAlternatively, use the CLI command (Claude Code only):
claude mcp add --transport http lxd http://localhost:3000/mcp --env ACCESS_TOKEN="your-token"
Add to your ~/.cursor/mcp.json:
{
"mcpServers": {
"lxd": {
"url": "http://localhost:3000/mcp",
"headers": {
"Authorization": "Bearer your-access-token"
}
}
}
}
Note: Replace http://localhost:3000/mcp with your server's actual URL if running remotely.
Once configured, try asking your agent:
| Variable | Default | Description |
|---|---|---|
LXD_SOCKET_PATH |
/var/snap/lxd/common/lxd/unix.socket |
Path to LXD Unix socket |
ACCESS_TOKEN |
(none) | Bearer token for API authentication |
LXD_PROJECTS |
(all) | Comma-separated list of allowed projects |
LOG_LEVEL |
info |
Logging level: debug, info, error |
PORT |
3000 |
Server HTTP port |
Important: The server must run on the LXD host due to socket access requirements.
ACCESS_TOKEN to enable bearer token authentication (recommended for network exposure)LXD_PROJECTS to restrict access to specific projectsMIT License - see the LICENSE file for details.
Выполни в терминале:
claude mcp add lxd-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.