Skip to content

fix(mcp): publish drafts through scoped workspace bridges#205

Merged
DavidBabinec merged 1 commit into
mainfrom
fix/mcp-publish-after-write
Jul 10, 2026
Merged

fix(mcp): publish drafts through scoped workspace bridges#205
DavidBabinec merged 1 commit into
mainfrom
fix/mcp-publish-after-write

Conversation

@DavidBabinec

@DavidBabinec DavidBabinec commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an explicit, capability-gated site_publish MCP tool that runs the canonical publish pipeline, rebuilds Layer-A static artifacts, and records the MCP connector in the publish audit
  • split the live editor relay into independent Site and Content workspace bridges, surface draft-save failures, and make content_* tools execute through the open Content workspace
  • load uncached content documents by id across post-type collections and commit workspace focus before returning, so immediate follow-up writes cannot race the target collection load
  • keep MCP-created content as drafts until site_publish, enforce delegated own/any permissions before browser relay, and require step-up authentication when minting connector tokens
  • preserve the headless site_list_documents catalog from fix(mcp): serve site_list_documents headlessly over MCP #186 while updating MCP/content/agent documentation and HTTP, relay, authorization, and UI regression coverage

Root cause

MCP site writes flushed only the editor draft; saving a draft does not invoke the publisher, so the public static HTML and CSS never changed. The single live bridge was also mounted only by the Site workspace and always dispatched through the site-tool executor, which made content_* calls fail as unknown tools. Content document activation additionally searched only the currently loaded collection and reported success before React committed the new selection.

User and developer impact

MCP writes now remain safely private as drafts until an authorized caller invokes site_publish. Site and Content workspaces can stay connected simultaneously, and content mutations reuse the same browser-side workflow and permission boundaries as the admin UI. Cross-collection activation loads rows by id and is fully committed before the next tool runs.

Verification

  • bun test — 6,045 passed, 0 failed
  • bun run build
  • bun run lint
  • npx react-doctor@latest --verbose --scope changed — no new diagnostic; the existing PR-wide SitePage barrel-import warning remains
  • regression: activate an uncached document in collection B, immediately write a field before B's list resolves, then resolve the stale list; both calls succeed and the saved row remains active
  • fresh-install live reproduction before the fix: site_apply_css changed the draft but anonymous HTML/CSS hashes and computed style stayed unchanged; content_create_document returned an unknown-tool error
  • fresh-install live retest after the fix: content_create_document created a visible draft in Content; the CSS remained private before site_publish; after site_publish, anonymous text changed from black/16px to rgb(210, 24, 24)/48px, both static artifact hashes changed, and the publish audit identified the MCP connector

Closes #195

Comment thread src/admin/pages/content/agent/useContentToolBridge.ts Fixed
@DavidBabinec
DavidBabinec force-pushed the fix/mcp-publish-after-write branch 2 times, most recently from adeb78c to 3b7a15e Compare July 10, 2026 22:01
@DavidBabinec
DavidBabinec force-pushed the fix/mcp-publish-after-write branch from 3b7a15e to 30b4334 Compare July 10, 2026 22:06
@DavidBabinec
DavidBabinec marked this pull request as ready for review July 10, 2026 22:19
@DavidBabinec
DavidBabinec merged commit 10448bc into main Jul 10, 2026
9 checks passed
@DavidBabinec
DavidBabinec deleted the fix/mcp-publish-after-write branch July 10, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MCP site_* and content_* tools update data but never trigger a static site rebuild

1 participant