Skip to main content

MCP server

Overview​

The WebForms MCP server lets an AI assistant that speaks the Model Context Protocol (Claude Code, Claude Desktop and other MCP clients) work with your forms and submissions. It runs on the computer where the assistant runs, talks to the assistant over standard input and output, and turns each tool call that needs the store into a signed request to the Management API (list_sites without probe works locally). What the assistant can do is therefore limited by the permissions of the Magento integration the server signs with.

For a step-by-step guide aimed at store owners, see Connect an AI assistant.

What the server adds on top of the API:

  • Masked by default. Submission reads come back with personal data masked; they are unmasked only for an integration holding Disclose Personal Data, or through a short-lived disclosure grant (see Approval).
  • Visitor text marked as untrusted. Answers, notes, attachment file names and other text typed by visitors arrive as separate content blocks marked untrusted, cleaned of control characters and cut at 4000 characters. The store's warnings about an import, a created or duplicated form or a replaced draft document come the same way, at most five of 500 characters each; the structured answer then carries only warning_count. This tells the assistant which text is data; it does not by itself stop an assistant from following instructions hidden in that text, so the assistant must still treat it as data.
  • Retries without duplicates. Every write carries a request_id that the server records in a local journal (~/.webforms-mcp/journal.jsonl: operation, request id, a keyed hash of the arguments and the state, never the values). A write interrupted by a crash or a lost connection is retried with the same request_id, so the store replays it instead of doing it twice. A write whose outcome the store could not determine is not replayed: check its result before trying again. Creation tools also take an idempotency_key, see Creating without duplicates.
  • Several stores in one process, each with its own credentials.

Authentication​

The server signs every request with OAuth 1.0a (HMAC-SHA256) using a Magento integration's four OAuth values. It never follows redirects.

1. Create the integration​

On the store server:

bin/magento webforms:api:connect --preset=editor

The command creates and activates an integration named "WebForms MCP" and prints a connection string that carries the store address and the four OAuth values. Presets (reader, editor, support, full), --permissions, --forms=selected, --reissue and the other options are described on REST API. Linking submissions to orders needs the Sales order view permission in addition: no preset includes it. Add sales_orders_view to --permissions, which replaces the preset, so list every permission the integration needs. The notification tools need forms_edit (Edit and Publish Forms), which the editor and full presets include. Form scripts and markup that runs code in the form texts need forms_scripts (Edit Form Scripts), and set_submission_approval needs results_approve (Approve Results); no preset includes either, so add them to --permissions. The full preset includes Disclose Personal Data, so every submission read through it comes back unmasked without a grant.

2. Set up the server​

The server is the npm package @mageme/webforms-mcp; its source and the ready-made skills are in the public repository https://github.com/mageme/webforms-mcp. It needs Node.js 22.19 or later. webforms:api:connect prints the setup command below the connection string:

npx -y @mageme/webforms-mcp@1 setup --from

@1 keeps the server on the 1.x line: fixes arrive by themselves, a new major version only when you change it. To stay on one release until you decide to move, write the exact version instead, for example @mageme/webforms-mcp@1.0.0. webforms-mcp 1.x works with WebForms 4.x. The server checks the Node.js version when it starts and names the version it needs.

setup --from asks for the connection string, checks it against the store, then saves it. A credential set the store refuses is never saved. When the integration was made by hand in the admin, run setup without --from: it asks for the store address and the four OAuth values one by one. In scripts, pipe the string in, so it is neither typed into the shell nor passed as a command argument:

ssh store 'cd /path/to/magento && bin/magento webforms:api:connect --preset=editor --raw' | npx -y @mageme/webforms-mcp@1 setup --from-stdin
setup option What it does
--from Asks for a connection string. --from=<string> also works, but leaves the credentials in the process list, and setup warns about it
--from-stdin Reads the connection string from standard input
--profile <name> Saves the store under this name, for a second or further store
--isolated Keeps the store out of the shared process (see below)
--overwrite Replaces saved credentials of the same name
--allow-insecure Allows plain http to a host other than localhost. For development stores only
--insecure-tls Skips certificate checks. For development stores only

For a host other than localhost, *.local, *.test or *.localhost, setup refuses --allow-insecure and --insecure-tls unless WEBFORMS_MCP_ALLOW_INSECURE_TLS=1 is set in its environment. The server refuses such a store at start the same way, unless the variable is set in the server's own environment. The registration line setup prints never contains it: add it yourself (claude mcp add … -e WEBFORMS_MCP_ALLOW_INSECURE_TLS=1 -- …), and only for a development store.

