AI agents (MCP)
EmVB gives AI agents (Claude, ChatGPT, Cursor and other MCP clients) a small set of tools to read and build EmVB pages. Agents only change drafts: every change is validated like an edit in the editor, shows in the page’s version timeline with an Agent badge, and a person publishes it, unless an admin allows agent publishing.
Requirements
- EmDash 1.2 or later with MCP on:
emdash({ mcp: true, … }). The rest of EmVB still works on EmDash 1.0 and 1.1; only the agent tools need 1.2. @perkyzz/emvb0.5.0 or later on the site (0.8.0 recommended: it adds the saved-section tools; 0.7.0 giveslist_versionstimes as ISO 8601 UTC and adds theNOT_SET_UP, image-source and hidden-element checks and refuses links, SVG markup and duplicate class or variable names the page would drop), with Set up EmVB done once. Before that, the page tools answerNOT_SET_UP.- An admin turns agents on in Pages VisualBuilder → AI agents (off by default), and approves the EmVB tools on EmDash’s Plugins screen. EmDash asks again whenever the tool list changes, for example after an EmVB update.
- For the local bridge: Node 20 or later on the agent’s computer.
Two ways to connect
| Remote | Local (stdio) | |
|---|---|---|
| Endpoint | https://your.site/_emdash/api/mcp (EmDash’s own) |
npx -y @perkyzz/emvb-mcp --site https://your.site |
| Sign-in | OAuth through EmDash, or an API token as a Bearer header | An EmDash API token in EMVB_TOKEN or --token-file |
| Tools | emvb__list_pages, emvb__add_element, … |
list_pages, add_element, … |
| Extras | — | Resources (schemas, page layouts), prompts and the emvb-page-builder skill |
Remote config:
{ "mcpServers": { "emvb": { "url": "https://your.site/_emdash/api/mcp" } } }
Local config:
{
"mcpServers": {
"emvb": {
"command": "npx",
"args": ["-y", "@perkyzz/emvb-mcp", "--site", "https://your.site"],
"env": { "EMVB_TOKEN": "<your EmDash API token>" }
}
}
}
Bridge options:
| Option | What it does |
|---|---|
--site <url> |
Your site. https:// is required, except http:// for localhost, 127.0.0.1, [::1] and *.localhost. |
EMVB_TOKEN |
The API token (environment variable). |
--token-file <path> |
Reads the token from a file instead. Since 1.1.2 the bridge refuses a file other users can read; run chmod 600 on it, or pass --allow-loose-token-file to use it with a warning. |
--allow-publish |
Lists publish_page and publish_site_styles. The site’s AI agents settings still decide whether they run. |
The bridge refuses a token passed on the command line (--token), and logs to stderr only.
Tokens and permissions
- Create the token in EmDash → API tokens with the scope
mcp:tools:emvb. - The token’s user must be an editor or above. Never use an admin token for an agent.
- EmDash checks the scope and the role before any EmVB tool runs.
- A wrong, revoked or expired token is refused; the bridge says to create a new one.
Rate limits
Each token may make 300 reads and 60 changes a minute, and 10 publishes an hour. The
counts live in the site database, so they hold on Node and Cloudflare, on EmDash’s endpoint and
through the bridge, whichever process answers. Over the limit a tool returns RATE_LIMITED with
“Try again in N seconds” (and retryAfterSeconds in the error details). EmVB stores a hash of
the token, never the token. Calls signed in without a token are counted per user.
Tools
| Read | Write (draft only) | Publish (only when allowed) | Proposals (reviewed in the editor) |
|---|---|---|---|
list_pages, get_layout, describe_page, list_element_types, get_site_styles, list_section_recipes, list_templates, get_accessibility_findings, list_versions, list_saved_sections, get_page_brief |
create_page, add_element, move_element, update_element, remove_element, apply_section_recipe, insert_template, restore_version, update_site_styles, save_section, insert_saved_section, delete_saved_section |
publish_page, publish_site_styles |
list_page_outline, propose_changes, get_proposal, withdraw_proposal, get_requests |
list_element_typeslists every element with its settings, including the 1.3 marketing widgets (Counter, Progress bar, Countdown, Map, Price table, Price list, Call to action, Flip box, Animated headline, Share buttons, Hotspots). Like Social links and Gallery pictures, Price list items, Share links and Hotspots go only inside their own parent: add the parent with itschildren, or add them to it.- Extension elements (1.4.1).
list_element_typesalso lists the elements of the extensions registered on the site (Extensions), typedext:<package>/<name>, with their label asname, their props schema as JSON Schema, the inspectorfields, theextensionid and anexamplewith the schema’s defaults.add_elementandupdate_elementaccept them: props are checked by the extension’s own schema, defaults fill the props left out, and invalid props are refused withINVALID_INPUTnaming each one, never replaced. An extension element holds no children. One whose extension isn’t registered (or was removed) isn’t listed, can’t be added and can’t be changed (REFUSED);remove_elementstill removes it, andpropose_changesfollows the same rules. - Since 1.4 it also lists the Search form (
search-form) and the Theme toggle (theme-toggle). A Menu item takespanelPartId, the id of a published Section theme part, to open it as a mega menu panel (agents can’t create the Section itself), andpanelWidth. A sticky element’s style takesmotion.sticky(scroll effects), and a colour variable inupdate_site_stylestakes adarkvalue for dark mode. - Only what the agent sets (1.4.1).
add_elementfills a required prop the agent leaves out with the element’s default, so the element stays valid, but leaves optional props unset. The Add panel’s sample content (a Price table’s description, excluded feature, button and Featured ribbon, a Call to action’s text and button, a Map’s coordinates, a Testimonial’s role, and the like) is for people to edit and never reaches an agent’s element. Settings such as a Counter’s thousands separator or a form field’s label keep their defaults.list_element_typesstill shows the full Add panel default asexample.propose_changesstores elements exactly as sent. - Writes take an optional
expectedRev; a stale one returnsCONFLICT. Every write returns a newrev: pass that one to the next write. - Style references to a site variable can leave out
from; EmVB fills it in from the variable’s kind and refuses ids and classes that don’t exist, listing the ones that do. create_pageuses the slug EmDash derives from the title and refuses a taken one. It starts from sectionrecipesor from a starter pagetemplate(list_templates), not both.- The title heading (1.4.1). Without a template or a
herorecipe first,create_pagestarts the page with an H1 of its title. An agent that builds its own H1 can passtitleHeading: falseto leave it out. Otherwise, the firstadd_elementwhose element holds an H1 removes that title heading, as long as nobody has changed it and it is the page’s only H1, so the page keeps one H1 and it comes first; the write’schangedandsummaryname the removed heading. A title heading someone edited stays. In a proposal, delete it yourself (seelist_page_outline). insert_templateadds a starter section template in the site’s styles with new ids; its H1 becomes an H2 when the page already has one. See Starter templates.update_site_styleschanges the style draft only, and refuses to remove a variable a page or class still uses unlessforce: true.- Saved sections (guide):
save_sectionstores a copy of an element in My sections (agents save copies only; synced sections are made in the editor).insert_saved_sectionfirst adds the classes the section uses to the style draft (a class with the same name but a different look is added as a numbered copy, never overwritten), then adds the section to the page.delete_saved_sectionis marked destructive; pages keep copies already inserted. All four need an editor token and go through the same write queue as other writes. - Proposals (1.0):
list_page_outlinereturns a compact tree, thebaseRevisionandbaseDesignRevisiona proposal must name, whether someone has the page open in the editor, and the proposals already waiting.propose_changesstores ordered changes (insert,move,update,delete,class,variable) for a person to accept or reject one by one; nothing is saved or published until they do, and agents never publish through a proposal. Every change is checked against the current page first: a refused one names its index (Change 2: …), a stale revision returnsCONFLICT.get_proposalsays whether a stored proposal still applies;withdraw_proposalremoves one. A site keeps at most 100 proposals and a page at most 10 waiting for review (REFUSEDpast that). - A whole page as one proposal (1.4):
get_page_brieftakes the page’spurpose(required, up to 1,000 characters), an optionalaudience(500) andsections(up to 12 names of 80 characters), and an optionalpageId. It returns a ready brief: those inputs echoed back as data (never instructions), the site’s colour, font, font size and spacing variables (id, name, value) and its classes (id, name), every element type with whether it holds children and where it may go (list_element_typeswith atypegives its props), the limits (100 changes per proposal, 512 KB, 2,000 elements, 24 levels), the accessibility rules the editor checks, and the steps. With apageIdit adds the page’s root id, outline and thebaseRevisionandbaseDesignRevisionto propose against. The agent creates the page withcreate_pageif there is none, then sends the whole page in onepropose_changescall: oneinsertper section with its children inline,classorvariablechanges for styles it needs, and deletes for the starter content. Everything it sends is checked like any proposal; a refused change names its index. In the editor’s Agent tab the proposal is one card, each section named by its first heading and its size (“Add Section “The menu” to Container (12 elements)”): Preview shows the whole page on the canvas, Accept all applies it as one undo step, or accept section by section. The local bridge’sdraft_whole_pageprompt runs these steps. emvb-mcp watch(1.0) is the reference way to answer them: it pollsget_requestsand runs your agent command (for example--agent "claude -p") once per request, with the request on stdin and never in the command line. Run an agent limited to the EmVB tools, with no shell or file tools;watchkeepsEMVB_TOKENout of its environment unless--pass-token. See the bridge’s README.- Requests from the editor (prompt relay): in the editor’s Agent tab a person types what
they want and clicks Send to agent. Their own agent (signed in with their token; a request is
private to its author, and
get_requestsnever returns anyone else’s) reads open requests withget_requests(oldest first, optionally for one page) and answers withpropose_changesplus therequestId; the request then shows Answered and the proposal waits for review. No model runs on the site and no key is stored: the agent runs wherever the person runs it. Requests are at most 2,000 characters, five can wait per page, and they stop being offered after a day. The tab says when an agent last checked for requests. - A page open in the editor is not written directly. While someone has it open, the write tools
that change that page (
add_element,update_element,restore_version, …) refuse withPAGE_OPEN; send the change withpropose_changesinstead. The editor renews this every 30 seconds; a closed tab frees the page at once, a crashed one within 90 seconds. - A page is limited to 512 KB of layout (
TOO_LARGE), 2,000 elements and 24 levels of nesting. - Errors come back as tool errors with a code (
INVALID_INPUT,INVALID_LAYOUT,NESTING,NOT_FOUND,CONFLICT,PUBLISH_DISABLED,FORBIDDEN,REFUSED,TOO_LARGE,NOT_SET_UP,RATE_LIMITED,PAGE_OPEN) and a message the agent can act on. - Agents can’t create popups or other Theme Builder parts, forms (a form element needs the id of an existing form), delete pages, upload media or load web fonts.
Resources, prompts and the skill (local bridge)
- Resources:
emvb://schema/layout,emvb://schema/design,emvb://docs/layout-format,emvb://elements,emvb://site/styles, and each page’s draft asemvb://pages/{pageId}/layoutor its accessibility findings asemvb://pages/{pageId}/a11y. - Prompts:
build_landing_page,fix_accessibility,restyle_site,review_pageanddraft_whole_page(1.4: purpose, audience, sections and an optional page id; see above). - The
emvb-page-builderskill (skill://emvb-page-builder/SKILL.mdand its references, including a design guide) teaches an agent the workflow. It is also in the package’sskill/folder, to copy into an agent’s skills directory.
Publishing
Agent publishing is off by default. In AI agents, an admin can separately allow Agents may publish pages and Agents may publish site styles. While they are off:
publish_pageandpublish_site_stylesrefuse withPUBLISH_DISABLED(the local bridge only lists them with--allow-publish; EmDash’s endpoint always lists them).- EmVB also refuses EmVB pages published through EmDash’s own
content_publishMCP tool.
What people see
- Setup card (1.0, top of the AI agents page): checks that EmDash’s MCP endpoint is on, that EmVB’s tools are approved on EmDash’s Plugins screen (done once an agent has used this version’s tools), that agent access is on, and links to API tokens. After an EmVB update that changes the tool list, EmDash hides the tools until an admin approves them again: if your agent doesn’t see EmVB’s tools after updating, approve them again.
- AI agents page (admins, under Pages VisualBuilder): whether agents are on, the master switch, the two publish switches, the endpoint, connect snippets and the last 50 agent changes with who made them and a link to the page.
- Version timeline: an Agent badge on versions an agent saved, and an All / People / Agents filter with counts.
- Editor: if an agent changes the page while you are idle, a notice offers Reload.
- Agent tab (1.0): Ask your agent box with your requests and when an agent last checked, then proposals for the open page, each change with Accept and Reject, Preview to see them on the canvas first, and Via agent on the version you save afterwards.
Security notes
- Agents can’t change the AI agents settings; no tool writes them.
- Every agent write is validated with the same rules as the editor and the save hook.
- Known limits, raised with EmDash: plugin writes skip
content:beforeSavehooks of other plugins, and there is a short window between EmVB’s revision check and the write. - Who made an agent’s change. EmDash records no author on pages and versions an agent makes:
the entry and its revisions have no
authorId. EmVB knows the token’s user, but EmDash 1.4 and 1.5 give plugins no way to set it: the plugin content API’screateandupdatetake no author, and it hides revision authors from plugins, solist_versionsanswersauthorId: nulltoo. This needs a change in EmDash. Until then EmVB keeps its own record: each agent change, with the user whose token made it, is in AI agents → recent agent changes and marked Agent in the page’s version timeline.
Debugging
scripts/mcp-inspector.sh https://your.site ./token.txt opens the MCP Inspector on the local
bridge.