Skip to main content
Glama

incus-mcp

An MCP server for Incus. It lets an MCP client such as Claude Code read an Incus server or cluster (instances, snapshots, profiles, networks, storage, images, projects, operations and warnings) and change it in two steps: a plan that shows what would change, then one apply.

It uses the official Incus Go client, connects the way the incus CLI does, and runs over stdio or over HTTP behind a gateway.

Tools

Reads are always on. Each is annotated read-only and closed-world.

Tool

What it returns

incus_server

Version, API extensions, storage, kernel, clustering, whether this client is trusted; with resources=true the host's CPU, memory, disks and GPUs

incus_instances

Containers and VMs with status, addresses, CPU and memory use, limits, profiles. Filters: type, status, project, all_projects

incus_instance

One instance: own and expanded config and devices, live state, snapshots, backups

incus_instance_log

Lists an instance's log files, or returns the end of one

incus_profiles, incus_networks, incus_storage

Profiles; networks with state and DHCP leases; pools with space used and their volumes

incus_images, incus_projects, incus_cluster

Local images; projects; cluster members

incus_operations, incus_warnings

Background operations; server warnings

incus_get

Any other GET on the REST API, with the path checked against the Incus REST spec

Config values whose key looks like a secret (password, secret, token, private key, API key) come back as <hidden> in every answer, the audit log included.

With INCUS_MCP_TOOLS=all two more tools appear:

  • incus_plan takes a list of ops and writes nothing. It checks each op against the live server and returns the steps, what each would change (config keys before and after), and an expect text such as 0 create, 1 change, 0 delete, 0 exec.

  • incus_apply(plan_id, expect) runs the plan once.

The ops:

Op

Does

instance-create

From images:<alias> (the public image server) or a local alias or fingerprint, with type, profiles, config, devices; start=true starts it

instance-update

Sets or unsets config keys, adds, replaces or removes devices, replaces profiles, changes the description

instance-state

start, stop, restart, freeze, unfreeze

instance-rename, instance-delete

Rename a stopped instance; delete one with its snapshots (a running one only with force=true)

snapshot-create, snapshot-restore, snapshot-delete

Snapshots, with optional expiry

exec

Runs a command in a running instance and returns exit code, stdout and stderr (64 KiB each)

profile-*, network-*, volume-*, project-*

create, update, delete

api

Any other POST, PUT, PATCH or DELETE on the REST API, checked against the REST spec

Related MCP server: Caddy MCP

How changes stay safe

Three switches decide what an apply may do. INCUS_MCP_WRITE=1 allows creates and changes. INCUS_MCP_DELETE=1 also allows deletes and snapshot restores, since a restore overwrites the instance's disk. INCUS_MCP_EXEC=1 allows running commands. A plan that needs a switch the server lacks is refused when it is made, and the switch is checked again on apply. Raw api calls are counted the same way, so an exec or a file write inside an instance through the API still needs INCUS_MCP_EXEC.

Before anything runs, an op is refused if its object is missing, already in the wanted state, still in use (for deletes) or badly named. An instance-update that would change nothing is refused too.

Each step sends the ETag Incus gave at plan time. If the object changed in between, Incus refuses the write and the apply stops at that step. The answer lists the steps that ran, the one that failed and the ones that did not run.

Incus ignores config keys it does not know and still reports success, so after a write the server reads the object back and reports any key that did not stick.

A plan is used once and expires after 15 minutes. It lives only in the running process, so a restart drops it. The expect text has to come back unchanged, which means the count a person approved is the count that runs.

Every plan and every applied step is appended to audit.jsonl in the state directory. If the log cannot be written, the apply stops.

incus_get and the api op accept only a method and path that exist in the Incus REST spec bundled with the build. A mistyped path is refused here and never reaches the server.

Text from inside instances

Some answers carry text that whoever controls an instance can write: incus_instance_log, the output of exec, and what incus_get reads from inside an instance, such as files and exec logs. The model reads it like any other tool result, so a guest can plant instructions in it. Such text cannot change anything on its own, because every write still needs a plan, its expect text and an apply. Keep a person in front of incus_apply (Claude Code asks before each call unless you allow the tool), and when a model works with instances you don't trust, run the server without INCUS_MCP_EXEC.

Install

go install github.com/androsmeda/incus-mcp@latest

Each tagged release has binaries for Linux, macOS and Windows (amd64 and arm64) with checksums and SBOMs on the Releases page, and the image ghcr.io/androsmeda/incus-mcp:vX.Y.Z (also :latest) for amd64 and arm64: a static binary on distroless, non-root, HTTP mode on. GitHub attests the build provenance of both, so gh attestation verify <file> --repo androsmeda/incus-mcp or gh attestation verify oci://ghcr.io/androsmeda/incus-mcp:vX.Y.Z --repo androsmeda/incus-mcp checks where a binary or image came from. Every commit on main also gets an amd64 image tagged with its commit SHA.

