Gutenberg MCP — Edit Blocks & Templates with AI (15 Tools)

What is Gutenberg MCP?

Gutenberg MCP means editing a WordPress page block by block by describing the change to an AI assistant, instead of clicking into the block editor yourself. Cowboy MCP gives an AI agent 15 block-editor tools over the Model Context Protocol: it reads any post or page as a block tree, makes surgical edits to individual blocks, manages reusable patterns, and — on a block theme — edits Site Editor templates, template parts, global styles and navigation menus, with every write previewed and reversible.

MCP is the open standard an AI client uses to discover and call those tools, and the same Cowboy MCP plugin that manages your posts, WooCommerce store and plugins exposes the Gutenberg tools on every site; nothing extra has to be installed, because the block editor is part of WordPress itself. Instead of you opening the editor and hunting for the right block, the agent parses the page into an addressed tree, changes exactly the block you name, and reads the result back.

What can an AI agent do with Gutenberg?

An agent can handle the edits you would otherwise click through in the editor: read a page as a tree of blocks with a path address for each one, update a heading or paragraph in place, insert, move, replace or delete blocks, create and update synced or unsynced patterns, and — on block themes — save Site Editor templates and template parts, change the global colours and typography defined in theme.json, and list the block-theme navigation menus. Each of the 15 tools maps to one real block-editor operation, so the assistant fills in the details rather than guessing.

Here are all 15 tools. The names below are the real tool identifiers the agent sees.

Tool What it does
wp_list_blocks Parse a post's content into a block tree with dot-path addresses (such as 1.0.2), plus a content hash for safe concurrent edits; works on any post type, including patterns and navigation menus
wp_list_block_types List the block types registered on the server, or read one type's full attribute schema
wp_edit_blocks Apply a batch of block operations to a post or template — update, insert, replace, delete and move — all-or-nothing, addressed against the tree you just read
wp_list_patterns List block patterns: theme- and plugin-registered patterns (read-only) and user patterns, synced or unsynced
wp_get_pattern Read one pattern with its content and block tree
wp_create_pattern Create a user pattern; synced patterns update everywhere they are used, unsynced ones are copied on insert
wp_update_pattern Update a user pattern's title, content or categories
wp_delete_pattern Delete a user pattern, reporting any posts that still reference a synced one
wp_list_templates List Site Editor templates and template parts — theme files, database customisations and custom templates — with source and override status
wp_get_template Read one template or template part: metadata, content and block tree
wp_save_template Save a template or template part: update a customisation, create an override of a theme file, or create a new custom template
wp_reset_template Delete a template's database customisation so it reverts to the theme file; custom-only templates are deleted outright
wp_get_global_styles Read global styles — the user's Site Editor customisations alone, or merged with the theme defaults as the site actually renders them
wp_update_global_styles Write user global styles, deep-merging into the existing settings or replacing a section wholesale
wp_list_navigations List block-theme navigation menus with their link structure, ready to edit with wp_edit_blocks

Three real prompts, to make it concrete:

How do block edits stay safe?

Letting an agent rewrite a page's structure is only reasonable if you can preview it and take it back. Cowboy MCP wraps every Gutenberg write in the same guardrails it applies across the whole site: a dry-run preview, a confirmation gate on the destructive tools, a per-change undo entry, a full audit trail, and an extra guard against markup that could run on your front end.

Every call is also written to the audit log, and your MCP client asks you to approve each tool call, so a human stays in the loop at both layers. The full guardrail model lives on the security page.

What are Gutenberg MCP's limits?

Cowboy MCP works with the editor's data, not its canvas. It reads and rewrites the block tree that WordPress stores, but it is not a visual editor: it cannot render a live preview, position elements by eye, or judge how a layout looks. It changes the blocks and attributes you name inside the structure that already exists, and the result is whatever the block's own markup renders.

Two boundaries are worth knowing. First, the Site Editor tools — templates, template parts, global styles and navigation menus — need a block theme; on a classic theme the agent sees the eight content and pattern tools and the template tools are not registered. Second, a page built with a page builder or stored as classic (non-block) HTML comes back as classic content rather than a block tree, so block-level edits do not apply; the Elementor, Beaver Builder and SiteOrigin integrations cover those. Think of the agent as a fast, careful assistant for the structured parts: a mechanical change across many posts, a template-part swap, or a brand-colour update everywhere it is defined. Designing a new section from scratch is still work for the editor.

How do I set it up?

Setup takes about five minutes and needs no code. Install the Cowboy MCP plugin, connect your AI assistant, and start with a read-only request like listing the blocks on a page. The Gutenberg tools are always on — the block editor ships with WordPress — and the Site Editor tools appear automatically when your active theme is a block theme.

  1. Install the plugin. In wp-admin, go to Plugins → Add New, search for "Cowboy MCP", and click Install then Activate. It is free on the WordPress.org plugin directory (opens in new tab) and needs WordPress 6.2+ and PHP 8.0+.
  2. Connect your AI. Open Settings → Cowboy MCP and follow the guided setup. See how to connect WordPress to Claude or how to connect WordPress to ChatGPT for the full walkthrough.
  3. Ask for something real. Start read-only — "list the blocks on my homepage with their paths" — then let it act. Ask for a dry run of the first edit, and safe mode checks with you before anything destructive.

FAQ

Can an AI agent edit a single block without rewriting the whole page?

Yes — that is the point of the block tree. The agent reads the page with wp_list_blocks, which gives every block a dot-path address, then sends wp_edit_blocks a batch of operations against those addresses: update one heading, insert a pattern after a paragraph, move a section, delete a block. The batch is all-or-nothing, it fails fast if the page changed since the agent read it, and the rest of the page is left untouched.

Does Gutenberg MCP work on a classic theme?

Partly. Block-level editing of posts and pages, block types and patterns work on any theme, because the block editor is part of WordPress. The Site Editor tools — templates, template parts, global styles and navigation menus — need a block theme, so on a classic theme they are not registered and the agent sees the content and pattern tools alone.

Can I undo a block or template edit the AI made?

Yes. Every block edit, pattern change, template save and global-style write lands in the undo journal as its own entry, so you can roll one back from the Activity tab, or ask the agent to undo it, without restoring the whole site. Undoing the first edit to a theme-file template reverts it to the theme's version, and every write also accepts a dry run so you can preview it first.

Can the agent inject scripts or custom HTML into my pages?

Not by default. Content with scripts, iframes or inline event handlers, and core/html blocks, is refused unless you explicitly pass allow_unfiltered_html; everything else is filtered the way WordPress filters a normal editor's output. Markup is never allowed inside global-style CSS. Combined with safe mode, the dry-run preview and the audit log, an agent cannot quietly add code that runs on your front end.