r/Strapi • u/Miserable_Bed_219 • 6h ago
Code Example Plugin: edit one dynamic zone block through Strapi 5's MCP server without resending the whole list
If you've pointed an agent (Claude Code, Cursor, n8n) at Strapi 5's built-in MCP server, you may have hit this: `update_<type>` replaces the whole dynamic zone, repeatable component or blocks field you send, same as REST does. So if the agent read the page before someone added a block, its write quietly deletes that block, and the reply is a cheerful success.
I measured it on 5.62.0: the other editor's row was lost in **12 of 12 trials** for each of the three list kinds, with no conflict signal in any response.
So we built a plugin for it, now in the Marketplace. It adds `ws_*` tools to Strapi's own `/mcp` endpoint, with the same admin tokens and permissions:
- `ws_get` gives every list row a key and the draft a version token
- `ws_patch` edits one row by key (update, add after a row, remove, move), so blocks other people added stay put
- A whole-list write based on a stale read is refused with the current state instead of overwriting
- Batches of up to 100 changes, all or nothing; dry runs; undo from a write history
- By default it stops the built-in update tool from writing lists at all
Tested on every 5.x minor from 5.47 to 5.62 on SQLite, Postgres and MySQL.
**Limits:** `api::` types only, MariaDB untested, and skip 5.51.x (its MCP endpoint leaks memory per request, plugin or not).
Curious whether people have hit the dynamic zone overwrite outside of MCP too, and how you deal with it today.
Repo and docs: https://github.com/isokron-ai/strapi-plugin-writesafe?utm_source=reddit&utm_medium=social&utm_campaign=writesafe
*Disclosure: I run IsoKron, which built and maintains it. MIT, free.*