Skip to content
Connect an agent

Use the server

Self-hosting the engine

Run the Plotwork engine inside your own network as one container: the MCP tools for your agents and the REST drawing routes for your services, with no account and no request leaving your network. It is for platform and security teams at companies that cannot send diagram text to a hosted service.

For
  • Docker
  • Claude Code
  • Cursor
  • VS Code

TL;DR

QuestionAnswer
What is it?One container image with the diagram engine, MCP over Streamable HTTP at /mcp, the REST drawing routes under /v1, and /healthz.
Does anything leave my network?No. The server makes no outbound request, sends no telemetry, and stores nothing. Logs go to standard output and never hold diagram text.
What is not in it?Accounts, the portal, hosted diagram links, organisations, brand themes, and icon packs. Those are features of the hosted service.
How do I run it?Pull plotwork/selfhost, check its signature, put it in your registry, set PLOTWORK_TOKEN, and start it with Docker, Compose, Kubernetes, or the Helm chart at oci://ghcr.io/plotwork-official/charts/plotwork-selfhost.
How does an agent connect?Point the client at http://<host>:3106/mcp with the header Authorization: Bearer <token>.
Is it the same engine?Yes. The tools, their schemas, and the pictures are the same as the hosted service and the npm package.
Is it free?For individuals, non-commercial use, a 30 day evaluation, and organisations under 250 people and USD 10 million a year. A larger organisation needs a commercial licence, the self-hosting add-on to Enterprise. See Licence.

What is included

PartSelf-hostedHosted service
Every MCP tool of the local server (draw, edit, convert, import, map icons, sync Markdown, patterns, read, compare, validate, render, outline, search icons)YesYes
REST: validate, render, draw, edit, convert Mermaid, sync Markdown, find, get, and draw a patternYes, same paths and bodiesYes
read_diagram and compare_diagrams with a link to a hosted pictureNo: send the SVG text or the sourceYes
A viewUrl on a drawingNo: it points at Plotwork's viewerYes
Publishing, listing, and deleting hosted diagramsNoYes
Accounts, API keys, the portal, organisationsNoYes
Brand themes and icon packsNoYes, on plans that include them
Usage counting of any kindNoAnonymous daily totals

The REST routes take the same request bodies and answer the same shapes as the hosted API, so a client written for one works with the other after a change of base address and credential. The self-hosted server adds two answers the hosted API does not have: 503 engine.busy when every worker is busy and the queue is full, and 504 engine.timeout when a job runs past its deadline.

1. Get the image

The image is public, in two registries, with the same digest in both. Pick a version from the releases (opens in a new tab); latest follows stable releases and beta the previews, but a fixed version belongs in production.

sh
docker pull plotwork/selfhost:<version>docker pull ghcr.io/plotwork-official/plotwork-selfhost:<version>

Check what you pulled before you trust it. Every image is signed with Sigstore by the public repository's publish workflow, and carries build provenance and an SBOM:

sh
cosign verify plotwork/selfhost:<version> \  --certificate-identity-regexp '^https://github.com/plotwork-official/plotwork-selfhost/' \  --certificate-oidc-issuer https://token.actions.githubusercontent.com
gh attestation verify oci://plotwork/selfhost:<version> --repo plotwork-official/plotwork-selfhost

Then push it into your own registry, so your hosts pull it from inside your network. The examples on this page call your copy plotwork-selfhost.

PropertyValue
Imagesplotwork/selfhost on Docker Hub, ghcr.io/plotwork-official/plotwork-selfhost on GitHub
Platformslinux/amd64 and linux/arm64
BaseDistroless Node 24, pinned by digest
SizeAbout 55 MB
User65532, not root
FilesystemRuns with a read-only root filesystem; writes nothing
Port3106
Health checkBuilt in: GET /healthz over loopback
LicencesThe Plotwork Self-Hosted Licence, with every bundled component's licence, under /licenses in the image

2. Run it

Make a token and keep it in your secret store:

sh
openssl rand -hex 32

Run the container with the token in its environment:

sh
docker run -d --name plotwork \  --read-only --cap-drop ALL --security-opt no-new-privileges \  -p 127.0.0.1:3106:3106 \  -e PLOTWORK_TOKEN \  plotwork-selfhost

Check it:

sh
curl http://127.0.0.1:3106/healthz

With Compose

This file runs the server on an internal network, which has no route out. Docker publishes no port from an internal network, so the services that call Plotwork, such as an agent gateway or a reverse proxy, join the plotwork network and reach it at http://plotwork:3106. Put PLOTWORK_TOKEN in a .env file beside it, never in the file itself.

