Files
SynthesisAgent.ClaudePlugin/README.md
zhi 813f81af9a feat: real channel-bridge client + reply tool
- WS client to OpenclawPlugin's bridge (auto-reconnect with exponential
  backoff)
- On hello: send (openclaw_session, claude_session, pid) — no auth token
- On inbound frame: emit notifications/claude/channel into MCP so Claude
  Code opens a new turn
- Single MCP tool `reply(text, final?)` — model calls it to send a
  reply back via the bridge. final=false streams progress chunks
- Capability declared under `experimental.claude/channel` (top-level was
  silently ignored — bug confirmed against Anthropic's discord plugin)
- Dropped auth handshake + permission_request reverse channel per the
  same-machine, full-perms design call

Add .mcp.json so the package is also a valid Claude Code plugin (for
potential plugin: form deployment later).
2026-05-14 13:28:14 +00:00

2.2 KiB

SynthesisAgent.ClaudePlugin

Stdio MCP server registered as a Claude Code --channels server:<name> source. Lives inside every long-lived Claude process spawned by SynthesisAgent.OpenclawPlugin.

What it does

  • Connects out (WebSocket) to OpenclawPlugin's bridge on startup, sends hello
  • Listens for inbound frames → emits notifications/claude/channel so Claude opens a new turn
  • Exposes a single reply(text, final?) MCP tool — the model calls it to send its answer back to the OpenClaw side

Capability declaration (important detail)

new Server({...}, {
  capabilities: {
    tools: {},
    experimental: {
      'claude/channel': {},
    },
  },
})

Top-level placement of 'claude/channel' is silently ignored — Claude Code logs "server did not declare claude/channel capability". Verified 2026-05-14 against the official Anthropic discord plugin source.

Required env vars

Set by OpenclawPlugin's process-manager when spawning claude:

Var Example
SYNTHESIS_WS_URL ws://127.0.0.1:18901/bridge
SYNTHESIS_OPENCLAW_SESSION developer::discord:channel:123
SYNTHESIS_CLAUDE_SESSION <uuid>

Manual registration (laptop smoke test)

To use this MCP server with claude --channels server:synthesis, register it once globally:

claude mcp add --scope user synthesis -- bun run /absolute/path/to/server.ts

Then OpenclawPlugin can spawn:

claude --channels server:synthesis \
       --dangerously-load-development-channels server:synthesis \
       --resume <uuid> \
       --permission-mode bypassPermissions

(The --dangerously-load-development-channels flag triggers a one-time interactive dev-mode confirmation. OpenclawPlugin's process-manager pipes "1\n" to stdin shortly after spawn to dismiss it automatically.)

Tool surface (v1)

Just reply. The model uses Claude Code's built-in tools (Read, Edit, Bash, etc.) for any actual work; reply is purely the output channel.

reply(text, final=true) sends a complete answer. reply(text, final=false) queues a progress chunk; OpenclawPlugin buffers chunks until a final call arrives.

License

Apache-2.0 (modeled after Anthropic's official discord@claude-plugins-official plugin).