@abinnovision/payloadcms-mcpx 2.0.0-beta.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +56 -36
- package/dist/admin/capability-matrix.d.mts +5 -3
- package/dist/admin/capability-matrix.mjs +374 -272
- package/dist/admin/capability-toggles.mjs +79 -42
- package/dist/admin/confirmations-panel.mjs +232 -0
- package/dist/admin/confirmations.d.mts +15 -0
- package/dist/admin/confirmations.mjs +71 -0
- package/dist/admin/endpoint-url.mjs +7 -0
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.mjs +2 -1
- package/dist/admin/setup-guide.d.mts +3 -3
- package/dist/admin/setup-guide.mjs +51 -33
- package/dist/api-keys/capability-matrix.d.mts +7 -9
- package/dist/api-keys/capability-matrix.mjs +15 -37
- package/dist/api-keys/collection.mjs +16 -18
- package/dist/api-keys/confirmation-view.mjs +7 -0
- package/dist/api-keys/fields.mjs +50 -57
- package/dist/auth/resolve.mjs +69 -40
- package/dist/capabilities.d.mts +2 -0
- package/dist/capabilities.mjs +64 -16
- package/dist/define-tool.d.mts +4 -4
- package/dist/define-tool.mjs +8 -1
- package/dist/endpoint/confirmations.mjs +124 -0
- package/dist/endpoint/handler.mjs +25 -27
- package/dist/endpoint/http.mjs +27 -0
- package/dist/endpoint/server.mjs +48 -29
- package/dist/endpoint/upload.mjs +104 -0
- package/dist/grants/confirmation.mjs +75 -0
- package/dist/grants/grant.mjs +137 -0
- package/dist/guards.mjs +8 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/options.mjs +68 -61
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.mjs +19 -4
- package/dist/request.mjs +5 -1
- package/dist/result.mjs +11 -1
- package/dist/schema/admin-hidden.mjs +4 -4
- package/dist/schema/describe.mjs +12 -18
- package/dist/schema/index.mjs +5 -6
- package/dist/schema/lexical-pointer.mjs +8 -8
- package/dist/schema/lexical.mjs +15 -13
- package/dist/schema/outline.mjs +4 -5
- package/dist/schema/path.mjs +4 -1
- package/dist/schema/pointer.mjs +11 -17
- package/dist/schema/shape.mjs +38 -50
- package/dist/schema/walk.mjs +57 -18
- package/dist/tools/builtin.mjs +7 -1
- package/dist/tools/create-document.mjs +38 -26
- package/dist/tools/delete-document.mjs +154 -0
- package/dist/tools/describe-schema.mjs +7 -5
- package/dist/tools/document.mjs +131 -45
- package/dist/tools/duplicate-document.mjs +50 -0
- package/dist/tools/find-documents.mjs +15 -20
- package/dist/tools/find-versions.mjs +11 -15
- package/dist/tools/get-document.mjs +31 -15
- package/dist/tools/links.mjs +53 -0
- package/dist/tools/list-capabilities.mjs +17 -7
- package/dist/tools/patch-document.mjs +57 -53
- package/dist/tools/publish-document.mjs +17 -29
- package/dist/tools/query-paths.mjs +1 -1
- package/dist/tools/run-confirmed.mjs +114 -0
- package/dist/tools/shared.mjs +53 -46
- package/dist/tools/validate-document.mjs +6 -8
- package/dist/tools/versions.mjs +11 -6
- package/dist/types.d.mts +158 -43
- package/dist/upload/file.mjs +177 -0
- package/dist/version.mjs +4 -2
- package/dist/write/draft-guard.mjs +35 -28
- package/dist/write/patch.mjs +4 -4
- package/dist/write/publish-intent.mjs +23 -11
- package/dist/write/row-ids.mjs +3 -1
- package/dist/write/write-data.mjs +18 -31
- package/package.json +14 -14
- package/dist/builtin-tool-names.mjs +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.0](https://github.com/abinnovision/payloadcms-commons/compare/payloadcms-mcpx-v1.0.0...payloadcms-mcpx-v2.0.0) (2026-10-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **mcpx:** align helpers and simplify the plugin internals ([#118](https://github.com/abinnovision/payloadcms-commons/issues/118))
|
|
9
|
+
* **mcpx:** refine the capability matrix into access levels ([#108](https://github.com/abinnovision/payloadcms-commons/issues/108))
|
|
10
|
+
* **mcpx:** expose version history wherever read is granted ([#89](https://github.com/abinnovision/payloadcms-commons/issues/89))
|
|
11
|
+
* **mcpx:** clean up, harden and simplify the plugin for 2.0 ([#83](https://github.com/abinnovision/payloadcms-commons/issues/83))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **mcpx:** add deleteDocument with approval in the admin panel ([#107](https://github.com/abinnovision/payloadcms-commons/issues/107)) ([87ffa2b](https://github.com/abinnovision/payloadcms-commons/commit/87ffa2bae203dfd4e869f7c067f016691062f051))
|
|
16
|
+
* **mcpx:** add duplicateDocument tool ([#111](https://github.com/abinnovision/payloadcms-commons/issues/111)) ([b4b4b1c](https://github.com/abinnovision/payloadcms-commons/commit/b4b4b1c27d73ed1a472a8319e3d394525d141219))
|
|
17
|
+
* **mcpx:** add key expiry and per-locale validation and publishing ([#92](https://github.com/abinnovision/payloadcms-commons/issues/92)) ([c926352](https://github.com/abinnovision/payloadcms-commons/commit/c926352a10ed910f5c76a62ea20a739fd50a7504))
|
|
18
|
+
* **mcpx:** clean up, harden and simplify the plugin for 2.0 ([#83](https://github.com/abinnovision/payloadcms-commons/issues/83)) ([7d29edf](https://github.com/abinnovision/payloadcms-commons/commit/7d29edf9bcacf8bba85d8525274530c8416a5cce))
|
|
19
|
+
* **mcpx:** expose diagnostics for bug reports ([#94](https://github.com/abinnovision/payloadcms-commons/issues/94)) ([6d171a1](https://github.com/abinnovision/payloadcms-commons/commit/6d171a18a54cef013ea051fb8e4b798860d8fb90))
|
|
20
|
+
* **mcpx:** expose version history and diffs ([#82](https://github.com/abinnovision/payloadcms-commons/issues/82)) ([44c2eb5](https://github.com/abinnovision/payloadcms-commons/commit/44c2eb5b75a2387b6797b320632052289ddeffb9))
|
|
21
|
+
* **mcpx:** expose version history wherever read is granted ([#89](https://github.com/abinnovision/payloadcms-commons/issues/89)) ([281f6b0](https://github.com/abinnovision/payloadcms-commons/commit/281f6b01ce82b69c41d69bbd0b820cd2d589c656))
|
|
22
|
+
* **mcpx:** link written documents to the admin panel and preview ([#109](https://github.com/abinnovision/payloadcms-commons/issues/109)) ([3b9393d](https://github.com/abinnovision/payloadcms-commons/commit/3b9393d0cbec6eb1027bb121e107899dba9bddbf))
|
|
23
|
+
* **mcpx:** open the setup guide from a "Connect a client" drawer ([#126](https://github.com/abinnovision/payloadcms-commons/issues/126)) ([35da035](https://github.com/abinnovision/payloadcms-commons/commit/35da03571f8a079311bcca0d842187cb32abdd9f))
|
|
24
|
+
* **mcpx:** refine the capability matrix into access levels ([#108](https://github.com/abinnovision/payloadcms-commons/issues/108)) ([2a32a7f](https://github.com/abinnovision/payloadcms-commons/commit/2a32a7fb4517cbecde2dcebaf1026f822cddc6f7))
|
|
25
|
+
* **mcpx:** render API key capabilities as a permission matrix ([#67](https://github.com/abinnovision/payloadcms-commons/issues/67)) ([fce9644](https://github.com/abinnovision/payloadcms-commons/commit/fce96445007b7bee1dfa463acfd6a388df151e60))
|
|
26
|
+
* **mcpx:** rework the capability matrix layout and delete control ([#112](https://github.com/abinnovision/payloadcms-commons/issues/112)) ([be23744](https://github.com/abinnovision/payloadcms-commons/commit/be23744099b5b2b307c4b8f71af64fca3dcb3e56))
|
|
27
|
+
* **mcpx:** upload and download files through single-use grants ([#96](https://github.com/abinnovision/payloadcms-commons/issues/96)) ([761fa66](https://github.com/abinnovision/payloadcms-commons/commit/761fa665949501a7a48eadab3ccaa6e115bca47d))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **deps:** align @payloadcms/ui with payload 3.89.0 ([#70](https://github.com/abinnovision/payloadcms-commons/issues/70)) ([7f083e3](https://github.com/abinnovision/payloadcms-commons/commit/7f083e3e040ffa99cd66347965c3a492c46e7f12))
|
|
33
|
+
* **deps:** bump @modelcontextprotocol/sdk from 1.31.0 to 1.32.0 in the production-dependencies group ([#124](https://github.com/abinnovision/payloadcms-commons/issues/124)) ([9f7eda2](https://github.com/abinnovision/payloadcms-commons/commit/9f7eda2234cf6a57ed11bbb3d5761c26e53ffe6d))
|
|
34
|
+
* **deps:** bump the production-dependencies group across 1 directory with 2 updates ([#110](https://github.com/abinnovision/payloadcms-commons/issues/110)) ([cfa968f](https://github.com/abinnovision/payloadcms-commons/commit/cfa968fabbde1851c42851f7ffdcded3eb2cf6df))
|
|
35
|
+
* **deps:** bump the production-dependencies group across 1 directory with 6 updates ([#86](https://github.com/abinnovision/payloadcms-commons/issues/86)) ([57d002c](https://github.com/abinnovision/payloadcms-commons/commit/57d002c693b74da431e24c8e789ee2eb5c7e416e))
|
|
36
|
+
* **deps:** bump the production-dependencies group with 10 updates ([#68](https://github.com/abinnovision/payloadcms-commons/issues/68)) ([786b528](https://github.com/abinnovision/payloadcms-commons/commit/786b528e7929376c5e6ea570d94d58bb0b4298cc))
|
|
37
|
+
* **deps:** bump the production-dependencies group with 2 updates ([#49](https://github.com/abinnovision/payloadcms-commons/issues/49)) ([8f079ec](https://github.com/abinnovision/payloadcms-commons/commit/8f079ecfc3b675318b4501a6b0073d8f3f2f36b5))
|
|
38
|
+
* **deps:** keep @payloadcms/ui aligned with the rest of the Payload family ([#61](https://github.com/abinnovision/payloadcms-commons/issues/61)) ([e77c0b9](https://github.com/abinnovision/payloadcms-commons/commit/e77c0b94fcb696e2e9165d76b33945bf98d5a4ba))
|
|
39
|
+
* **mcpx:** let hooks fill required fields on file uploads ([#106](https://github.com/abinnovision/payloadcms-commons/issues/106)) ([8421860](https://github.com/abinnovision/payloadcms-commons/commit/84218601bc21fca89dc287988b45c9a7365fb50d))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Code Refactoring
|
|
43
|
+
|
|
44
|
+
* **mcpx:** align helpers and simplify the plugin internals ([#118](https://github.com/abinnovision/payloadcms-commons/issues/118)) ([cda6739](https://github.com/abinnovision/payloadcms-commons/commit/cda67391e932bfc033a2f579a5e1e6d1cca50094))
|
|
45
|
+
|
|
3
46
|
## 1.0.0 (2026-09-03)
|
|
4
47
|
|
|
5
48
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @abinnovision/payloadcms-mcpx
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
A [Payload CMS](https://payloadcms.com/) plugin that serves an MCP (Model Context Protocol) server
|
|
6
6
|
on one `POST` endpoint. Clients authenticate with API keys that users create in the admin panel.
|
|
@@ -61,7 +61,7 @@ The plugin adds:
|
|
|
61
61
|
- An `mcpx-api-keys` collection in the admin group "MCP", holding the keys.
|
|
62
62
|
- A draft guard on every collection and global that turns MCP writes into draft saves.
|
|
63
63
|
|
|
64
|
-
The key form uses two admin components, so regenerate the import map:
|
|
64
|
+
The key form uses two admin components, three with `delete`, so regenerate the import map:
|
|
65
65
|
|
|
66
66
|
```sh
|
|
67
67
|
payload generate:importmap
|
|
@@ -82,27 +82,29 @@ claude mcp add --transport http payload http://localhost:3000/api/mcpx \
|
|
|
82
82
|
|
|
83
83
|
Claude Desktop and the MCP Inspector are covered in
|
|
84
84
|
[`docs/integration.md`](./docs/integration.md#connecting-other-clients). Saved keys also have a
|
|
85
|
-
"Connect a client"
|
|
85
|
+
"Connect a client" button that opens ready-to-paste snippets.
|
|
86
86
|
|
|
87
87
|
## Options
|
|
88
88
|
|
|
89
|
-
| Option | Default | Description
|
|
90
|
-
| ---------------------------- | ----------------------------------------- |
|
|
91
|
-
| `collections` | required | Collections to expose. `true` means `{}`, everything it supports.
|
|
92
|
-
| `collections.<slug>.read` | `true` | Expose the read tools for this collection.
|
|
93
|
-
| `collections.<slug>.write` | `true` | Expose the write tools. Without drafts, a write goes live.
|
|
94
|
-
| `collections.<slug>.publish` | `true` with drafts | Expose `publishDocument`. Needs `versions.drafts` and `write`.
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `apiKeys.
|
|
99
|
-
| `apiKeys.
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `limits.
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
89
|
+
| Option | Default | Description |
|
|
90
|
+
| ---------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
91
|
+
| `collections` | required | Collections to expose. `true` means `{}`, everything it supports. |
|
|
92
|
+
| `collections.<slug>.read` | `true` | Expose the read tools for this collection. |
|
|
93
|
+
| `collections.<slug>.write` | `true` | Expose the write tools. Needs `read`. Without drafts, a write goes live. |
|
|
94
|
+
| `collections.<slug>.publish` | `true` with drafts | Expose `publishDocument`. Needs `versions.drafts` and `write`. |
|
|
95
|
+
| `collections.<slug>.delete` | `false` | Expose `deleteDocument`. Needs `read`. Each delete is approved in the admin. `"unattended"` also offers trashing without approval; needs `trash`. |
|
|
96
|
+
| `globals` | `{}` | Globals to expose, with `read`, `write` and `publish`. |
|
|
97
|
+
| `userCollection` | `config.admin.user`, then `users` | Auth collection whose users the keys act as. |
|
|
98
|
+
| `apiKeys.slug` | `mcpx-api-keys` | Slug of the key collection. |
|
|
99
|
+
| `apiKeys.setupGuide` | `true` | Add the "Connect a client" button to saved keys. |
|
|
100
|
+
| `apiKeys.overrideCollection` | none | Function that receives the key collection and returns it. |
|
|
101
|
+
| `endpoint.path` | `/mcpx` | Endpoint path below the API route. |
|
|
102
|
+
| `limits.maxLimit` | `25` | Highest `limit` a client may pass to a list tool. |
|
|
103
|
+
| `limits.maxDepth` | `1` | Highest `depth` a client may pass to a read tool. |
|
|
104
|
+
| `tools` | `[]` | Custom tools, see [`docs/custom-tools.md`](./docs/custom-tools.md). |
|
|
105
|
+
| `auth.resolve` | none | Replace or wrap the key lookup. |
|
|
106
|
+
| `serverInfo` | `payloadcms-mcpx` and the package version | `{ name, version }` reported to clients. |
|
|
107
|
+
| `diagnostics` | `true` | Expose the server version plus repository and issue links. |
|
|
106
108
|
|
|
107
109
|
The config only takes capabilities away: `true` exposes everything the entity supports, and a key's
|
|
108
110
|
checkboxes decide what each key may do. `publish: false` keeps MCP writes as drafts. On an entity
|
|
@@ -114,17 +116,20 @@ every check.
|
|
|
114
116
|
|
|
115
117
|
## Tools
|
|
116
118
|
|
|
117
|
-
| Tool
|
|
118
|
-
|
|
|
119
|
-
| `listCapabilities`
|
|
120
|
-
| `describeSchema`
|
|
121
|
-
| `findDocuments`
|
|
122
|
-
| `getDocument`
|
|
123
|
-
| `findVersions`
|
|
124
|
-
| `patchDocument`
|
|
125
|
-
| `createDocument`
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
119
|
+
| Tool | What it does | Needs |
|
|
120
|
+
| ------------------- | ------------------------------------------------------------------ | --------- |
|
|
121
|
+
| `listCapabilities` | Lists what this key may do. Clients call it first. | any key |
|
|
122
|
+
| `describeSchema` | Describes the fields at one schema path, with the paths below it. | `read` |
|
|
123
|
+
| `findDocuments` | Queries a collection with a Payload `where`, `sort` and `select`. | `read` |
|
|
124
|
+
| `getDocument` | Reads a document, a subtree of it, an old version or a diff. | `read` |
|
|
125
|
+
| `findVersions` | Lists the version history of a document or global, without bodies. | `read` |
|
|
126
|
+
| `patchDocument` | Applies JSON Patch operations to the current draft, or a new file. | `write` |
|
|
127
|
+
| `createDocument` | Creates a draft from a seed, with a file in an upload collection. | `write` |
|
|
128
|
+
| `duplicateDocument` | Copies a document into a new draft, in every locale. | `write` |
|
|
129
|
+
| `validateDocument` | Lists what blocks publishing, without saving. | `write` |
|
|
130
|
+
| `publishDocument` | Publishes the current draft. | `publish` |
|
|
131
|
+
| `deleteDocument` | Asks to delete a document, which the key's user approves. | `delete` |
|
|
132
|
+
| `runConfirmed` | Runs the approved calls. | `delete` |
|
|
128
133
|
|
|
129
134
|
Collections and globals use the same tools. A tool that addresses one document takes either
|
|
130
135
|
`collection` and `id`, or `global` alone. [`docs/concepts.md`](./docs/concepts.md#tools) lists
|
|
@@ -137,11 +142,20 @@ A key can do something only when both the config and the key allow it.
|
|
|
137
142
|
The plugin config sets the upper bound: which collections and globals are exposed, and whether
|
|
138
143
|
each one is readable, writable and publishable. A key cannot go past it.
|
|
139
144
|
|
|
140
|
-
Each key carries one checkbox per exposed entity and operation (`read`, `write`, `publish
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
Each key carries one checkbox per exposed entity and operation (`read`, `write`, `publish`,
|
|
146
|
+
`delete`, `deleteUnattended`), and
|
|
147
|
+
one per custom tool. The admin panel shows them as a matrix with a row per entity, an Access
|
|
148
|
+
control (None, Read, Write, Publish) and a Delete checkbox with an approval shield. Each access level
|
|
149
|
+
includes the ones before it, and a level the config does not expose has no segment. `publish`
|
|
150
|
+
exists only where the config exposes `write` and `publish` on an entity with drafts, and counts
|
|
151
|
+
only when `write` is ticked as well. `write` counts only when `read` is ticked, so a key never
|
|
152
|
+
writes what it cannot read. An entity without drafts carries a "Live" badge, as its writes go live
|
|
153
|
+
immediately.
|
|
154
|
+
`delete` exists only where the config sets `delete: true` on a collection, and counts only when
|
|
155
|
+
`read` is ticked as well. Setting access to None clears it. A delete runs only after the key's user
|
|
156
|
+
approved it on the key's edit view, except where the config sets `delete: "unattended"` and the
|
|
157
|
+
key's approval shield is off: there the document moves to trash at once. See
|
|
158
|
+
[deleting](./docs/concepts.md#deleting).
|
|
145
159
|
|
|
146
160
|
`tools/list` follows the key. A tool the key cannot use is not listed, and each `collection` and
|
|
147
161
|
`global` argument lists only the slugs the key may use with that tool. A checkbox added by a later
|
|
@@ -163,6 +177,12 @@ To restrict that, use `apiKeys.overrideCollection` as shown in
|
|
|
163
177
|
Blocker messages can name fields the user cannot read.
|
|
164
178
|
- The request body is limited to 4 MB, a JSON-RPC batch to 10 messages, `patchDocument` to 500
|
|
165
179
|
operations and `describeSchema` to 400 paths.
|
|
180
|
+
- A file is sent in a second step, a `PUT`, and downloaded with a `GET`, each with a short-lived,
|
|
181
|
+
single-use grant. Only collections with `upload.mimeTypes` take files. Downloads go through the
|
|
182
|
+
collection's own file access. See [uploads](./docs/security.md#uploads).
|
|
183
|
+
- A delete waits for the key's user to approve it in the admin panel and is then run by the same
|
|
184
|
+
key. Collections with `trash` move the document to trash. See
|
|
185
|
+
[confirmations](./docs/security.md#confirmations).
|
|
166
186
|
- Custom tools are trusted code and must apply access control themselves.
|
|
167
187
|
|
|
168
188
|
Open limitations: a filter through a relation into a readable collection ignores that collection's
|
|
@@ -25,9 +25,11 @@ interface McpxCapabilityMatrixProps {
|
|
|
25
25
|
withinTab?: boolean;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* What an API key may do, as one table per namespace: a row per entity
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* What an API key may do, as one table per namespace: a row per entity with
|
|
29
|
+
* an Access control and a Delete checkbox with an approval shield, and an
|
|
30
|
+
* "All" row that sets every row.
|
|
31
|
+
* The nested checkbox fields back every control, so the stored document is
|
|
32
|
+
* unaffected.
|
|
31
33
|
*/
|
|
32
34
|
export declare const McpxCapabilityMatrix: React.FC<McpxCapabilityMatrixProps>;
|
|
33
35
|
//#endregion
|