yaml
services:  plotwork:    image: plotwork-selfhost    restart: unless-stopped    environment:      PLOTWORK_TOKEN: ${PLOTWORK_TOKEN:?Set PLOTWORK_TOKEN in .env}      PLOTWORK_WORKERS: '2'    networks:      - plotwork    read_only: true    cap_drop:      - ALL    security_opt:      - no-new-privileges:true    mem_limit: 1g    pids_limit: 64
networks:  plotwork:    internal: true

With Kubernetes

The public repository has a manifest to start from, kubernetes.yaml (opens in a new tab): a namespace, two replicas as a non-root, read-only Deployment with health probes, a Service, and a NetworkPolicy with no egress. Create the token as a Secret, never in the file:

sh
kubectl apply -f kubernetes.yamlkubectl -n plotwork create secret generic plotwork --from-literal=token="$(openssl rand -hex 32)"

Agents in the cluster reach it at http://plotwork.plotwork.svc:3106/mcp. If you write your own manifest, set enableServiceLinks: false on the pod: a Service named plotwork otherwise makes Kubernetes set PLOTWORK_PORT to tcp://<address>:3106 in every pod, over the server's own setting, and the server stops at start with a message that says so.

With Helm

A Helm chart is released with every image, at the same version, and signed the same way. It installs two non-root, read-only replicas with no Kubernetes API token, a Service, a NetworkPolicy that allows no egress at all, and a PodDisruptionBudget. It needs Kubernetes 1.25 or newer.

Create the token as a Secret first, then install a fixed version and run its test:

sh
kubectl create namespace plotworkkubectl -n plotwork create secret generic plotwork --from-literal=token="$(openssl rand -hex 32)"
helm install plotwork oci://ghcr.io/plotwork-official/charts/plotwork-selfhost \  --version <version> --namespace plotwork \  --set auth.existingSecret=plotwork
helm test plotwork -n plotwork

Agents in the cluster reach it at http://plotwork.plotwork.svc:3106/mcp. The chart refuses to render without a token, unless you set auth.allowOpen=true where the network is the control. Check the chart's signature before you install it:

sh
cosign verify ghcr.io/plotwork-official/charts/plotwork-selfhost:<version> \  --certificate-identity-regexp '^https://github.com/plotwork-official/plotwork-selfhost/' \  --certificate-oidc-issuer https://token.actions.githubusercontent.com

The values most installs change:

ValueDefaultUse
auth.existingSecretnoneThe Secret that holds the token. Required, unless auth.allowOpen is true.
image.repositoryplotwork/selfhostYour registry's copy of the image.
image.digestnoneThe digest you verified, so every pod runs exactly that image.
replicaCount2Pods to run when autoscaling is off.
autoscaling.enabledfalseAdds a HorizontalPodAutoscaler on CPU, from 2 to 6 pods.
config.workers2Worker threads per pod. Keep it at or under the pod's CPU.
config.toolsfullcore for a model with a small context.
license.existingSecretnoneThe Secret that holds your licence key.
resources250m CPU and 256Mi requested, 1Gi memory limitRequests and limits.
ingress.enabledfalseAdds an Ingress. Terminate TLS there or in your mesh.
networkPolicy.ingress.namespacesnoneNamespaces, by name, whose pods may call, such as your ingress controller's or your agent gateway's. Pods in the release's namespace may always call.

For a network with no internet access, pull the chart and the image, push both into your own registries, and set image.repository and tests.image to your copies:

sh
helm pull oci://ghcr.io/plotwork-official/charts/plotwork-selfhost --version <version>helm push plotwork-selfhost-<version>.tgz oci://registry.example.internal/charts

The chart's README lists every value, and its values.schema.json refuses a value it does not know, so a typo stops the install instead of being ignored. The NetworkPolicy takes effect only where the network plugin enforces policies, as Calico, Cilium, and most managed clusters do.

Both the Compose file and the manifest are run as they are, on fresh machines, for every release, and the published chart is installed on a fresh cluster and its test run; see the verify workflow (opens in a new tab).

Settings

Every setting is an environment variable. A value the server cannot use stops it at start with a message that names the variable.

VariableDefaultMeaning
PLOTWORK_TOKENnoneThe bearer token for /mcp and /v1, at least 32 characters.
PLOTWORK_HOST0.0.0.0 in the imageThe address to listen on.
PLOTWORK_PORT3106The port to listen on.
PLOTWORK_ALLOW_OPENunset1 serves without a token on an address other than loopback. Use it only where the network itself is the control.
PLOTWORK_ALLOWED_ORIGINSnoneBrowser origins allowed to call, separated by commas.
PLOTWORK_WORKERS2Worker threads that run the engine. One layout uses one thread for up to a second.
PLOTWORK_QUEUE32Jobs that may wait for a worker before more are refused.
PLOTWORK_TIMEOUT_MS30000The deadline of one job, waiting included.
PLOTWORK_WORKER_MEMORY_MB512The heap limit of each worker.
PLOTWORK_MAX_BODY_BYTES4194304The largest request body.
PLOTWORK_MCP_RESULT_LIMIT44000Characters of an MCP drawing answer before its pictures are left out, so an AI client can read it.
PLOTWORK_TOOLSfullcore lists only the eight workflow tools on /mcp, with short descriptions, for an open model with a small context. See Use Plotwork with open and self-hosted models. Any other value stops the start.
PLOTWORK_LICENSEnoneYour licence. /healthz shows whether one is set and a short fingerprint of it, never the value.

