Repository navigation
feat(plugin-forms): offer forms and submissions as MCP tools - #4027
Draft
eisenbruch wants to merge 2 commits into
Draft
eisenbruch wants to merge 2 commits into
eisenbruch wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 20e6bfe The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
upgrade-emdash
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-ai-search
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Contributor
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
11 of 18 tasks
eisenbruch
force-pushed
the
feat/forms-mcp-tools
branch
from
October 21, 2026 20:44
aaa75e8 to
20e6bfe
Compare
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.
What does this PR do?
Offers four forms-plugin routes as MCP tools, so an API token can read form submissions without the
adminscope:forms_listsubmissions_listsubmissions_getsubmissions_update(status, starred, notes; it does not touch what the visitor sent)The problem. Every private plugin route requires the
admintoken scope (authorizePrivatePluginRouteRequest), whatever permission the route declares. So an agent that works a site's content through the MCP server, with a token that deliberately has noadmin, cannot see what arrived through the site's forms. On our site that means it cannot read listing claims or business submissions, and an editor has to copy them across by hand. Plugin MCP tools (#2002, Discussion #1587) are the designed way round this, and the forms plugin declares none.Relation to #2229. #2229 exposes all ten management routes and has had changes requested since August 12. This PR is narrower on purpose and settles both review points:
forms/listnow takeslimit(1 to 100, default 100) andcursorand forwards them to the query. The route's input isformsListSchema.prefault({}), so the admin's existing calls, which send{}, and a caller that sends no body still get the first 100.I am happy to close this in favor of #2229 if its author picks it up, or to add tools here if you would rather have the wider set in one PR.
REST behavior is unchanged. A tool can only bind to a route that names its permission, so the four routes now state
permission: "plugins:manage", which is what they defaulted to. Tools stay off until a site admin enables them for the plugin, and a token needsmcp:toolsormcp:tools:emdash-forms.Discussion: #1587
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
Not applicable (no UI change).
tests/mcp-tools.test.tschecks what the runtime checks before it will register a tool (the route exists, is private, names a permission, and is a JSON POST route), because a tool that fails any of those is dropped silently. It also checks that delete, export and the form-editing routes are not bound, that the REST permission is where it was, and that the forms list pages and still accepts an empty or missing body.Run against a deployed site (EmDash 1.2.0 on Cloudflare Workers, this change carried as a patch) with a token holding only
content:readandmcp:tools: the four tools are listed,forms_listreturns the site's nine forms, andsubmissions_listandsubmissions_getreturn a form's submissions. A token withoutmcp:toolsgetsINSUFFICIENT_SCOPE: requires mcp:tools:emdash-formsfrom the same tools.submissions_updatewas not run against that site.