Repository navigation
plugin-mcp: should the MCP update and delete tools respect document locks by default, like REST? #19597
rafe-walker
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Details and reproduction: #19591. Runnable reproduction (3.93.0 and 4.0.0-beta.9): https://github.com/isokron-ai/payload-mcp-repro
Short version. With document locking on, REST refuses a write to a document another user has open (423). The MCP
update tool defaults
overrideLocktotrue, and the delete tool never passes it, so both go through the lock,delete the other user's lock, and answer success. We measured 10 of 10 for each on 3.93.0, against 10 of 10 REST
refusals; it is the same on
main(5ef8807). Onmainthe default comes fromoverrideLockSchemainpackages/payload/src/utilities/sharedInputSchemas.ts.docs/admin/locked-documents.mdxdocumentstrueas the Local API default, which makes sense for trusted servercode. The MCP tools act for an external client, so we think REST's default fits them better.
Proposed change, for the MCP tools only:
updateDocument:overrideLockdefaults tofalse;deleteDocuments: acceptsoverrideLock(defaultfalse) and passes it on.On
mainthis means a remote variant of the schema (defaultfalse) in the remoteupdateDocumentanddeleteDocumentsinput schemas, which only the MCP plugin uses in this repo. The Local API and CLI schemas keeptrue. A caller that wants to take over a lock can still passoverrideLock: true. The update refusal already returnsisErroronmain; the delete refusal gets it from #19592, which setsisErrorwhendeleteDocumentsfails.
Question. Is this the right default for the plugin on
main, and would you take the same fix on3.x? We have asmall PR with tests ready.
Found while reviewing the MCP plugin with AI assistance. We checked every claim here ourselves.
All reactions