Credentials are saved in ~/.webforms-mcp (or the folder named by WEBFORMS_MCP_HOME), in files the server creates readable by your user only. After a successful setup the command prints the form access of the integration (Form access: All Forms, Selected forms or No forms), the line that registers the server with Claude Code and the entry for Claude Desktop.

3. Register the server with the assistant​

claude mcp add webforms --scope user -- npx -y @mageme/webforms-mcp@1

On Windows (not WSL), npx runs through cmd /c: claude mcp add webforms --scope user -- cmd /c npx -y @mageme/webforms-mcp@1.

For Claude Desktop and other clients that read a JSON configuration:

{ "mcpServers": { "webforms": { "command": "npx", "args": ["-y", "@mageme/webforms-mcp@1"] } } }

On Windows: { "mcpServers": { "webforms": { "command": "cmd", "args": ["/c", "npx", "-y", "@mageme/webforms-mcp@1"] } } }.

Other commands​

Command What it does
npx -y @mageme/webforms-mcp@1 probe Checks every configured store (connection, API version, permissions, form access) and lists the API permissions each one grants, so a missing one shows up before it interrupts work
npx -y @mageme/webforms-mcp@1 sites Lists the stores this process would serve, without contacting them

Several stores​

One process serves every credentials.<name>.json in ~/.webforms-mcp. get_capabilities, and list_sites with probe: true, report each store's form access as form_access. Each tool takes a site argument (the store's name or host); use_site selects a store for the rest of the conversation, and list_sites shows which one is selected. With more than one store, ids are written with the store in front (acme:42): pass them back exactly as they came. A write that names a different store than the selected one is refused.

The shared process holds the credentials of every store it serves, so it is a convenience, not a wall between them. A store that must be kept apart gets its own process: set it up with --isolated, then register npx -y @mageme/webforms-mcp@1 --profile <name> as a separate server. WEBFORMS_MCP_PROFILE and WEBFORMS_MCP_CREDENTIALS_FILE select one store the same way; --profile wins over both.

Environment variables​

Variable What it does
WEBFORMS_MCP_HOME Folder for the credentials, the journal and the import folder. Default ~/.webforms-mcp
WEBFORMS_MCP_PROFILE Serves only this profile, as --profile does
WEBFORMS_MCP_CREDENTIALS_FILE Serves only this credentials file. Its name must be credentials.<key>.json or credentials.json, because the store key is read from it
WEBFORMS_MCP_IMPORT_ROOT Folder import files are read from. Default <WEBFORMS_MCP_HOME>/import
WEBFORMS_MCP_ALLOW_INSECURE_TLS 1 lets a store with --insecure-tls or plain http on a host that is not local be set up and loaded. Development stores only

The OAuth values never travel through the environment: they stay in the credentials file.

Operations​

84 tools. Each tool that calls the store needs the matching API permission on the integration; without it the store refuses the call. Every tool carries the MCP hints readOnlyHint, destructiveHint, idempotentHint and openWorldHint, so a client can tell reads from writes. search_submissions, get_submission_full, list_submission_notes, list_submission_attachments and use_site are not marked read-only: the first four can spend a disclosure grant, the last changes the selected store.

Area Tools
Stores list_sites, use_site
Store information get_capabilities, get_schema, list_templates, list_statuses, list_quick_responses, get_appearance, update_appearance
Forms list_forms, get_form, get_form_document, get_form_stats, get_translations, create_form, create_form_from_template, duplicate_form, activate_form, deactivate_form
Versions list_form_versions, get_form_version_document, restore_version
Drafts open_draft, get_draft, get_draft_document, draft_update_form, draft_add_section, draft_update_section, draft_remove_section, draft_reorder, draft_add_field, draft_update_field, draft_turn_field_into, draft_duplicate_field, draft_remove_field, draft_list_trash, draft_restore_field, draft_set_logic, draft_add_logic, draft_remove_logic, draft_set_translations, draft_replace_document, draft_validate, draft_prepare_publish, draft_publish, draft_discard
Notifications add_notification, update_notification, set_notification_content, set_notification_store_settings, set_notification_conditions, duplicate_notification, remove_notification, activate_notification, deactivate_notification
Confirmations get_confirmation_content, set_confirmation_content (the success message of one store view)
Reading submissions search_submissions, get_submission, list_submission_changes, list_submission_notes, list_submission_attachments
Working on submissions update_submission_values, set_submission_status, set_submission_approval, assign_submission, mark_submission, add_submission_note, link_submission_order, unlink_submission_order, mass_status, mass_assign, mass_read
Replies prepare_reply, send_reply
Personal data request_pii_grant, revoke_pii_grant, get_submission_full
Export export_submissions, get_export_status
Import prepare_import, commit_import, cancel_import, get_import_status

