feat(mcp): [DO-NOT-MERGE-POC] add CMA plugin surface — /mcp/da (18 tools) + /mcp/eds #59
Draft
anfibiacreativa wants to merge 3 commits into
Draft
feat(mcp): [DO-NOT-MERGE-POC] add CMA plugin surface — /mcp/da (18 tools) + /mcp/eds #59anfibiacreativa wants to merge 3 commits into
anfibiacreativa wants to merge 3 commits into
Conversation
…tools) - add src/mcp-server/handler.ts: dependency-free JSON-RPC MCP transport (initialize, tools/list, tools/call, ping) with safe error serialization - add src/mcp-server/da-registry.ts: full da-tools bundle (18 tools) mirroring the native DAAdminClient ops and skills/agents/memory loaders - add src/mcp-server/eds-registry.ts: eds-preview bundle (4 preview/publish tools) - wire /mcp/da and /mcp/eds routes in server.ts with Bearer auth pass-through - implement da_embed_fragment (previously advertised but never built), approval-gated, with path sanitization to prevent HTML-attribute injection - register da_get_skill under the Skills Editor's advertised name Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
content_read/content_update now check whether the target page is open in a
canvas (via da-collab presence) and, if so, read/apply through the live
da-collab session — which persists to da-admin — instead of writing da-admin
directly, which would be clobbered by the live editor. Falls back to da-admin
when da-collab is unbound, unreachable, or no human has the doc open.
- collab-client: add hasOtherHumanParticipants() (awareness-based open check)
- da-registry: openCanvasCollab() helper + collab-aware content_read/update;
createDAMCPRegistry takes optional { dacollab, daOrigin }
- server: pass env.DACOLLAB + env.DA_ORIGIN to the /mcp/da registry
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A headless MCP call can't tell whether a doc is open in a canvas, so the open-doc detection probe (hasOtherHumanParticipants) was fragile — it raced and failed open to da-admin, the exact clobber it aimed to prevent. Route content_read and content_update through da-collab unconditionally (persists to da-admin), falling back to da-admin only when da-collab is unbound or unreachable. Removes the awareness probe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
feat(mcp): add CMA plugin surface — /mcp/da (18 tools) + /mcp/eds (4 tools)
Summary
Adds the plugin surface that Claude Managed Agents (CMA) will register as remote MCP servers:
two dependency-free JSON-RPC-over-HTTP endpoints —
POST /mcp/da(18 tools) andPOST /mcp/eds(4 tools). This closes the 5-of-18 tool gap so the plugin exposes exactly what the Skills Editor
advertises. It is the code deliverable for SITES-47970 (CMA Migration Phase 1). CMA-first:
branched off
mainwith no AO code carried along.Problem / root cause
/mcp/dapreviously exposed only 5 of the 18 tools the Skills Editor'sda-toolsbundleadvertises (
content_list/read/create/update/delete). The other 13 existed only as nativeCloudflare-Worker tool bindings in the chat loop — there is no such worker under CMA, so an
authored agent that relied on them would silently lose functionality. The
eds-previewbundle's4 tools were likewise unavailable as an MCP endpoint.
What changed
initialize,tools/list,tools/call,ping) with safe error serialization (exposesmessage+statusonly; omits backend
details).da-toolsbundle (18 tools). The 13 added tools(
content_copy/move,content_version_create/list,content_media/fragment,content_upload,da_get_skill/create_skill,da_list_agents/create_agent,da_embed_fragment,write_project_memory) reuse the existingDAAdminClientmethods and theskills/agents/memory loaders — wiring, not new business logic.
eds-previewbundle (4 preview/publish tools)./mcp/daand/mcp/edsroutes withAuthorization: Bearerpass-through (401 on missing token; 503 if the DAADMIN binding is absent).
approval-gated, with path sanitization to prevent HTML-attribute injection.
da_read_skill).[REQUIRES_APPROVAL]description prefix; CMA's nativealways_askgate is what enforces the pause.
How to test
cdinto the branch checkout,npm ci, thennpm run dev(serves on http://localhost:4002).curl -s -X POST http://localhost:4002/mcp/da
-H "Authorization: Bearer test-token" -H "Content-Type: application/json"
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq '.result.tools | length'
npm test— expect the existing suite green (296 tests).Risk / follow-ups
dispatch level. End-to-end execution against real content (exp-workspace/frescopa) is NOT
included — it needs the live stack running plus a valid IMS token (Phase 1 finish-out).
tscreports one error at src/server.ts:348 (sessionIdpossibly undefined in the telemetry block) that already exists on
main.provisioning step (Phase 2), not part of this PR.