Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Claude connector — WYRM in Claude Desktop (ADR 0041)

Claude works on your broker network as one gateway user. It reads the tree, values and history. After a dry run that you approve, it writes values, runs actions, deploys dataflows and runs checked plans. The user’s role decides what is allowed. You need no API key: Claude Desktop runs the connector on your computer, and it logs in to the gateway like Studio does.

1. A gateway user for Claude

Create a user of its own, so the audit shows which changes Claude made. On the broker host, run this (the password is read from stdin):

wyrmd -c wyrmd.json5 user add claude --roles operator
RoleWhat Claude can do
viewerread devices and storage
operatorread, write points, run write-level actions, read flows
engineeralso config-level work: add/edit devices, deploy flows (needs Allow config-level changes too)

2. Install the extension

  1. Get wyrm-<version>-darwin.mcpb (macOS) or wyrm-<version>-win32.mcpb (Windows) from the CI run of claude-desktop (Actions → claude-desktop → Artifacts; the workflow is packaging/claude-desktop/ci-workflow.yml, copied to .github/workflows/claude-desktop.yml), or build it yourself:
    packaging/claude-desktop/build.sh --universal
    
    The file goes to dist/claude-desktop/. On Windows, run bash packaging/claude-desktop/build.sh from Git Bash.
  2. Double-click the file, or in Claude Desktop open Settings → Extensions → Install Extension….
  3. Fill in the form:
SettingValue
Gateway URLhttps://<broker>:<port>. For a gateway on this computer (the demo), http://127.0.0.1:8445. Plain HTTP to another host is refused, because the password would go in clear.
Gateway user / Passwordthe user from step 1. Claude Desktop keeps the password in the system keychain.
Gateway CA certificatethe PEM that signs the gateway’s certificate: the broker CA, or the certificate itself when it is self-signed. Leave it empty for a certificate from a public CA.
Read-onlyrefuses every change
Allow config-level changesoff by default. When it is off, Claude can show config-level changes (config points and actions, anything under sys, flow deploys) but not send them.
  1. Start a chat and ask “who are you on WYRM?”. Claude calls whoami and answers with the user, the site and the grants.

3. What to expect

  • Before a change, Claude reads the node’s ~meta, runs a dry run and shows what it would send. A link built with spec 0.2.33 or later also checks the call itself without running it (checked_by_link: ok or the refusal the action would give, ADR 0047); an older link is checked against its ~meta only. Claude Desktop asks you before each tool call. Allow only what you have read.
  • Several dependent steps (add a device, wait for it, set a value, expect a reading) go in one plan_run. Claude checks the plan first and applies it after you agree.
  • Claude does not approve a plan of the agent link (tasks/<id> ▸ approve): the connector refuses it and so does the gateway for the remote connector. Approve it in Studio (ADR 0049).
  • Keys: downstream/modbus/plc1/temp means a key on the gateway’s own site. wy/<site>/… reaches a site below it.
  • When the session expires (8 h by default), the connector logs in again by itself.

4. When it does not work

MessageCause
wrong user or password, or the user is disabledFix the settings under Settings → Extensions → WYRM.
TLS: invalid peer certificate: UnknownIssuerSet Gateway CA certificate to the PEM of the broker CA or of the self-signed certificate.
plain HTTP only on loopbackUse https:// for a gateway on another host. The gateway serves TLS when tls_cert/tls_key or tls: "site_ca" are set in wyrmd.json5; for site_ca, set Gateway CA certificate to the broker’s data_dir/pki/ca.pem.
Connection refusedThe gateway is not running, or the port is wrong (gateway.listen in wyrmd.json5).
refused_by_connector: … allow_configA config-level change. Turn on Allow config-level changes if the user’s role should be used for it, or do it in Studio. After the switch, quit Claude Desktop (⌘Q) and open it again: a chat keeps talking to the connector process it started with, and that process read the old setting. whoami shows connector.allow_config as it is in force.
permission_deniedThe user’s role does not allow it.
… takes no file: invoke it over the WebSocket, with arguments under 60 KiBA text or map argument is too large. Send less at a time (one branch of an import). Only a parameter with editor: file takes more (up to 64 MiB).

Logs: in Claude Desktop, open Settings → Developer, or open the extension’s log file (mcp-server-WYRM.log).

Claude Code and other MCP clients

The same binary runs anywhere MCP runs:

{
  "mcpServers": {
    "wyrm": {
      "command": "/abs/target/release/wyrm-mcp",
      "args": ["--gateway", "https://broker.example:8445", "--user", "claude", "--gateway-ca", "/abs/broker-ca.pem"],
      "env": { "WYR_GATEWAY_PASSWORD": "…" }
    }
  }
}

Without --gateway, wyrm-mcp is the Zenoh-side server with approval tokens (mcp.md).

Claude on the web and mobile: the remote connector

The gateway serves an MCP endpoint at https://<broker>/mcp itself, with its own OAuth 2.1 sign-in (ADR 0041 stage B). You add it once on claude.ai, and it works on the web, in Desktop and on mobile. It is off by default. It needs a public HTTPS name that Claude’s servers can reach.

  1. In wyrmd.json5:
    gateway: {
      listen: "0.0.0.0:8445",
      tls_cert: "/etc/wyrm/gateway.pem",   // a certificate for broker.example from a public CA
      tls_key: "/etc/wyrm/gateway.key",
      mcp: {
        public_url: "https://broker.example:8445",
        // optional: redirect_uris (default: Claude's callbacks and "loopback"),
        // access_ttl_s (60…3600, default 3600), refresh_days (1…365, default 30)
      },
    },
    
    Restart wyrmd. https://broker.example:8445/.well-known/oauth-protected-resource now answers with JSON.
  2. On claude.ai, open Settings → Connectors → Add custom connector, name it WYRM, and set the URL to https://broker.example:8445/mcp. No client ID or secret is needed: Claude registers itself.
  3. Claude opens the gateway’s sign-in page. Enter the gateway user (step 1 above) and the password, choose Allow changes and/or Allow config-level changes, and sign in.

What is checked:

  • Only redirect URIs on the allowlist register: Claude’s callbacks, and loopback for MCP clients on your own computer.
  • The code is single use, lasts 60 s, and is bound to PKCE S256.
  • An access token lasts at most 1 h and is valid only on /mcp, never as a Studio session.
  • Refresh tokens are bound to the client. A new password, a disabled user or a removed user ends every token.
  • Each sign-in is in the audit as mcp_sign_in, with the client’s name and what was allowed.

Exposure: the gateway is reachable from the internet. Put it behind a reverse proxy that passes /mcp, /oauth/* and /.well-known/oauth-* and allows only Anthropic’s published egress IP ranges for /mcp and /oauth/token. The sign-in page itself opens in your browser. If you cannot expose the gateway, use the Desktop extension above: it needs no inbound access.