Each tool's description, which the assistant reads, says what it does and what it needs. A few rules that shape how the tools are used:

  • Drafts first. Structure changes go into a draft and reach visitors only with draft_publish. A field removed from the draft goes to the form's trash: draft_list_trash lists it and draft_restore_field brings it back. Form settings marked "live" in get_schema("form"), notification changes and a confirmation's success message apply at once, some of them only after a person's approval (see Approval).
  • Revisions. Draft and submission writes carry the revision the assistant last read; a stale one is refused, and the assistant reads again. The first time an admin opens an unread submission, its revision goes up once, so a write prepared before that is refused the same way.
  • Exports are masked CSV files. The export tools do not request the download link, so it never passes through the assistant. To download the file, request a one-time link yourself with the integration's credentials: see REST: Results.
  • Imports read a JSONL file from the store's own import folder on the assistant's computer: <import>/<store key>/, where <import> is ~/.webforms-mcp/import (it moves with WEBFORMS_MCP_HOME; WEBFORMS_MCP_IMPORT_ROOT wins over both) and the store key is the profile name, default for credentials.json. A process that serves one store also reads <import> itself.
  • Forms with code in their texts. Writing a script or other markup that runs code on the storefront, publishing a draft that brings it in, and switching on or duplicating a form whose texts already run code need forms_scripts (Edit Form Scripts); without it the store answers ACTOR_NOT_ALLOWED and the refusal names the store view, the text's key and the markup. get_form reports such a form with has_executable_markup.

The server also offers resources: webforms://{site}/schema/field-types, webforms://{site}/schema/document, webforms://{site}/guide/field-types and webforms://{site}/form/{id}/document. A process started for one store (--profile <name>, or with WEBFORMS_MCP_PROFILE or WEBFORMS_MCP_CREDENTIALS_FILE set) also answers them without {site}/.

Approval​

Three mechanisms hold back the tools that change what visitors see, send email, overwrite data or unmask personal data. The boundary that always holds is the integration's permissions, and the record is the store's audit log.

Changes the store holds for approval. The store itself refuses some writes with CONFIRMATION_REQUIRED until a person approves them (see REST API: Confirmations):

  • update_notification, set_notification_content, set_notification_store_settings and set_notification_conditions on a notification that is switched on;
  • draft_update_form when it changes a live setting with an effect beyond the form's page or a form script (the settings get_schema("form") marks with write: confirm or write: script, among them the page address, redirect, captcha, published results, automatic cleanup, Do Not Store Submissions, public file downloads, customer access and registration), or changes the submitter's address field so that a switched-on notification emails someone else;
  • set_submission_status and mass_status to a status that emails the customer (mass_status shows up to 10 masked addresses);
  • set_submission_approval when the verdict emails the submitter or registers a customer account;
  • set_confirmation_content, the success message a store view shows.

The first call changes nothing. It answers with the store's description of the change (recipients before and after, which settings change, who gets an email) and a confirmation_id; the same call with that confirmation_id applies it. Anything else goes through at once. If the store turns the approval down because the change is no longer the one approved (it would email someone else, a notification was switched on in between), nothing is applied: the answer describes the change anew, with what differs, under a new confirmation_id, and the person is asked again. A publish that changes whom a switched-on notification emails lists every address before and after.

Applied at once without a confirmation in 4.0: the default assignee (default_assignee_admin_user_id) and the Submission Title and Submitter Name templates (subject_template, submitter_name_template). These settings are write: direct.

Two-step actions. draft_prepare_publish → draft_publish and prepare_reply → send_reply (also activate_notification, and draft_remove_field when other parts of the form refer to the field) first return a preview and a confirmation_id. The token the store issues stays in the server's memory and never reaches the assistant. Confirmations expire after 10 minutes and are used once. A confirmation_id answers for the arguments of the call it was first used with; the same id with other arguments is refused.

The person's approval. Irreversible tools, and the approval of every held change above, take confirmed_by_user: true. That argument is only the assistant's own statement that you agreed, so the server goes further when it can:

  • When the client can put a question to the person (MCP elicitation), the server asks them directly, naming the store and what they approve (the new recipients, the settings, the publish plan, the start of the reply), and their answer decides, whatever the assistant sent. If the question fails or gets no answer within five minutes, nothing is done; the server never falls back to confirmed_by_user.
  • When the client cannot ask, the server accepts confirmed_by_user: true from the assistant, and its refusal carries what the person approves, as an untrusted block to show them. With such a client the assistant's word is what stands between it and an irreversible action.
  • request_pii_grant is issued only after a person confirms it in the client. A client without elicitation is refused.
  • deactivate_form on a form whose texts run code warns that, without Edit Form Scripts, the integration can't switch the form back on. A client without elicitation is refused on the first call, even with confirmed_by_user; the form goes off only on a call with both confirmed_by_user: true and warning_shown_to_user: true.
  • A confirmed call whose answer was lost can be repeated with the same confirmation_id: it goes out under the same request_id, and the person, who approved that very call, is not asked again.

