npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lxd-mcp

v1.1.0

Published

MCP server for LXD container management

Downloads

247

Readme

LXD MCP Server

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.

Prerequisites

  • LXD: Daemon must be installed and running on the host
  • Node.js: Version 20 or higher
  • Socket Access: Server must run on the LXD host with access to the LXD Unix socket

Installation

Choose one of the following methods to install and run the LXD MCP Server.

Run as systemd service (recommended)

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

Run manually

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 lxd group 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 $USER

Important: You must log out and log back in (or run newgrp lxd) for group changes to take effect.

Agent Configuration

The LXD MCP Server exposes an HTTP endpoint at /mcp. Configure your AI agent to connect to it as a remote MCP server.

OpenCode

{
  "mcp": {
    "servers": {
      "lxd": {
        "type": "remote",
        "url": "http://localhost:3000/mcp",
        "enabled": true,
        "headers": {
          "Authorization": "Bearer {env:ACCESS_TOKEN}"
        }
      }
    }
  }
}

Claude Desktop and Claude Code

Claude supports remote MCP servers via the Connectors UI. Go to Settings > Connectors in claude.ai to add your server:

  1. Enter your MCP server URL: http://localhost:3000/mcp
  2. For authentication, configure OAuth or API key in the advanced settings

Alternatively, use the CLI command (Claude Code only):

claude mcp add --transport http lxd http://localhost:3000/mcp --env ACCESS_TOKEN="your-token"

Cursor

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.

Example Prompts

Once configured, try asking your agent:

  • "List all running LXD containers"
  • "Create a new Ubuntu 22.04 container called web-server"
  • "Start the test-container and run apt-get update inside it"
  • "Show me the server resources (CPU, memory, disk)"
  • "Create a profile for web server with 2 CPU cores and 4GB memory"

Environment Variables

| 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 |

Security

Important: The server must run on the LXD host due to socket access requirements.

  • Set ACCESS_TOKEN to enable bearer token authentication (recommended for network exposure)
  • Use LXD_PROJECTS to restrict access to specific projects
  • See docs/security.md for detailed security guidance

Documentation

License

MIT License - see the LICENSE file for details.