Repository navigation
Conversation
CKEditor fields now implement craft\base\McpOutputFieldInterface. MCP tools return the field's HTML with each <craft-entry> tag annotated with data-entry-type and data-entry-status, loaded with a single query. On the public MCP server, tags are only kept for nested entries within its approved scope (approved nested-entry field, live unless inactive elements are allowed, no drafts or revisions unless allowed), and are removed if the scope can't be determined. The MCP-only attributes are stripped in serializeValue(), so they're never stored if an agent writes the HTML back. Requires Craft CMS 5.12.1 or later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
McpOutputFieldInterface::getMcpValue() now receives a McpOutputContext object instead of a $public flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
riasvdv
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisite
craftcms/cms#20414
Description
MCP tools return CKEditor field values as raw HTML, where nested entries appear as bare
<craft-entry data-entry-id="…">tags. An agent knows only the ID, and on the public MCP server the tags expose IDs of entries outside its approved scope.CKEditor fields now implement
craft\base\McpOutputFieldInterface(added in craftcms/cms#20414):Annotated tags: each
<craft-entry>tag getsdata-entry-type(the entry type handle) anddata-entry-status. The nested entries are loaded in a single query.Public MCP server: tags follow the same scope core applies to nested entries. A tag is only kept if:
Other tags are removed. If the public scope can't be determined, all tags are removed.
Writes:
serializeValue()strips the two MCP-only attributes, so they're never stored if an agent writes the annotated HTML back. HTML Purifier already drops them by default, but this also covers fields with purification turned off.Requires Craft CMS 5.12.1 or later, so this can't be released until that version, with craftcms/cms#20414, is out.
Testing
elements_geton an entry with nested entries in its CKEditor field (fields: ["cke"]andfields: null): the tags havedata-entry-typeanddata-entry-status, and the rest of the HTML is unchanged.serializeValue()on annotated HTML returns tags without the MCP-only attributes.<craft-entry>tags and keeps the surrounding HTML.🤖 Generated with Claude Code