Skip to content

feat(webmcp): register the WebMCP tool catalog on form load - #1985

Open
rismehta wants to merge 1 commit into
devfrom
feat/webmcp-runtime
Open

feat(webmcp): register the WebMCP tool catalog on form load#1985
rismehta wants to merge 1 commit into
devfrom
feat/webmcp-runtime

Conversation

@rismehta

Copy link
Copy Markdown
Collaborator

What

Exposes each rendered form's WebMCP tool catalog to in-browser AI agents (Gemini-in-Chrome, ChatGPT Site tools, etc.) so they can drive the form through a declared tool catalog instead of scraping the DOM.

A single call at the form-container bootstrap seam (Utils.setupFormContainer, right after fields are initialised) hands the af-core model to the adapter:

registerFormWebMCP(formContainer.getModel());

Opt-in and safe by default

  • Per-form opt-in via the authored form property fd:webMcpEnabled (read by af-core's form.webMcpEnabled). Absent → nothing registers.
  • No-ops when no browser modelContext is available (SSR/unsupported browser).
  • Default behaviour is unchanged.

Changes

  • ui.frontend/src/utils.js — import registerFormWebMCP and call it once per form load.
  • ui.frontend/package.json — add @aemforms/af-webmcp.
  • ui.frontend/jest.config.js — allow @aemforms/af-webmcp through the ESM transform.
  • ui.frontend/__tests__/webmcp.test.js — asserts the catalog is registered once with the form model.

Dependency / release note

Requires the @aemforms/af-core + @aemforms/af-webmcp release that ships the WebMCP catalog (buildFormTools + the form.webMcpEnabled getter). Until it publishes, CI install of af-webmcp will fail — this is expected and clears with that release.

Design doc

Adaptive Forms Runtime via WebMCP (wiki)

🤖 Generated with Claude Code

Expose each rendered form's WebMCP tool catalog to in-browser AI agents by calling
registerFormWebMCP(model) from @aemforms/af-webmcp at the form-container bootstrap
seam (Utils.setupFormContainer, after fields init). No-ops unless the form opted in
via fd:webMcpEnabled and a browser modelContext is available, so default behaviour is
unchanged. Adds @aemforms/af-webmcp as a dependency and to the jest ESM allowlist.

Requires the @aemforms/af-core / @aemforms/af-webmcp release that ships the WebMCP
catalog (buildFormTools + the form.webMcpEnabled getter); until it publishes, CI
install of af-webmcp will fail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant