@abinnovision/payloadcms-mcpx 2.0.0-beta.7 → 2.0.0-beta.8
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/README.md +21 -22
- package/dist/options.mjs +2 -6
- package/dist/tools/find-versions.mjs +2 -2
- package/dist/types.d.mts +2 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -86,30 +86,29 @@ Claude Desktop and the MCP Inspector are covered in
|
|
|
86
86
|
|
|
87
87
|
## Options
|
|
88
88
|
|
|
89
|
-
| Option
|
|
90
|
-
|
|
|
91
|
-
| `collections`
|
|
92
|
-
| `collections.<slug>.read`
|
|
93
|
-
| `collections.<slug>.write`
|
|
94
|
-
| `collections.<slug>.publish`
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `apiKeys.
|
|
99
|
-
| `apiKeys.
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `limits.
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `serverInfo` | `payloadcms-mcpx` and the package version | `{ name, version }` reported to clients. |
|
|
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
|
+
| `globals` | `{}` | Globals to expose, with the same three options. |
|
|
96
|
+
| `userCollection` | `config.admin.user`, then `users` | Auth collection whose users the keys act as. |
|
|
97
|
+
| `apiKeys.slug` | `mcpx-api-keys` | Slug of the key collection. |
|
|
98
|
+
| `apiKeys.setupGuide` | `true` | Add the "Connect a client" tab to saved keys. |
|
|
99
|
+
| `apiKeys.overrideCollection` | none | Function that receives the key collection and returns it. |
|
|
100
|
+
| `endpoint.path` | `/mcpx` | Endpoint path below the API route. |
|
|
101
|
+
| `limits.maxLimit` | `25` | Highest `limit` a client may pass to a list tool. |
|
|
102
|
+
| `limits.maxDepth` | `1` | Highest `depth` a client may pass to a read tool. |
|
|
103
|
+
| `tools` | `[]` | Custom tools, see [`docs/custom-tools.md`](./docs/custom-tools.md). |
|
|
104
|
+
| `auth.resolve` | none | Replace or wrap the key lookup. |
|
|
105
|
+
| `serverInfo` | `payloadcms-mcpx` and the package version | `{ name, version }` reported to clients. |
|
|
107
106
|
|
|
108
107
|
The config only takes capabilities away: `true` exposes everything the entity supports, and a key's
|
|
109
108
|
checkboxes decide what each key may do. `publish: false` keeps MCP writes as drafts. On an entity
|
|
110
|
-
without drafts, a write changes the live document.
|
|
111
|
-
|
|
112
|
-
[version history](./docs/security.md#version-history)
|
|
109
|
+
without drafts, a write changes the live document. Version history has no checkbox of its own: it
|
|
110
|
+
follows the key's read wherever the entity keeps Payload `versions`. Read
|
|
111
|
+
[version history](./docs/security.md#version-history) first.
|
|
113
112
|
Mistakes in the options fail at startup. [`docs/integration.md`](./docs/integration.md) lists
|
|
114
113
|
every check.
|
|
115
114
|
|
|
@@ -121,7 +120,7 @@ every check.
|
|
|
121
120
|
| `describeSchema` | Describes the fields at one schema path, with the paths below it. | `read` |
|
|
122
121
|
| `findDocuments` | Queries a collection with a Payload `where`, `sort` and `select`. | `read` |
|
|
123
122
|
| `getDocument` | Reads a document, a subtree of it, an old version or a diff. | `read` |
|
|
124
|
-
| `findVersions` | Lists the version history of a document or global, without bodies. | `read
|
|
123
|
+
| `findVersions` | Lists the version history of a document or global, without bodies. | `read` |
|
|
125
124
|
| `patchDocument` | Applies JSON Patch operations to the current draft. | `write` |
|
|
126
125
|
| `createDocument` | Creates a draft from a seed. Not for upload collections. | `write` |
|
|
127
126
|
| `validateDocument` | Lists what blocks publishing, without saving. | `write` |
|
package/dist/options.mjs
CHANGED
|
@@ -21,8 +21,7 @@ const assertExposable = (collection, apiKeysSlug) => {
|
|
|
21
21
|
const OPTION_NAMES = [
|
|
22
22
|
"read",
|
|
23
23
|
"write",
|
|
24
|
-
"publish"
|
|
25
|
-
"versions"
|
|
24
|
+
"publish"
|
|
26
25
|
];
|
|
27
26
|
const REMOVED_WRITE_MODES = {
|
|
28
27
|
draft: "Use { publish: false } instead.",
|
|
@@ -47,18 +46,15 @@ const normalizeCapabilities = (kind, config, raw) => {
|
|
|
47
46
|
const read = flag("read") ?? true;
|
|
48
47
|
const write = flag("write") ?? true;
|
|
49
48
|
const publish = flag("publish");
|
|
50
|
-
const versions = flag("versions") ?? false;
|
|
51
49
|
const hasDrafts = hasDraftsEnabled(config);
|
|
52
50
|
if (publish === false && write && !hasDrafts) fail(`${kind} "${slug}" has no drafts, so every write goes live. Set write: false or remove publish: false.`);
|
|
53
51
|
if (publish === true && !hasDrafts) fail(`${kind} "${slug}" has no drafts, so there is nothing to publish. Enable versions.drafts or remove publish: true.`);
|
|
54
52
|
if (publish === true && !write) fail(`${kind} "${slug}" has publish: true but write: false. Publishing follows write.`);
|
|
55
|
-
if (versions && !config.versions) fail(`${kind} "${slug}" keeps no versions. Enable versions or remove versions: true.`);
|
|
56
|
-
if (versions && !read) fail(`${kind} "${slug}" has versions: true but read: false. Version history follows read.`);
|
|
57
53
|
return {
|
|
58
54
|
read,
|
|
59
55
|
write: write ? publish === false ? "draft" : "live" : false,
|
|
60
56
|
hasDrafts,
|
|
61
|
-
hasVersions: versions
|
|
57
|
+
hasVersions: read && Boolean(config.versions)
|
|
62
58
|
};
|
|
63
59
|
};
|
|
64
60
|
const assertGlobalExposable = (global) => {
|
|
@@ -16,8 +16,8 @@ const statusShape = (scope) => {
|
|
|
16
16
|
/**
|
|
17
17
|
* Bodies are left out so a long history stays small; `getDocument` reads one
|
|
18
18
|
* when it is needed. The document's `read` access is checked first, then
|
|
19
|
-
* Payload's `readVersions`. Only entities
|
|
20
|
-
*
|
|
19
|
+
* Payload's `readVersions`. Only entities that keep Payload versions are
|
|
20
|
+
* reachable.
|
|
21
21
|
*/ const findVersions = defineMcpxTool({
|
|
22
22
|
name: "findVersions",
|
|
23
23
|
description: DESCRIPTION,
|
package/dist/types.d.mts
CHANGED
|
@@ -43,13 +43,6 @@ export interface McpxCollectionOptions {
|
|
|
43
43
|
* `false` keeps writes as drafts and is refused where there are none.
|
|
44
44
|
*/
|
|
45
45
|
publish?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Expose `findVersions` and the `versionId` and `diffFrom` arguments of
|
|
48
|
-
* `getDocument` to keys that may read the entity. Default `false`: version
|
|
49
|
-
* history has no checkbox of its own and follows the key's read, so the
|
|
50
|
-
* config opts in. `true` needs Payload `versions` and `read`.
|
|
51
|
-
*/
|
|
52
|
-
versions?: boolean;
|
|
53
46
|
}
|
|
54
47
|
/** The same options. A singleton, so neither `findDocuments` nor `createDocument` reaches one. */
|
|
55
48
|
export type McpxGlobalOptions = McpxCollectionOptions;
|
|
@@ -61,8 +54,8 @@ export interface McpxExposedEntity {
|
|
|
61
54
|
write: McpxWriteMode;
|
|
62
55
|
hasDrafts: boolean;
|
|
63
56
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
57
|
+
* The entity has Payload `versions`, with or without drafts, and is
|
|
58
|
+
* readable. Says nothing about drafts; see `hasDrafts`.
|
|
66
59
|
*/
|
|
67
60
|
hasVersions: boolean;
|
|
68
61
|
/** An upload document is a file, and no tool here can supply one. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@abinnovision/payloadcms-mcpx",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.8",
|
|
5
5
|
"description": "Payload CMS plugin exposing a fixed, schema-aware MCP tool surface with draft-only writes and per-API-key capabilities.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"payload",
|
|
@@ -101,4 +101,4 @@
|
|
|
101
101
|
"npm": true,
|
|
102
102
|
"npmAccess": "public"
|
|
103
103
|
}
|
|
104
|
-
}
|
|
104
|
+
}
|