At a glance
Where it came from
polo.blue is my blog about the Volkswagen Polo, in English and Polish. Posts are written in WordPress on blog.polo.blue, and readers get static Astro pages that the build generates from content fetched over the REST API. A classic headless CMS: WordPress is only the writing tool.
WordPress 6.9 ships the Abilities API, and the official MCP Adapter plugin builds on it to expose a site to an AI agent over MCP (Model Context Protocol). The adapter alone gives no tool for editing content, though. Through the plain REST API an agent can only fetch the whole post and send all of it back. In a post with dozens of blocks, galleries and tables, one slip in the model’s output is enough to break a block nobody meant to touch.
So I wrote a plugin with smaller steps. It started as an in-house tool called Polo Blocks MCP, and once it was working on my blog I turned it into a general-purpose plugin with no trace of polo.blue in the code.
Why not an existing plugin
Ready-made options exist, and some of them do more than mine. I looked at them before writing my own:
Three things decided it:
- As little access as possible. The agent on polo.blue fixes existing posts, and since version 2.2 it can also prepare a new post, but only as a draft. The plugin has no tool that publishes or deletes a post, installs a plugin or changes settings. A person publishes. What isn’t there, the agent can’t do, even by mistake. New tools are added only when I need them, with the same safeguards.
- Only the official route. The plugin uses the Abilities API from WordPress core and the MCP Adapter. No server of its own, no login of its own, no REST routes of its own, so nothing extra to maintain and secure.
- The blog’s own needs. Image links on polo.blue’s public domain instead of the admin host, and restoring IDs lost by Polylang Pro, are things none of these plugins do. With my own code, a tool like that takes a day to add, as
link-imagesdid.
How an edit works
The agent doesn’t get the whole post to rewrite. It gets the block tree, where each block has a path: 12.0.3 is the fourth block inside the first block of the thirteenth top-level block. A change touches exactly that path, and the rest of the post stays byte for byte as it was.
get-outline
The block tree with paths and text previews, plus the
content_hashof what the agent sees.Dry run
The same call with
expected_hashanddry_run: the result, unsaved, to check.Validation
Before saving, the plugin checks the block structure after the change. If anything is broken, nothing is saved.
Save
A normal post update with a revision.
revision_idis the backup.hash matches
Change saved
Only the block it pointed at; the rest of the post untouched.
someone edited the post
Write refused
The agent reads the post again instead of overwriting someone else's change.
The agent signs in with its own account and an application password, not mine, and has exactly that account’s capabilities: edit_post for the post, upload_files for the media search, edit_posts or edit_pages for drafts. The plugin has no admin screen and no endpoint of its own outside the MCP Adapter’s route.
find-postsget-outlineget-blocksvalidate-postfind-mediareplace-blockinsert-blocksdelete-blockmove-blocksunwrap-blocklink-imagescreate-draftIn production: 1,684 images without a link
The lightbox on polo.blue opens only images that link to their file. Images inserted in the editor with “Link to: None” have no link, so clicking them did nothing. Over the years a lot of those piled up: a scan of the blog’s published posts and pages found 1,684 unlinked images in 286 posts.
The first fix was a filter that added the links only at render time. I pulled it: the saved content stayed broken, and the fix lived in a separate file on the server that is easy to forget. Instead the plugin got a link-images tool. It sets “Link to: Media file” on the image, the same thing the editor does, and saves the post with a revision. It leaves images that already have a link alone, and those with the no-lightbox class too.
The links point at the public image address, polo.blue/images/…, not at the admin host. The plugin takes that address from a constant or a filter, so on another site it is one setting. The first version of this had a bug: for images on the old image subdomain it built the address of a file that did not exist, and 8 images on one page opened an empty lightbox. The first build showed it, and the fix went into 1.2.1.
Linking the images turned up two things no dry run will show:
- Saving a post runs other plugins. On the first larger post, the Smart Auto Upload Images plugin took the old image subdomain for a foreign server and downloaded 21 images into the media library as new files. I stopped the run, excluded the blog’s domains in its settings, checked on a post with 37 images that nothing new appeared, and only then carried on. I deleted the duplicates.
- Hosting has limits. With four agents working at once, the server answered “Error establishing a database connection” a few times. Every such call went through on a retry, and the last 40 posts ran one after another. Thanks to the hash check, none of them could save half a change.
In the end 4 posts and 36 images were left, which the tool skipped on purpose. One post had an old Classic block, and the plugin refuses to save a post with one. I rewrote it as normal blocks, and link-images did the rest. The other three were down to Polylang.
Polylang Pro and lost image IDs
The blog is bilingual and keeps its translations in Polylang Pro. Polylang translates media too: one image file gets a separate attachment for each language. When posts were translated and their language switched, the image IDs in the blocks got lost. Some blocks had no ID at all, some pointed at an attachment that no longer existed. As a result, the attachments assigned to a post didn’t show up properly, and link-images couldn’t work out the full-size file, so it skipped those images.
The image file itself was in the media library all along, just under another ID. Version 2.0.3 uses that:
- When an image has no ID, or the ID of a deleted attachment, the plugin looks its file up in the media library: the file itself, and for a resized copy also the original, including the
-scaledversion. - When one file has several attachments because Polylang translates media, the one in the post’s language wins. Another translation plugin can choose through the
spoko_content_mcp_image_attachmentfilter. - The block gets its
idand thewp-image-Nclass back, as the editor would set them, and the link points at that attachment’s full file. The tool’s result has arestored_idfield, so you can see what was restored.
On the blog, the English and Polish versions of the cruise control post got their IDs back on all 17 images, and in an old post about a bulb the dead ID was replaced by the ID of an existing attachment with the same file. Every save left a revision, and not a single file was added to the media library.
From a tool for my own blog to WordPress.org
October 2026: Polo Blocks MCP 1.1
The plugin as it ran on blog.polo.blue: ten block tools, the hash check, dry runs, revisions.
29 October: link-images (1.2)
The image-linking tool, then a fix for links on the public image domain.
7 November: version 2.0, public
A new general-purpose name, one endpoint /wp-json/spoko/content, MIT license, updates from GitHub releases, submitted to WordPress.org.
20 November: Spoko Content Editor for MCP
The WordPress.org review: "MCP" is another project's name, so in a plugin name it has to come after "for". Slug, endpoint and tools unchanged.
24 November: officially on WordPress.org
The plugin passes review and goes into the WordPress plugin directory as spoko-content-mcp.
26 November: 2.0.3
Restoring IDs lost by Polylang, and media search by file name.
1 December: 2.1, after a security audit
Writes to one post one at a time, filtering of agent markup and a stricter updater.
1 December: 2.2, create-draft
The agent creates a new post or page as a draft. Publishing stays with a person.
Since 24 November 2026 the plugin has been officially in the WordPress.org directory. To get there it went through the WordPress plugin team’s review, where people check the code, security, license and name by hand. That review is what made me rename it. As a result it installs like any other plugin: in the admin, under Plugins → Add New, by typing its name into the search.
The plugin has two builds of the same code. The GitHub build updates itself from the repository’s releases: with auto-updates on, WordPress installs a new version without me. The WordPress.org build has no such mechanism, since the directory doesn’t allow it, and WordPress.org updates it. Before submitting it I ran it through Plugin Check, the directory’s official tool, with no errors or warnings, experimental checks included.
The tests need no WordPress install and no database: link-images runs against the real block parser and serializer from WordPress core, and the updater against stubbed GitHub responses. A release is one script, no CI.
Security audit and version 2.1
A plugin that gives an AI agent access to a site’s content has to stay safe when the agent makes a mistake or reads text someone else wrote. So at the end of November I went through it in a separate security audit. It found two serious issues and a few smaller ones, and the fixes shipped in version 2.1.0 on 1 December 2026.
- Two writes from the same hash could both go through. The plugin checked the hash and saved the post in two separate steps. When two agents saved the same post at the same moment, both saves succeeded and one change was lost. Now writes to one post run one at a time: each takes a lock on the post, reads it again inside the lock, and only then saves. A second write waits up to 10 seconds and then gets a
post_busyerror instead of overwriting the first. - An agent could save a script. An Editor or Administrator account may save any HTML in WordPress, and the agent worked with that account’s rights. An agent that had read planted text could therefore put a script into a post. Now markup from the agent goes through WordPress’s HTML filter for every account. It lets through only embeds from known services, PDFs from the site and SVG drawings, and leaves the rest of the post alone. A site that really needs raw HTML can turn that on with a separate setting.
- Smaller fixes. The updater accepts only packages from this repository’s releases.
find-medialists only files the account may read,link-imageslinks only http(s) addresses, andreplace-blockandunwrap-block, which replace content, are marked destructive, so an MCP client can ask before using them.
I tested the fixes on a real WordPress with a MariaDB database, not only in unit tests. Version 2.0.3 updated itself to 2.1.0 through its old updater. Up to 10 agents saved the same post at once and no change was lost. 440 sample Gutenberg blocks went through the new filter, and the ones it changes are listed in the documentation. Version 2.1.1 then refined how SVG drawings are saved on WordPress 7, so that an unchanged drawing is saved byte for byte.
Drafts from a Markdown file: version 2.2
Version 2.2.0, released on 1 December 2026, added the create-draft tool. With it the agent puts a new post or page into WordPress as a draft, for example from an article written in a Markdown file. It turns the Markdown into blocks and sets the title, slug, excerpt, existing categories and tags, a featured image from the media library and, with Polylang, the language.
The status is always “draft”. So the agent’s account does not need the publish_posts capability, and the Contributor role is enough. The draft’s markup goes through the same filter and the same block check as every other write. A source_key, such as the file path, keeps a retried call from making a second draft. The tool is on by default. A site that doesn’t want it turns it off with the SPOKO_CONTENT_MCP_CREATE_DRAFTS constant or the spoko_content_mcp_create_drafts filter.
There is no tool for publishing. A person reviews the draft and publishes it in the WordPress admin.
What’s next
The next tools follow the same rules (hash check, dry run, revision) and cover the rest of a content workflow: a request to publish that a person approves in the admin, scheduling, a link and image check for a post before it goes live, changing a draft’s title, slug and categories, creating categories and tags, and pairing translations in Polylang, active only where Polylang is. Moving posts to the trash stays with a person.
When it makes sense
The plugin helps when content lives in WordPress and you want to hand part of the work on it to an AI agent: fixes in old posts, cleaning up images and links, adding a section, translating. The panel, the revisions and the final word stay with a person. On polo.blue the agent proposes, and a published post changes only after my “yes”.
If you have a WordPress site that could use this kind of cleanup, or you want to connect it to an AI agent, get in touch.