Without PLOTWORK_TOKEN, the server listens on loopback only. The image listens on every address, so it does not start without a token unless PLOTWORK_ALLOW_OPEN=1 is set.

3. Connect an agent

Every client below sends the token as a bearer header. Replace plotwork.internal with the address of your server.

Claude Code

sh
claude mcp add --transport http plotwork http://plotwork.internal:3106/mcp \  --header "Authorization: Bearer $PLOTWORK_TOKEN"

Cursor

Add this to ~/.cursor/mcp.json:

json
{  "mcpServers": {    "plotwork": {      "url": "http://plotwork.internal:3106/mcp",      "headers": {        "Authorization": "Bearer ${env:PLOTWORK_TOKEN}"      }    }  }}

VS Code

Add this to .vscode/mcp.json. VS Code asks for the token once and keeps it out of the file:

json
{  "inputs": [    {      "type": "promptString",      "id": "plotwork-token",      "description": "Plotwork token",      "password": true    }  ],  "servers": {    "plotwork": {      "type": "http",      "url": "http://plotwork.internal:3106/mcp",      "headers": {        "Authorization": "Bearer ${input:plotwork-token}"      }    }  }}

A service over REST

sh
curl -X POST http://plotwork.internal:3106/v1/diagrams/render \  -H "Authorization: Bearer $PLOTWORK_TOKEN" \  -H "content-type: application/json" \  -d '{"source": "flow \"Checkout\"\nnode web service \"Web\"\nnode db database \"Orders\"\nweb -> db"}'

4. Licence

The image is free to pull. It is free to run for the uses below, under the Plotwork Self-Hosted Licence, in /licenses/LICENSE in the image:

WhoFree?
An individual, for themselvesYes
A charity, non-profit, school or research institution, for non-commercial workYes
Any organisation, evaluating it for up to 30 days, not in productionYes
An organisation with fewer than 250 employees and contractors and less than USD 10 million in annual revenue, counting its affiliates, for its own workYes
Any other organisationNeeds a commercial licence

The commercial licence is the self-hosting add-on to an Enterprise (opens in a new tab) contract, which also brings support from a named person and an uptime SLA. An organisation that grows past the free size has 90 days to license it or stop. Offering the engine to others as a hosted service needs a written agreement.

The server never stops working for want of a licence, so a network with no internet access is never broken by one. Set the key you are given as PLOTWORK_LICENSE: /healthz then shows its fingerprint, and without one the server says once at start which licence applies. The npm package and the command line are MIT, and this licence does not change them.

5. Security notes

TopicWhat the server doesWhat you do
TransportPlain HTTP.Put TLS in front: a reverse proxy, a service mesh, or an ingress.
AuthenticationOne static bearer token, compared in constant time. A missing or wrong token is a 401.Keep the token in a secret store, give each environment its own, and rotate it by restarting with a new one.
Outbound networkMakes no request. fetch and the socket clients are switched off in the process, and a link sent to a tool is refused.Block egress anyway, with an internal network, a network policy, or a firewall rule, so the container has no route out.
BrowsersRefuses a request whose Origin is not in PLOTWORK_ALLOWED_ORIGINS, which also stops a web page from reaching a server on loopback.List only the origins of your own tools.
LimitsA body cap, a bounded queue, a deadline on every job, and a heap cap on each worker. A job past its deadline is stopped and its worker replaced.Set container memory and CPU limits; about 250 MB at rest with two workers.
LogsOne JSON line per request and per tool call: path, status, tool, outcome, duration, and argument size. Never diagram text, a header value, or an error message.Collect standard output with your log pipeline.
StorageNone. Every request is worked on in memory and forgotten.Run with a read-only root filesystem.
TelemetryNone. PLOTWORK_USAGE, which turns on counting in the npm package, does nothing here.Nothing.

See also

DocWhy
MCP serverThe tools, and how the local and hosted servers differ
Connecting an agentClient settings for the hosted server and the npm package
API referenceRequest and response shapes of the REST routes
Privacy policyWhat the hosted service collects, none of which applies to a self-hosted server
Why Plotwork draws plain SVGWhy the pictures add no runtime dependency to the pages that show them