Give the integration only the preset it needs: for example, without Request Temporary Disclosure no disclosure grant can be issued at all. Every grant and every disclosure is recorded.

A store on a development host, such as localhost or a host name ending in .local, .test or .localhost, can switch the approval question off with "confirmActions": false in its credentials file. The server refuses that setting for any other host, says so in its startup log, and list_sites shows confirm_actions: false for that store. The store's own confirmations and the two-step confirmation_id still apply.

Creating without duplicates​

Creation tools (create_form, create_form_from_template, duplicate_form, add_notification, duplicate_notification, add_submission_note, export_submissions) take an optional idempotency_key, any string unique to one intended creation. For 30 days the same key with the same arguments creates nothing again; the same key with other arguments is refused, and a new key makes another copy. A key whose first send the store refused as VALIDATION_FAILED or ACTOR_NOT_ALLOWED is free again, except for exports. The answer's idempotency.outcome is created, retried (an earlier identical call lost its answer), replayed (an identical call already created it) or not_created. Without a key, an identical call within 10 minutes is answered as replayed. Two calls that set opposite values, such as switching a form on and then off, go out as separate requests and are never replayed as one.

Several server processes can share one journal: they take turns through a lock file beside it. Past 8 MiB the journal is compacted to the requests still pending or undecided, the keys inside their 30 days and the last ten minutes. The journal belongs to one machine: don't share ~/.webforms-mcp between machines over a network folder, nor mount it into containers with different host names. A lock left there by a crashed server is never taken over and has to be deleted by hand.

Errors​

A refused tool call comes back as a tool error (isError: true) whose text names the store and reads as the error code, the HTTP status in brackets and the message, sometimes with a hint and the error's details, for example NOT_FOUND for an id that does not exist or that the integration cannot see, or DRAFT_REVISION_MISMATCH with the current revision. Most codes are those of the Management API: see REST API. The server adds its own:

Code When
ACTOR_NOT_ALLOWED Also when Magento refuses the route itself (HTTP 401 naming the missing resources). The text names the permission by its place in the tree, for example "MageMe Extensions > WebForms > API > Edit and Publish Forms" (MageMe_WebForms::api_v1_forms_edit); the store's own message is in details.message. A refusal for markup that runs code names the store view and carries the text's key and the markup as untrusted data
PII_GRANT_REQUIRED The hint names both ways in: a grant through request_pii_grant (Request Temporary Disclosure) or Disclose Personal Data
INDETERMINATE Also when the store failed with HTTP 500 while carrying out an approved change: it may or may not be applied, so read the current state first
UNAUTHORIZED HTTP 401 without a named resource: check the system clock and whether the integration was revoked, then run setup --overwrite --from with the store's --profile
NETWORK, BAD_RESPONSE The store could not be reached, or it answered without the API's JSON: the base URL points at a page, a proxy or a maintenance screen. A store that answers no WebForms API at all, not even /capabilities, gets a hint to install the WebForms API module
API_VERSION_UNSUPPORTED The store speaks another major API version than this release

INTERNAL on a creation repeated with the same idempotency_key comes back as the same error: check whether the object exists before calling again with a new key. A guarded tool called without approval answers "… Ask the user and pass confirmed_by_user: true.", or "The person was asked and did not approve it."

Examples​

list_sites in a process started with --profile dev:

{"mode": "dedicated", "sites": [{"key": "dev", "host": "yourdomain.com", "label": "yourdomain.com", "active": true}], "isolated": [], "diagnostics": [], "roster_complete": true}

get_form with form_id: 995656:

{"id": 995656, "code": "showroom_visit", "name": "Showroom Visit Request", "revision": 16, "is_active": true, "has_draft": false,
"draft_started_by_type": "", "draft_started_by_name": "", "updated_at": "2026-10-05T21:09:16Z", "warnings": [],
"_site": {"key": "dev", "host": "yourdomain.com", "label": "yourdomain.com"}}

get_submission returns the submission's status, revision and flags with masked_count (how many answers are withheld); the answers themselves arrive in a separate untrusted block, each as {state, value, display}, where value is null while the answer is masked.

Applies to WebForms 4Last reviewed November 24, 2026