docs(canvas): update Universal MCP snippet — molecule-mcp now standalone

The canvas tab snippet for the Universal MCP path was written before
this PR added the built-in register + heartbeat thread. Earlier wording
described it as "outbound-only — pair with the Claude Code or Python SDK
tab for heartbeat + inbound messages" — that's stale. molecule-mcp now
handles register + heartbeat itself; the only thing it doesn't yet do is
inbound A2A delivery.

Updated:
- externalUniversalMcpTemplate header comment + body — describes
  standalone behavior, points operators at SDK/channel only when they
  need INBOUND (not heartbeat).
- Drops the now-redundant curl-register step from the snippet — the
  binary registers itself on startup.
- Canvas modal label likewise updated.

No runtime / behavior change; pure docs polish so a copy-pasting
operator's mental model matches what the binary actually does.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hongming Wang 2026-04-30 15:52:15 -07:00
parent 427300f3a4
commit 876c0bfcd4
2 changed files with 22 additions and 25 deletions

View File

@ -195,7 +195,7 @@ export function ExternalConnectModal({ info, onClose }: Props) {
{tab === "mcp" && filledUniversalMcp && (
<SnippetBlock
value={filledUniversalMcp}
label="Universal MCP — outbound tools for any MCP-aware runtime (Claude Code, hermes, codex). Pair with Python or Claude Code tab for heartbeat + inbound."
label="Universal MCP — standalone register + heartbeat + tools for any MCP-aware runtime (Claude Code, hermes, codex). Pair with Python or Claude Code tab if you need inbound A2A delivery."
copyKey="mcp"
copied={copiedKey === "mcp"}
onCopy={() => copy(filledUniversalMcp, "mcp")}

View File

@ -104,7 +104,7 @@ claude --channels plugin:molecule@Molecule-AI/molecule-mcp-claude-channel
# pairing flow, push-mode upgrade, and v0.2 roadmap.
`
// externalUniversalMcpTemplate — runtime-agnostic outbound tool path.
// externalUniversalMcpTemplate — runtime-agnostic standalone path.
// Ships as the `molecule-mcp` console script in the
// molecule-ai-workspace-runtime PyPI wheel (workspace/mcp_cli.py).
// Any MCP-aware runtime (Claude Code, hermes, codex, third-party)
@ -112,41 +112,38 @@ claude --channels plugin:molecule@Molecule-AI/molecule-mcp-claude-channel
// container-bound runtimes use today: delegate_task, list_peers,
// send_message_to_user, commit_memory, etc.
//
// Outbound-only: the binary doesn't heartbeat or accept inbound A2A.
// Pair with the Claude Code channel tab (poll-based inbound) or the
// Python SDK tab (push-mode inbound + heartbeat) to keep the workspace
// online and surface inbound messages. The snippet calls that out
// explicitly so an operator copy-pasting it doesn't end up with a
// silently-offline workspace.
// Standalone: the binary itself handles register-on-startup +
// continuous heartbeats (daemon thread, 20s cadence). No separate
// SDK or channel process needed to keep the workspace online. The
// only thing it does NOT yet do is poll inbound A2A messages — for
// runtimes that need their agent to react to canvas messages or
// peer-initiated tasks, pair with the Claude Code channel tab
// (poll-based inbound delivery into a Claude Code session) or the
// Python SDK tab (push-mode inbound + heartbeat).
//
// Origin/WAF: handled automatically by platform_auth.auth_headers()
// in the wheel — operator doesn't need to configure anything.
const externalUniversalMcpTemplate = `# Universal MCP call platform tools from any MCP-aware runtime
# (Claude Code, hermes, codex, etc.). Outbound-only pair with the
# Claude Code or Python SDK tab for heartbeat + inbound messages.
const externalUniversalMcpTemplate = `# Universal MCP standalone register + heartbeat + outbound platform tools
# for any MCP-aware runtime (Claude Code, hermes, codex, etc.).
# Pair with the Claude Code or Python SDK tab if your runtime needs
# inbound A2A delivery (canvas messages agent conversation turns).
# 1. Install the workspace runtime wheel:
pip install molecule-ai-workspace-runtime
# 2. One-shot register (pair with SDK/channel for ongoing heartbeat):
export WORKSPACE_AUTH_TOKEN="<paste from create response>"
curl -fsS -X POST "{{PLATFORM_URL}}/registry/register" \
-H "Authorization: Bearer $WORKSPACE_AUTH_TOKEN" \
-H "Origin: {{PLATFORM_URL}}" \
-H "Content-Type: application/json" \
-d '{"id":"{{WORKSPACE_ID}}","url":"","agent_card":{"name":"My Agent"},"delivery_mode":"poll"}'
# 3. Wire molecule-mcp into your agent's MCP config. Claude Code:
# 2. Wire molecule-mcp into your agent's MCP config. Claude Code:
claude mcp add molecule -s user -- env \
WORKSPACE_ID={{WORKSPACE_ID}} \
PLATFORM_URL={{PLATFORM_URL}} \
MOLECULE_WORKSPACE_TOKEN="$WORKSPACE_AUTH_TOKEN" \
MOLECULE_WORKSPACE_TOKEN="<paste from create response>" \
molecule-mcp
# Same env-var contract works with hermes-agent, codex, or any MCP
# stdio runtime. Tools exposed: delegate_task, delegate_task_async,
# check_task_status, list_peers, get_workspace_info,
# send_message_to_user, commit_memory, recall_memory.
# molecule-mcp registers the workspace + heartbeats every 20s in a
# daemon thread, then runs the MCP stdio loop. Same env-var contract
# works with hermes-agent, codex, or any MCP stdio runtime. Tools
# exposed: delegate_task, delegate_task_async, check_task_status,
# list_peers, get_workspace_info, send_message_to_user,
# commit_memory, recall_memory.
#
# Origin/WAF handling is built into the wheel no manual headers
# needed when calling tools through the MCP server.