Each release is also listed in the MCP Registry as io.github.androsmeda/incus-mcp. The entry runs the image over stdio, with your certificate directory mounted read-only at /certs and every switch off by default.

Connecting to Incus

By default it uses the incus CLI's config (~/.config/incus/config.yml, or $INCUS_CONF): if incus list works for you, this works too, with the same remote and certificate. INCUS_MCP_REMOTE picks a remote other than the default.

Without a CLI config, for example in a container, give the address directly:

  • INCUS_MCP_URL=unix:///var/lib/incus/unix.socket for the local socket

  • INCUS_MCP_URL=https://host:8443 with INCUS_MCP_CLIENT_CERT and INCUS_MCP_CLIENT_KEY (file paths), and INCUS_MCP_SERVER_CERT to pin the server's certificate

A new client certificate:

openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -sha384 -nodes -days 3650 \
  -subj "/CN=incus-mcp" -keyout incus-mcp.key -out incus-mcp.crt
incus config trust add-certificate incus-mcp.crt

At start it checks that Incus trusts it. Incus answers untrusted clients too, so without this check a missing trust would only show up at the first tool call. A certificate added with --restricted --projects=... limits the server to those projects.

Configuration

Variable

Default

Meaning

INCUS_MCP_REMOTE

the CLI's default remote

Remote from the CLI config

INCUS_MCP_URL, INCUS_MCP_CLIENT_CERT, INCUS_MCP_CLIENT_KEY, INCUS_MCP_SERVER_CERT

Direct connection, see above

INCUS_MCP_PROJECT

default

Project for tools called without one

INCUS_MCP_TOOLS

read

read, or all for plan and apply

INCUS_MCP_WRITE, INCUS_MCP_DELETE, INCUS_MCP_EXEC

off

What an apply may do, see above

INCUS_MCP_STATE_DIR

user config dir /incus-mcp

Where audit.jsonl goes

INCUS_MCP_TRANSPORT

stdio

stdio or http

INCUS_MCP_HTTP_ADDR

127.0.0.1:8000

HTTP listen address

INCUS_MCP_HTTP_TOKEN

Required for HTTP: at least 32 printable characters

INCUS_MCP_HTTP_ALLOWED_HOSTS

127.0.0.1:<port>,localhost:<port>,[::1]:<port>

Host headers to accept, comma separated

Claude Code

claude mcp add incus -- incus-mcp
claude mcp add incus -e INCUS_MCP_TOOLS=all -e INCUS_MCP_WRITE=1 -- incus-mcp

The first is read-only. The second adds plan and apply, with creates and changes allowed. Unless you have allowed the tool in your settings, Claude Code asks before each call to incus_apply.

Over HTTP, behind a gateway

INCUS_MCP_TRANSPORT=http serves streamable HTTP at /mcp (stateless, JSON responses). Each request needs exactly one Authorization: Bearer <INCUS_MCP_HTTP_TOKEN> header and a Host header from the allow-list; anything else gets 401 or 403. It speaks plain HTTP, so keep the port on a private network or localhost.

docker run -d --name incus-mcp \
  -e INCUS_MCP_HTTP_TOKEN=... -e INCUS_MCP_HTTP_ALLOWED_HOSTS=incus-mcp:8000 \
  -e INCUS_MCP_URL=https://incus.lan:8443 \
  -e INCUS_MCP_CLIENT_CERT=/certs/client.crt -e INCUS_MCP_CLIENT_KEY=/certs/client.key \
  -e INCUS_MCP_SERVER_CERT=/certs/server.crt \
  -v /path/to/certs:/certs:ro -v incus-mcp-state:/state \
  ghcr.io/androsmeda/incus-mcp:<sha>

Development

go test ./...
go test -race ./...   # needs cgo; CI runs it on Linux

The tests run the real Incus client library against a fake Incus server (internal/fake) over HTTPS with a pinned certificate, including async operations, ETags and exec over websockets.

internal/spec/routes.txt is generated from doc/rest-api.yaml in the Incus repository. For a new Incus release:

go run ./internal/spec/gen path/to/rest-api.yaml v7.7.0 > internal/spec/routes.txt

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP server for managing Incus containers and VMs via the incus CLI. Supports operations on remotes, instances, images, networks, storage, profiles, projects, and snapshots.
      -
    • A
      license
      B
      quality
      B
      maintenance
      Local MCP server for managing PasarGuard panels via their REST APIs, supporting read operations and a two-step plan/apply workflow for safe writes. It handles nodes, cores, hosts, groups, and users with confirmation-based changes and rollback plans.
      22
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server exposing scoped, read-only enterprise operations tools with fail-closed credential handling. It returns opaque approval IDs for mutations and requires a separate operator approval command to release one-time capabilities.
      MIT