@abinnovision/payloadcms-mcpx 1.0.1-beta.1 → 1.0.1-beta.2
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/dist/client/setup-guide.d.mts +2 -3
- package/dist/plugin.d.mts +2 -3
- package/dist/request.d.mts +2 -3
- package/dist/result.d.mts +3 -4
- package/dist/types.d.mts +18 -19
- package/package.json +8 -8
|
@@ -9,6 +9,5 @@ interface McpxSetupGuideProps {
|
|
|
9
9
|
* until the document is saved, because before that there is no key to hand to
|
|
10
10
|
* a client.
|
|
11
11
|
*/
|
|
12
|
-
declare const McpxSetupGuide: React.FC<McpxSetupGuideProps>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { McpxSetupGuide };
|
|
12
|
+
export declare const McpxSetupGuide: React.FC<McpxSetupGuideProps>;
|
|
13
|
+
//#endregion
|
package/dist/plugin.d.mts
CHANGED
|
@@ -4,6 +4,5 @@ import { McpxPluginOptions } from "./types.mjs";
|
|
|
4
4
|
* Mounts the MCP endpoint, adds the API key collection and installs the
|
|
5
5
|
* draft guard on every collection and global.
|
|
6
6
|
*/
|
|
7
|
-
declare const mcpxPlugin: (options: McpxPluginOptions) => import("payload").Plugin;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { mcpxPlugin };
|
|
7
|
+
export declare const mcpxPlugin: (options: McpxPluginOptions) => import("payload").Plugin;
|
|
8
|
+
//#endregion
|
package/dist/request.d.mts
CHANGED
|
@@ -5,6 +5,5 @@ import { PayloadRequest } from "payload";
|
|
|
5
5
|
* `req.context.mcpx`, which travels into every local API call made with the
|
|
6
6
|
* same `req`, including those made by custom tools.
|
|
7
7
|
*/
|
|
8
|
-
declare const isMcpxRequest: (req: PayloadRequest) => boolean;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { isMcpxRequest };
|
|
8
|
+
export declare const isMcpxRequest: (req: PayloadRequest) => boolean;
|
|
9
|
+
//#endregion
|
package/dist/result.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
//#region src/result.d.ts
|
|
3
3
|
/** `value` as JSON text. */
|
|
4
|
-
declare const jsonResult: (value: unknown) => CallToolResult;
|
|
4
|
+
export declare const jsonResult: (value: unknown) => CallToolResult;
|
|
5
5
|
/**
|
|
6
6
|
* `extras` travel alongside the message so the client can act on them:
|
|
7
7
|
* problems, validation errors, the current `updatedAt`.
|
|
8
8
|
*/
|
|
9
|
-
declare const errorResult: (message: string, extras?: Record<string, unknown>) => CallToolResult;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { errorResult, jsonResult };
|
|
9
|
+
export declare const errorResult: (message: string, extras?: Record<string, unknown>) => CallToolResult;
|
|
10
|
+
//#endregion
|
package/dist/types.d.mts
CHANGED
|
@@ -21,9 +21,9 @@ declare module "payload" {
|
|
|
21
21
|
* `publishDocument` is exposed; on one without, where there is no draft to
|
|
22
22
|
* land on, it means the write itself is permitted and lands live.
|
|
23
23
|
*/
|
|
24
|
-
type McpxWriteMode = "draft" | "live" | false;
|
|
24
|
+
export type McpxWriteMode = "draft" | "live" | false;
|
|
25
25
|
/** A key can only enable what the config exposes here. */
|
|
26
|
-
interface McpxCollectionOptions {
|
|
26
|
+
export interface McpxCollectionOptions {
|
|
27
27
|
/** Expose `describeSchema`, `findDocuments`, `getDocument`. Default `true`. */
|
|
28
28
|
read?: boolean;
|
|
29
29
|
/**
|
|
@@ -34,7 +34,7 @@ interface McpxCollectionOptions {
|
|
|
34
34
|
write?: McpxWriteMode;
|
|
35
35
|
}
|
|
36
36
|
/** A singleton, so neither `findDocuments` nor `createDocument` reaches one. */
|
|
37
|
-
interface McpxGlobalOptions {
|
|
37
|
+
export interface McpxGlobalOptions {
|
|
38
38
|
/** Expose `describeSchema` and `getDocument`. Default `true`. */
|
|
39
39
|
read?: boolean;
|
|
40
40
|
/**
|
|
@@ -43,9 +43,9 @@ interface McpxGlobalOptions {
|
|
|
43
43
|
*/
|
|
44
44
|
write?: McpxWriteMode;
|
|
45
45
|
}
|
|
46
|
-
type McpxToolExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
|
|
46
|
+
export type McpxToolExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
|
|
47
47
|
/** What the config exposes, before an API key's checkboxes narrow it. */
|
|
48
|
-
interface McpxExposedEntity {
|
|
48
|
+
export interface McpxExposedEntity {
|
|
49
49
|
slug: string;
|
|
50
50
|
read: boolean;
|
|
51
51
|
write: McpxWriteMode;
|
|
@@ -56,7 +56,7 @@ interface McpxExposedEntity {
|
|
|
56
56
|
fieldName: string;
|
|
57
57
|
}
|
|
58
58
|
/** What a tool knows about the current request. */
|
|
59
|
-
interface McpxToolScope {
|
|
59
|
+
export interface McpxToolScope {
|
|
60
60
|
req: PayloadRequest;
|
|
61
61
|
capabilities: McpxResolvedCapabilities;
|
|
62
62
|
readable: string[];
|
|
@@ -82,7 +82,7 @@ interface McpxToolScope {
|
|
|
82
82
|
* `req.context.mcpx` set. `Args` only needs stating when `inputSchema` is built
|
|
83
83
|
* per request, leaving no static shape to infer from.
|
|
84
84
|
*/
|
|
85
|
-
interface McpxTool<Shape extends z.ZodRawShape = z.ZodRawShape, Args = z.infer<z.ZodObject<Shape>>> {
|
|
85
|
+
export interface McpxTool<Shape extends z.ZodRawShape = z.ZodRawShape, Args = z.infer<z.ZodObject<Shape>>> {
|
|
86
86
|
/** camelCase, unique, not one of the builtin tool names. */
|
|
87
87
|
name: string;
|
|
88
88
|
/** Built per request so it can state what this key's writes actually do. */
|
|
@@ -109,23 +109,23 @@ interface McpxTool<Shape extends z.ZodRawShape = z.ZodRawShape, Args = z.infer<z
|
|
|
109
109
|
}): CallToolResult | Promise<CallToolResult>;
|
|
110
110
|
}
|
|
111
111
|
/** Argument type erased, so a registry can hold tools of differing shapes. */
|
|
112
|
-
type McpxAnyTool = McpxTool<z.ZodRawShape, never>;
|
|
112
|
+
export type McpxAnyTool = McpxTool<z.ZodRawShape, never>;
|
|
113
113
|
/** Fixed shape; arguments inferred from it. */
|
|
114
|
-
declare function defineMcpxTool<Shape extends z.ZodRawShape>(tool: McpxTool<Shape> & {
|
|
114
|
+
export declare function defineMcpxTool<Shape extends z.ZodRawShape>(tool: McpxTool<Shape> & {
|
|
115
115
|
inputSchema?: Shape;
|
|
116
116
|
}): McpxTool<Shape>;
|
|
117
117
|
/** Per-request shape returned as an object literal; arguments inferred from it. */
|
|
118
|
-
declare function defineMcpxTool<Shape extends z.ZodRawShape>(tool: McpxTool<Shape> & {
|
|
118
|
+
export declare function defineMcpxTool<Shape extends z.ZodRawShape>(tool: McpxTool<Shape> & {
|
|
119
119
|
inputSchema: (scope: McpxToolScope) => Shape;
|
|
120
120
|
}): McpxAnyTool;
|
|
121
121
|
/**
|
|
122
122
|
* Per-request shape built from helpers that erase to `z.ZodRawShape`, as the
|
|
123
123
|
* builtins do. Nothing to infer from, so state the arguments instead.
|
|
124
124
|
*/
|
|
125
|
-
declare function defineMcpxTool<Args>(tool: McpxTool<z.ZodRawShape, Args> & {
|
|
125
|
+
export declare function defineMcpxTool<Args>(tool: McpxTool<z.ZodRawShape, Args> & {
|
|
126
126
|
inputSchema: (scope: McpxToolScope) => z.ZodRawShape;
|
|
127
127
|
}): McpxAnyTool;
|
|
128
|
-
interface McpxAuthResult {
|
|
128
|
+
export interface McpxAuthResult {
|
|
129
129
|
/** Must carry `collection`. */
|
|
130
130
|
user: TypedUser;
|
|
131
131
|
apiKeyId: number | string;
|
|
@@ -138,7 +138,7 @@ interface McpxAuthResult {
|
|
|
138
138
|
* A type alias rather than an interface: `definePlugin` constrains its options
|
|
139
139
|
* to `Record<string, unknown>`, which interfaces do not satisfy.
|
|
140
140
|
*/
|
|
141
|
-
type McpxPluginOptions = {
|
|
141
|
+
export type McpxPluginOptions = {
|
|
142
142
|
/** Allow-list of collections. `true` is shorthand for `{ read: true }`. */
|
|
143
143
|
collections: Partial<Record<CollectionSlug, McpxCollectionOptions | true>>;
|
|
144
144
|
/** Allow-list of globals. `true` is shorthand for `{ read: true }`. */
|
|
@@ -180,30 +180,29 @@ type McpxPluginOptions = {
|
|
|
180
180
|
};
|
|
181
181
|
};
|
|
182
182
|
/** What a key may do with one entity. Globals reuse this shape. */
|
|
183
|
-
interface McpxCollectionCapabilities {
|
|
183
|
+
export interface McpxCollectionCapabilities {
|
|
184
184
|
read: boolean;
|
|
185
185
|
write: boolean;
|
|
186
186
|
/** Only ever true where the config sets `write: "live"` and drafts exist. */
|
|
187
187
|
publish: boolean;
|
|
188
188
|
}
|
|
189
189
|
/** In force for one request: plugin config AND key checkboxes. */
|
|
190
|
-
interface McpxResolvedCapabilities {
|
|
190
|
+
export interface McpxResolvedCapabilities {
|
|
191
191
|
collections: Record<string, McpxCollectionCapabilities>;
|
|
192
192
|
globals: Record<string, McpxCollectionCapabilities>;
|
|
193
193
|
tools: Record<string, boolean>;
|
|
194
194
|
}
|
|
195
195
|
/** Stamped on `req.context.mcpx`; see {@link isMcpxRequest}. */
|
|
196
|
-
interface McpxRequestContext {
|
|
196
|
+
export interface McpxRequestContext {
|
|
197
197
|
apiKeyId: number | string;
|
|
198
198
|
capabilities: McpxResolvedCapabilities;
|
|
199
199
|
}
|
|
200
200
|
/** One reason a human could not publish the draft as it stands. */
|
|
201
|
-
interface PublishBlocker {
|
|
201
|
+
export interface PublishBlocker {
|
|
202
202
|
/** Resolved field label path, e.g. "Layout > Block 2 (Hero) > Title". */
|
|
203
203
|
field?: string;
|
|
204
204
|
message: string;
|
|
205
205
|
/** JSON Pointer to the offending value, e.g. "/layout/2/title". */
|
|
206
206
|
path: string;
|
|
207
207
|
}
|
|
208
|
-
//#endregion
|
|
209
|
-
export { McpxAnyTool, McpxAuthResult, McpxCollectionCapabilities, McpxCollectionOptions, McpxExposedEntity, McpxGlobalOptions, McpxPluginOptions, McpxRequestContext, McpxResolvedCapabilities, McpxTool, McpxToolExtra, McpxToolScope, McpxWriteMode, PublishBlocker, defineMcpxTool };
|
|
208
|
+
//#endregion
|
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": "1.0.1-beta.
|
|
4
|
+
"version": "1.0.1-beta.2",
|
|
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",
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
"@payloadcms/db-sqlite": "3.88.0",
|
|
69
69
|
"@payloadcms/richtext-lexical": "3.88.0",
|
|
70
70
|
"@payloadcms/ui": "3.88.0",
|
|
71
|
-
"@swc/core": "^1.16.
|
|
72
|
-
"@types/node": "^26.
|
|
71
|
+
"@swc/core": "^1.16.2",
|
|
72
|
+
"@types/node": "^26.5.1",
|
|
73
73
|
"@types/react": "^19.2.18",
|
|
74
|
-
"@vitest/coverage-v8": "^
|
|
75
|
-
"eslint": "^10.
|
|
74
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
75
|
+
"eslint": "^10.10.0",
|
|
76
76
|
"payload": "3.88.0",
|
|
77
77
|
"prettier": "^3.9.5",
|
|
78
78
|
"publint": "^0.3.24",
|
|
79
79
|
"react": "^19.2.8",
|
|
80
80
|
"react-dom": "^19.2.8",
|
|
81
|
-
"tsdown": "^0.
|
|
81
|
+
"tsdown": "^0.23.0",
|
|
82
82
|
"typescript": "^6.0.3",
|
|
83
|
-
"unplugin-swc": "^1.
|
|
84
|
-
"vitest": "^
|
|
83
|
+
"unplugin-swc": "^1.6.0",
|
|
84
|
+
"vitest": "^5.0.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@payloadcms/ui": ">=3.88.0 <4",
|