@payloadcms/plugin-mcp 4.0.0-internal.5b1e7cd → 4.0.0-internal.5f0cd13
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/bin.js +39 -0
- package/dist/collection/getAccessField.d.ts +12 -0
- package/dist/collection/getAccessField.d.ts.map +1 -0
- package/dist/collection/getAccessField.js +57 -0
- package/dist/collection/getAccessField.js.map +1 -0
- package/dist/collection/index.d.ts +6 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +59 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/components/AccessField/index.client.d.ts +10 -0
- package/dist/components/AccessField/index.client.d.ts.map +1 -0
- package/dist/components/AccessField/index.client.js +305 -0
- package/dist/components/AccessField/index.client.js.map +1 -0
- package/dist/components/AccessField/index.css +93 -0
- package/dist/defineTool.d.ts +26 -0
- package/dist/defineTool.d.ts.map +1 -0
- package/dist/defineTool.js +37 -0
- package/dist/defineTool.js.map +1 -0
- package/dist/endpoint/access.d.ts +10 -0
- package/dist/endpoint/access.d.ts.map +1 -0
- package/dist/endpoint/access.js +106 -0
- package/dist/endpoint/access.js.map +1 -0
- package/dist/endpoint/index.d.ts +3 -0
- package/dist/endpoint/index.d.ts.map +1 -0
- package/dist/endpoint/index.js +36 -0
- package/dist/endpoint/index.js.map +1 -0
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +4 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -67
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +19 -0
- package/dist/mcp/buildMcpServer.d.ts.map +1 -0
- package/dist/mcp/buildMcpServer.js +163 -0
- package/dist/mcp/buildMcpServer.js.map +1 -0
- package/dist/mcp/builtin/collections/authTools.d.ts +7 -0
- package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/authTools.js +250 -0
- package/dist/mcp/builtin/collections/authTools.js.map +1 -0
- package/dist/mcp/builtin/collections/createTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/createTool.js +87 -0
- package/dist/mcp/builtin/collections/createTool.js.map +1 -0
- package/dist/mcp/builtin/collections/deleteTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/deleteTool.js +117 -0
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findTool.js +159 -0
- package/dist/mcp/builtin/collections/findTool.js.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.js +187 -0
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findTool.js +76 -0
- package/dist/mcp/builtin/globals/findTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.js +92 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +37 -0
- package/dist/mcp/builtinTools.d.ts.map +1 -0
- package/dist/mcp/builtinTools.js +64 -0
- package/dist/mcp/builtinTools.js.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts +17 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.js +167 -0
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -0
- package/dist/stdio.d.ts +8 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +89 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +262 -455
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/camelCase.d.ts.map +1 -1
- package/dist/utils/getLogger.d.ts +10 -0
- package/dist/utils/getLogger.d.ts.map +1 -0
- package/dist/utils/getLogger.js +22 -0
- package/dist/utils/getLogger.js.map +1 -0
- package/dist/utils/getPluginConfig.d.ts +12 -0
- package/dist/utils/getPluginConfig.d.ts.map +1 -0
- package/dist/utils/getPluginConfig.js +15 -0
- package/dist/utils/getPluginConfig.js.map +1 -0
- package/dist/utils/localAPIDefaults.d.ts +20 -0
- package/dist/utils/localAPIDefaults.d.ts.map +1 -0
- package/dist/utils/localAPIDefaults.js +19 -0
- package/dist/utils/localAPIDefaults.js.map +1 -0
- package/dist/utils/resolveProjectRoot.d.ts +7 -0
- package/dist/utils/resolveProjectRoot.d.ts.map +1 -0
- package/dist/utils/resolveProjectRoot.js +15 -0
- package/dist/utils/resolveProjectRoot.js.map +1 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.d.ts +7 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.js +37 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.js.map +1 -0
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +2 -2
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts +2 -2
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js.map +1 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts +2 -2
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts.map +1 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js +7 -4
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js.map +1 -1
- package/dist/utils/schemaConversion/transformPointFields.d.ts +2 -2
- package/dist/utils/schemaConversion/transformPointFields.d.ts.map +1 -1
- package/dist/utils/schemaConversion/transformPointFields.js +7 -1
- package/dist/utils/schemaConversion/transformPointFields.js.map +1 -1
- package/dist/utils/toStandardSchema.d.ts +5 -0
- package/dist/utils/toStandardSchema.d.ts.map +1 -0
- package/dist/utils/toStandardSchema.js +4 -0
- package/dist/utils/toStandardSchema.js.map +1 -0
- package/package.json +35 -10
- package/src/collection/getAccessField.ts +64 -0
- package/src/collection/index.ts +63 -0
- package/src/components/AccessField/index.client.tsx +344 -0
- package/src/components/AccessField/index.css +93 -0
- package/src/defineTool.ts +44 -0
- package/src/endpoint/access.ts +132 -0
- package/src/endpoint/index.ts +35 -0
- package/src/exports/client.ts +2 -0
- package/src/index.ts +35 -85
- package/src/mcp/buildMcpServer.ts +224 -0
- package/src/mcp/builtin/collections/authTools.ts +233 -0
- package/src/mcp/builtin/collections/createTool.ts +116 -0
- package/src/mcp/builtin/collections/deleteTool.ts +123 -0
- package/src/mcp/builtin/collections/findTool.ts +187 -0
- package/src/mcp/builtin/collections/updateTool.ts +205 -0
- package/src/mcp/builtin/globals/findTool.ts +96 -0
- package/src/mcp/builtin/globals/updateTool.ts +118 -0
- package/src/mcp/builtinTools.ts +84 -0
- package/src/mcp/sanitizeMCPConfig.ts +239 -0
- package/src/stdio.ts +98 -0
- package/src/types.ts +295 -490
- package/src/utils/getLogger.ts +22 -0
- package/src/utils/getPluginConfig.ts +24 -0
- package/src/utils/localAPIDefaults.ts +22 -0
- package/src/utils/resolveProjectRoot.ts +17 -0
- package/src/utils/schemaConversion/prepareCollectionSchema.ts +39 -0
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +3 -3
- package/src/utils/schemaConversion/sanitizeJsonSchema.ts +4 -4
- package/src/utils/schemaConversion/simplifyRelationshipFields.ts +11 -6
- package/src/utils/schemaConversion/transformPointFields.ts +6 -5
- package/src/utils/toStandardSchema.ts +9 -0
- package/dist/collections/createApiKeysCollection.d.ts +0 -7
- package/dist/collections/createApiKeysCollection.d.ts.map +0 -1
- package/dist/collections/createApiKeysCollection.js +0 -317
- package/dist/collections/createApiKeysCollection.js.map +0 -1
- package/dist/defaults.d.ts +0 -4
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js +0 -5
- package/dist/defaults.js.map +0 -1
- package/dist/endpoints/mcp.d.ts +0 -4
- package/dist/endpoints/mcp.d.ts.map +0 -1
- package/dist/endpoints/mcp.js +0 -71
- package/dist/endpoints/mcp.js.map +0 -1
- package/dist/mcp/createRequest.d.ts +0 -3
- package/dist/mcp/createRequest.d.ts.map +0 -1
- package/dist/mcp/createRequest.js +0 -14
- package/dist/mcp/createRequest.js.map +0 -1
- package/dist/mcp/getMcpHandler.d.ts +0 -4
- package/dist/mcp/getMcpHandler.d.ts.map +0 -1
- package/dist/mcp/getMcpHandler.js +0 -231
- package/dist/mcp/getMcpHandler.js.map +0 -1
- package/dist/mcp/helpers/config.d.ts +0 -22
- package/dist/mcp/helpers/config.d.ts.map +0 -1
- package/dist/mcp/helpers/config.js +0 -153
- package/dist/mcp/helpers/config.js.map +0 -1
- package/dist/mcp/helpers/fields.d.ts +0 -19
- package/dist/mcp/helpers/fields.d.ts.map +0 -1
- package/dist/mcp/helpers/fields.js +0 -102
- package/dist/mcp/helpers/fields.js.map +0 -1
- package/dist/mcp/helpers/fileValidation.d.ts +0 -67
- package/dist/mcp/helpers/fileValidation.d.ts.map +0 -1
- package/dist/mcp/helpers/fileValidation.js +0 -267
- package/dist/mcp/helpers/fileValidation.js.map +0 -1
- package/dist/mcp/registerTool.d.ts +0 -6
- package/dist/mcp/registerTool.d.ts.map +0 -1
- package/dist/mcp/registerTool.js +0 -18
- package/dist/mcp/registerTool.js.map +0 -1
- package/dist/mcp/tools/auth/auth.d.ts +0 -4
- package/dist/mcp/tools/auth/auth.d.ts.map +0 -1
- package/dist/mcp/tools/auth/auth.js +0 -57
- package/dist/mcp/tools/auth/auth.js.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/forgotPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.js +0 -48
- package/dist/mcp/tools/auth/forgotPassword.js.map +0 -1
- package/dist/mcp/tools/auth/login.d.ts +0 -4
- package/dist/mcp/tools/auth/login.d.ts.map +0 -1
- package/dist/mcp/tools/auth/login.js +0 -51
- package/dist/mcp/tools/auth/login.js.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/resetPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.js +0 -49
- package/dist/mcp/tools/auth/resetPassword.js.map +0 -1
- package/dist/mcp/tools/auth/unlock.d.ts +0 -4
- package/dist/mcp/tools/auth/unlock.d.ts.map +0 -1
- package/dist/mcp/tools/auth/unlock.js +0 -48
- package/dist/mcp/tools/auth/unlock.js.map +0 -1
- package/dist/mcp/tools/auth/verify.d.ts +0 -4
- package/dist/mcp/tools/auth/verify.d.ts.map +0 -1
- package/dist/mcp/tools/auth/verify.js +0 -45
- package/dist/mcp/tools/auth/verify.js.map +0 -1
- package/dist/mcp/tools/collection/create.d.ts +0 -10
- package/dist/mcp/tools/collection/create.d.ts.map +0 -1
- package/dist/mcp/tools/collection/create.js +0 -139
- package/dist/mcp/tools/collection/create.js.map +0 -1
- package/dist/mcp/tools/collection/delete.d.ts +0 -10
- package/dist/mcp/tools/collection/delete.d.ts.map +0 -1
- package/dist/mcp/tools/collection/delete.js +0 -154
- package/dist/mcp/tools/collection/delete.js.map +0 -1
- package/dist/mcp/tools/collection/find.d.ts +0 -10
- package/dist/mcp/tools/collection/find.d.ts.map +0 -1
- package/dist/mcp/tools/collection/find.js +0 -165
- package/dist/mcp/tools/collection/find.js.map +0 -1
- package/dist/mcp/tools/collection/update.d.ts +0 -10
- package/dist/mcp/tools/collection/update.d.ts.map +0 -1
- package/dist/mcp/tools/collection/update.js +0 -209
- package/dist/mcp/tools/collection/update.js.map +0 -1
- package/dist/mcp/tools/config/find.d.ts +0 -10
- package/dist/mcp/tools/config/find.d.ts.map +0 -1
- package/dist/mcp/tools/config/find.js +0 -97
- package/dist/mcp/tools/config/find.js.map +0 -1
- package/dist/mcp/tools/config/update.d.ts +0 -10
- package/dist/mcp/tools/config/update.d.ts.map +0 -1
- package/dist/mcp/tools/config/update.js +0 -215
- package/dist/mcp/tools/config/update.js.map +0 -1
- package/dist/mcp/tools/global/find.d.ts +0 -5
- package/dist/mcp/tools/global/find.d.ts.map +0 -1
- package/dist/mcp/tools/global/find.js +0 -82
- package/dist/mcp/tools/global/find.js.map +0 -1
- package/dist/mcp/tools/global/update.d.ts +0 -6
- package/dist/mcp/tools/global/update.d.ts.map +0 -1
- package/dist/mcp/tools/global/update.js +0 -124
- package/dist/mcp/tools/global/update.js.map +0 -1
- package/dist/mcp/tools/job/create.d.ts +0 -10
- package/dist/mcp/tools/job/create.d.ts.map +0 -1
- package/dist/mcp/tools/job/create.js +0 -293
- package/dist/mcp/tools/job/create.js.map +0 -1
- package/dist/mcp/tools/job/run.d.ts +0 -10
- package/dist/mcp/tools/job/run.d.ts.map +0 -1
- package/dist/mcp/tools/job/run.js +0 -129
- package/dist/mcp/tools/job/run.js.map +0 -1
- package/dist/mcp/tools/job/update.d.ts +0 -11
- package/dist/mcp/tools/job/update.d.ts.map +0 -1
- package/dist/mcp/tools/job/update.js +0 -186
- package/dist/mcp/tools/job/update.js.map +0 -1
- package/dist/mcp/tools/resource/create.d.ts +0 -6
- package/dist/mcp/tools/resource/create.d.ts.map +0 -1
- package/dist/mcp/tools/resource/create.js +0 -124
- package/dist/mcp/tools/resource/create.js.map +0 -1
- package/dist/mcp/tools/resource/delete.d.ts +0 -5
- package/dist/mcp/tools/resource/delete.d.ts.map +0 -1
- package/dist/mcp/tools/resource/delete.js +0 -151
- package/dist/mcp/tools/resource/delete.js.map +0 -1
- package/dist/mcp/tools/resource/find.d.ts +0 -5
- package/dist/mcp/tools/resource/find.d.ts.map +0 -1
- package/dist/mcp/tools/resource/find.js +0 -170
- package/dist/mcp/tools/resource/find.js.map +0 -1
- package/dist/mcp/tools/resource/update.d.ts +0 -6
- package/dist/mcp/tools/resource/update.d.ts.map +0 -1
- package/dist/mcp/tools/resource/update.js +0 -256
- package/dist/mcp/tools/resource/update.js.map +0 -1
- package/dist/mcp/tools/schemas.d.ts +0 -457
- package/dist/mcp/tools/schemas.d.ts.map +0 -1
- package/dist/mcp/tools/schemas.js +0 -243
- package/dist/mcp/tools/schemas.js.map +0 -1
- package/dist/utils/adminEntitySettings.d.ts +0 -17
- package/dist/utils/adminEntitySettings.d.ts.map +0 -1
- package/dist/utils/adminEntitySettings.js +0 -41
- package/dist/utils/adminEntitySettings.js.map +0 -1
- package/dist/utils/createApiKeyFields.d.ts +0 -15
- package/dist/utils/createApiKeyFields.d.ts.map +0 -1
- package/dist/utils/createApiKeyFields.js +0 -57
- package/dist/utils/createApiKeyFields.js.map +0 -1
- package/dist/utils/getEnabledSlugs.d.ts +0 -13
- package/dist/utils/getEnabledSlugs.d.ts.map +0 -1
- package/dist/utils/getEnabledSlugs.js +0 -32
- package/dist/utils/getEnabledSlugs.js.map +0 -1
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts +0 -3
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts.map +0 -1
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js +0 -43
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js.map +0 -1
- package/src/collections/createApiKeysCollection.ts +0 -373
- package/src/defaults.ts +0 -3
- package/src/endpoints/mcp.ts +0 -91
- package/src/mcp/createRequest.ts +0 -13
- package/src/mcp/getMcpHandler.ts +0 -545
- package/src/mcp/helpers/config.ts +0 -213
- package/src/mcp/helpers/fields.ts +0 -154
- package/src/mcp/helpers/fileValidation.ts +0 -362
- package/src/mcp/registerTool.ts +0 -22
- package/src/mcp/tools/auth/auth.ts +0 -71
- package/src/mcp/tools/auth/forgotPassword.ts +0 -70
- package/src/mcp/tools/auth/login.ts +0 -72
- package/src/mcp/tools/auth/resetPassword.ts +0 -61
- package/src/mcp/tools/auth/unlock.ts +0 -64
- package/src/mcp/tools/auth/verify.ts +0 -57
- package/src/mcp/tools/collection/create.ts +0 -210
- package/src/mcp/tools/collection/delete.ts +0 -211
- package/src/mcp/tools/collection/find.ts +0 -224
- package/src/mcp/tools/collection/update.ts +0 -290
- package/src/mcp/tools/config/find.ts +0 -128
- package/src/mcp/tools/config/update.ts +0 -280
- package/src/mcp/tools/global/find.ts +0 -128
- package/src/mcp/tools/global/update.ts +0 -207
- package/src/mcp/tools/job/create.ts +0 -416
- package/src/mcp/tools/job/run.ts +0 -167
- package/src/mcp/tools/job/update.ts +0 -274
- package/src/mcp/tools/resource/create.ts +0 -211
- package/src/mcp/tools/resource/delete.ts +0 -218
- package/src/mcp/tools/resource/find.ts +0 -246
- package/src/mcp/tools/resource/update.ts +0 -383
- package/src/mcp/tools/schemas.ts +0 -520
- package/src/utils/adminEntitySettings.ts +0 -40
- package/src/utils/createApiKeyFields.ts +0 -72
- package/src/utils/getEnabledSlugs.ts +0 -42
- package/src/utils/schemaConversion/convertCollectionSchemaToZod.ts +0 -52
package/dist/types.d.ts
CHANGED
|
@@ -1,482 +1,289 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
text: string;
|
|
33
|
-
type: string;
|
|
34
|
-
}>;
|
|
35
|
-
};
|
|
36
|
-
}>>;
|
|
1
|
+
import type { CallToolResult, ContentBlock, JsonSchemaType, McpServer, ResourceTemplate, ServerContext, StandardSchemaWithJSON } from '@modelcontextprotocol/server';
|
|
2
|
+
import type { AuthCollectionSlug, CollectionConfig, CollectionSlug, DefaultDocumentIDType, GlobalSlug, MaybePromise, PayloadRequest, TypedUser } from 'payload';
|
|
3
|
+
import type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName } from './mcp/builtinTools.js';
|
|
4
|
+
export type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName };
|
|
5
|
+
/** Re-exported from `@modelcontextprotocol/server` — the JSON Schema shape the MCP runtime validates against. */
|
|
6
|
+
export type { JsonSchemaType, StandardSchemaWithJSON };
|
|
7
|
+
/**
|
|
8
|
+
* What a tool's `input` (or a prompt's `argsSchema`) can be — either a raw
|
|
9
|
+
* JSON Schema literal, or a Standard Schema instance (Zod, Valibot, …).
|
|
10
|
+
*/
|
|
11
|
+
export type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON;
|
|
12
|
+
/**
|
|
13
|
+
* Serializable mirror of `SanitizedMCPPluginConfig` for client components —
|
|
14
|
+
* the full sanitized config carries functions (tool handlers, etc.) that can't
|
|
15
|
+
* cross the server→client boundary. Built by `sanitizeClientPluginConfig` and
|
|
16
|
+
* passed to the `AccessField` component via `clientProps`.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export type ClientMCPPluginConfig = {
|
|
21
|
+
items: Array<{
|
|
22
|
+
collectionSlug?: string;
|
|
23
|
+
description: string;
|
|
24
|
+
globalSlug?: string;
|
|
25
|
+
key: string;
|
|
26
|
+
label: string;
|
|
27
|
+
type: 'collectionTool' | 'globalTool' | 'prompt' | 'resource' | 'tool';
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
export type MCPToolResponse = {
|
|
31
|
+
content: ContentBlock[];
|
|
37
32
|
/**
|
|
38
|
-
*
|
|
33
|
+
* If available, return the document fetched within the
|
|
34
|
+
* mcp tool. This is threaded as an additional argument to
|
|
35
|
+
* overrideResponse functions and stripped before going on the wire.
|
|
39
36
|
*/
|
|
40
|
-
|
|
37
|
+
doc?: Record<string, unknown>;
|
|
38
|
+
} & Pick<CallToolResult, '_meta' | 'isError' | 'structuredContent'>;
|
|
39
|
+
export type MCPResponseOverride = (response: MCPToolResponse, doc: Record<string, unknown>, req: PayloadRequest) => MCPToolResponse;
|
|
40
|
+
/**
|
|
41
|
+
* The handler's `input` type. A specific Standard Schema (Zod, Valibot, …) gets
|
|
42
|
+
* its inferred output; anything else falls back to `Record<string, unknown>`.
|
|
43
|
+
*/
|
|
44
|
+
export type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON ? StandardSchemaWithJSON extends TSchema ? Record<string, unknown> : StandardSchemaWithJSON.InferOutput<TSchema> : Record<string, unknown>;
|
|
45
|
+
export type ToolHandlerArgs<TSchema = undefined> = {
|
|
46
|
+
authorizedMCP: AuthorizedMCP;
|
|
47
|
+
input: TypedInput<TSchema>;
|
|
48
|
+
req: PayloadRequest;
|
|
49
|
+
serverContext: ServerContext;
|
|
50
|
+
};
|
|
51
|
+
export type CollectionToolHandlerArgs<TSchema = undefined> = {
|
|
52
|
+
collectionSlug: CollectionSlug;
|
|
53
|
+
} & ToolHandlerArgs<TSchema>;
|
|
54
|
+
export type GlobalToolHandlerArgs<TSchema = undefined> = {
|
|
55
|
+
globalSlug: GlobalSlug;
|
|
56
|
+
} & ToolHandlerArgs<TSchema>;
|
|
57
|
+
export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
58
|
+
description: string;
|
|
59
|
+
handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
60
|
+
input?: TSchema;
|
|
41
61
|
/**
|
|
42
|
-
*
|
|
43
|
-
* **These features are for experimental purposes -- They are Disabled in Production by Default**
|
|
62
|
+
* Override the return value of the tool handler
|
|
44
63
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
64
|
+
overrideResponse?: MCPResponseOverride;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* `TSchema` is the schema itself (Standard Schema, raw JSON Schema, or undefined).
|
|
68
|
+
* The function-form variant of `input` carries a concrete `{ collectionSchema: JsonSchemaType }`
|
|
69
|
+
* parameter type so callers can write `({ collectionSchema }) => …` without annotating it.
|
|
70
|
+
*/
|
|
71
|
+
export type CollectionTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
72
|
+
handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
73
|
+
input?: ((args: {
|
|
74
|
+
collectionSchema: JsonSchemaType;
|
|
75
|
+
}) => TSchema) | TSchema;
|
|
76
|
+
} & Pick<Tool, 'description' | 'overrideResponse'>;
|
|
77
|
+
export type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
78
|
+
handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
79
|
+
input?: ((args: {
|
|
80
|
+
globalSchema: JsonSchemaType;
|
|
81
|
+
}) => TSchema) | TSchema;
|
|
82
|
+
} & Pick<Tool, 'description' | 'overrideResponse'>;
|
|
83
|
+
/**
|
|
84
|
+
* Configures (or disables) a built-in tool without replacing it.
|
|
85
|
+
* `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a
|
|
86
|
+
* required handler) from being silently accepted at a built-in key slot.
|
|
87
|
+
*/
|
|
88
|
+
export type MCPBuiltInToolOverride = {
|
|
89
|
+
description?: string;
|
|
90
|
+
handler?: never;
|
|
91
|
+
overrideResponse?: MCPResponseOverride;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Value at a custom (non-built-in) tool key. Either the tool itself, or `false`
|
|
95
|
+
* to disable it (useful when one plugin defines a custom tool and another
|
|
96
|
+
* wants to opt out per-collection).
|
|
97
|
+
*/
|
|
98
|
+
export type MCPTopLevelToolEntry = Tool;
|
|
99
|
+
export type MCPCollectionToolsMap = {
|
|
100
|
+
[customToolName: string]: boolean | CollectionTool | MCPBuiltInToolOverride | undefined;
|
|
101
|
+
} & {
|
|
102
|
+
[K in MCPCollectionBuiltinName]?: false | MCPBuiltInToolOverride;
|
|
103
|
+
};
|
|
104
|
+
export type MCPAuthCollectionToolsMap = {
|
|
105
|
+
[K in MCPCollectionAuthToolName]?: MCPBuiltInToolOverride | true;
|
|
106
|
+
} & MCPCollectionToolsMap;
|
|
107
|
+
/** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */
|
|
108
|
+
export type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends AuthCollectionSlug ? MCPAuthCollectionToolsMap : MCPCollectionToolsMap;
|
|
109
|
+
export type MCPGlobalToolsMap = {
|
|
110
|
+
[customToolName: string]: boolean | GlobalTool | MCPBuiltInToolOverride | undefined;
|
|
111
|
+
} & {
|
|
112
|
+
[K in MCPGlobalBuiltinName]?: false | MCPBuiltInToolOverride;
|
|
113
|
+
};
|
|
114
|
+
export type MCPTopLevelToolsMap = Record<string, Tool>;
|
|
115
|
+
export type PromptHandlerArgs<TSchema = undefined> = {
|
|
116
|
+
input: TypedInput<TSchema>;
|
|
117
|
+
req: PayloadRequest;
|
|
118
|
+
serverContext: ServerContext;
|
|
119
|
+
};
|
|
120
|
+
export type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {
|
|
121
|
+
argsSchema: TSchema;
|
|
122
|
+
description: string;
|
|
123
|
+
handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{
|
|
124
|
+
messages: Array<{
|
|
125
|
+
content: {
|
|
126
|
+
text: string;
|
|
127
|
+
type: 'text';
|
|
101
128
|
};
|
|
102
|
-
|
|
129
|
+
role: 'assistant' | 'user';
|
|
130
|
+
}>;
|
|
131
|
+
}>;
|
|
132
|
+
title: string;
|
|
133
|
+
};
|
|
134
|
+
export type ResourceHandlerArgs = {
|
|
135
|
+
/** Variables extracted from a `ResourceTemplate` URI. Empty for static-URI resources. */
|
|
136
|
+
params: Record<string, string>;
|
|
137
|
+
req: PayloadRequest;
|
|
138
|
+
serverContext: ServerContext;
|
|
139
|
+
uri: URL;
|
|
140
|
+
};
|
|
141
|
+
export type Resource = {
|
|
142
|
+
description: string;
|
|
143
|
+
handler: (args: ResourceHandlerArgs) => MaybePromise<{
|
|
144
|
+
contents: Array<{
|
|
145
|
+
text: string;
|
|
146
|
+
uri: string;
|
|
147
|
+
}>;
|
|
148
|
+
}>;
|
|
149
|
+
mimeType: string;
|
|
150
|
+
title: string;
|
|
151
|
+
uri: ResourceTemplate | string;
|
|
152
|
+
};
|
|
153
|
+
export type MCPPluginCollectionConfig<TSlug extends CollectionSlug> = {
|
|
154
|
+
description?: string;
|
|
155
|
+
/** Fallback for built-in tools that don't set their own `overrideResponse`. */
|
|
156
|
+
overrideResponse?: MCPResponseOverride;
|
|
157
|
+
tools?: MCPToolsMapForCollection<TSlug>;
|
|
158
|
+
};
|
|
159
|
+
export type MCPPluginGlobalConfig = {
|
|
160
|
+
description?: string;
|
|
161
|
+
overrideResponse?: MCPResponseOverride;
|
|
162
|
+
tools?: MCPGlobalToolsMap;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* The user-facing config shape passed to `mcpPlugin({ ... })`. Tools, prompts,
|
|
166
|
+
* resources, and per-collection/global tool maps live in their own nested
|
|
167
|
+
* fields. `sanitizeMCPConfig` flattens those into `items` and applies defaults
|
|
168
|
+
* to produce a `SanitizedMCPPluginConfig` — the form every internal consumer
|
|
169
|
+
* actually works with.
|
|
170
|
+
*/
|
|
171
|
+
export type MCPPluginConfig = {
|
|
172
|
+
collections?: {
|
|
173
|
+
[Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>;
|
|
174
|
+
};
|
|
175
|
+
/** Skip MCP registration. The API key collection is still added (so DB / types stay stable). */
|
|
176
|
+
disabled?: boolean;
|
|
177
|
+
globals?: {
|
|
178
|
+
[Slug in GlobalSlug]?: MCPPluginGlobalConfig;
|
|
103
179
|
};
|
|
104
|
-
/**
|
|
105
|
-
* Set the globals that should be available as resources via MCP.
|
|
106
|
-
* Globals are singleton configuration objects (e.g., site settings, navigation).
|
|
107
|
-
* Note: Globals only support find and update operations.
|
|
108
|
-
*/
|
|
109
|
-
globals?: Partial<Record<GlobalSlug, {
|
|
110
|
-
/**
|
|
111
|
-
* Set the description of the global. This is used by MCP clients to determine when to use the global as a resource.
|
|
112
|
-
*/
|
|
113
|
-
description?: string;
|
|
114
|
-
/**
|
|
115
|
-
* Set the enabled capabilities of the global. Admins can then allow or disallow the use of the capability by MCP clients.
|
|
116
|
-
* Note: Globals only support find and update operations as they are singletons.
|
|
117
|
-
*/
|
|
118
|
-
enabled: {
|
|
119
|
-
find?: boolean;
|
|
120
|
-
update?: boolean;
|
|
121
|
-
} | boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Override the response generated by the MCP client. This allows you to modify the response that is sent to the MCP client. This is useful for adding additional data to the response, data normalization, or verifying data.
|
|
124
|
-
*/
|
|
125
|
-
overrideResponse?: (response: {
|
|
126
|
-
content: Array<{
|
|
127
|
-
text: string;
|
|
128
|
-
type: string;
|
|
129
|
-
}>;
|
|
130
|
-
}, doc: Record<string, unknown>, req: PayloadRequest) => {
|
|
131
|
-
content: Array<{
|
|
132
|
-
text: string;
|
|
133
|
-
type: string;
|
|
134
|
-
}>;
|
|
135
|
-
};
|
|
136
|
-
}>>;
|
|
137
|
-
/**
|
|
138
|
-
* MCP Server options.
|
|
139
|
-
*/
|
|
140
180
|
mcp?: {
|
|
141
|
-
handlerOptions?: MCPHandlerOptions;
|
|
142
|
-
/**
|
|
143
|
-
* Add custom MCP Prompts.
|
|
144
|
-
*/
|
|
145
|
-
prompts?: {
|
|
146
|
-
/**
|
|
147
|
-
* Set the args schema of the prompt. This is the args schema that will be passed to the prompt. This is used by MCP clients to determine the arguments that will be passed to the prompt.
|
|
148
|
-
*/
|
|
149
|
-
argsSchema: z.ZodRawShape;
|
|
150
|
-
/**
|
|
151
|
-
* Set the description of the prompt. This is used by MCP clients to determine when to use the prompt.
|
|
152
|
-
*/
|
|
153
|
-
description: string;
|
|
154
|
-
/**
|
|
155
|
-
* Set the handler of the prompt. This is the function that will be called when the prompt is used.
|
|
156
|
-
*/
|
|
157
|
-
handler: (args: Record<string, unknown>, req: PayloadRequest, _extra: unknown) => {
|
|
158
|
-
messages: Array<{
|
|
159
|
-
content: {
|
|
160
|
-
text: string;
|
|
161
|
-
type: 'text';
|
|
162
|
-
};
|
|
163
|
-
role: 'assistant' | 'user';
|
|
164
|
-
}>;
|
|
165
|
-
} | Promise<{
|
|
166
|
-
messages: Array<{
|
|
167
|
-
content: {
|
|
168
|
-
text: string;
|
|
169
|
-
type: 'text';
|
|
170
|
-
};
|
|
171
|
-
role: 'assistant' | 'user';
|
|
172
|
-
}>;
|
|
173
|
-
}>;
|
|
174
|
-
/**
|
|
175
|
-
* Set the function name of the prompt.
|
|
176
|
-
*/
|
|
177
|
-
name: string;
|
|
178
|
-
/**
|
|
179
|
-
* Set the title of the prompt. LLMs will interperate the title to determine when to use the prompt.
|
|
180
|
-
*/
|
|
181
|
-
title: string;
|
|
182
|
-
}[];
|
|
183
|
-
/**
|
|
184
|
-
* Add custom MCP Resource.
|
|
185
|
-
*/
|
|
186
|
-
resources?: {
|
|
187
|
-
/**
|
|
188
|
-
* Set the description of the resource. This is used by MCP clients to determine when to use the resource.
|
|
189
|
-
* example: 'Data is a resource that contains special data.'
|
|
190
|
-
*/
|
|
191
|
-
description: string;
|
|
192
|
-
/**
|
|
193
|
-
* Set the handler of the resource. This is the function that will be called when the resource is used.
|
|
194
|
-
* The handler can have either 3 arguments (when no args are passed) or 4 arguments (when args are passed).
|
|
195
|
-
*/
|
|
196
|
-
handler: (...args: any[]) => {
|
|
197
|
-
contents: Array<{
|
|
198
|
-
text: string;
|
|
199
|
-
uri: string;
|
|
200
|
-
}>;
|
|
201
|
-
} | Promise<{
|
|
202
|
-
contents: Array<{
|
|
203
|
-
text: string;
|
|
204
|
-
uri: string;
|
|
205
|
-
}>;
|
|
206
|
-
}>;
|
|
207
|
-
/**
|
|
208
|
-
* Set the mime type of the resource.
|
|
209
|
-
* example: 'text/plain'
|
|
210
|
-
*/
|
|
211
|
-
mimeType: string;
|
|
212
|
-
/**
|
|
213
|
-
* Set the function name of the resource.
|
|
214
|
-
* example: 'data'
|
|
215
|
-
*/
|
|
216
|
-
name: string;
|
|
217
|
-
/**
|
|
218
|
-
* Set the title of the resource. LLMs will interperate the title to determine when to use the resource.
|
|
219
|
-
* example: 'Data'
|
|
220
|
-
*/
|
|
221
|
-
title: string;
|
|
222
|
-
/**
|
|
223
|
-
* Set the uri of the resource.
|
|
224
|
-
* example: 'data://app'
|
|
225
|
-
*/
|
|
226
|
-
uri: ResourceTemplate | string;
|
|
227
|
-
}[];
|
|
228
181
|
serverOptions?: MCPServerOptions;
|
|
229
|
-
|
|
230
|
-
* Add custom MCP Tools.
|
|
231
|
-
*/
|
|
232
|
-
tools?: {
|
|
233
|
-
/**
|
|
234
|
-
* Set the description of the tool. This is used by MCP clients to determine when to use the tool.
|
|
235
|
-
*/
|
|
236
|
-
description: string;
|
|
237
|
-
/**
|
|
238
|
-
* Set the handler of the tool. This is the function that will be called when the tool is used.
|
|
239
|
-
*/
|
|
240
|
-
handler: (args: Record<string, unknown>, req: PayloadRequest, _extra: unknown) => {
|
|
241
|
-
content: Array<{
|
|
242
|
-
text: string;
|
|
243
|
-
type: 'text';
|
|
244
|
-
}>;
|
|
245
|
-
role?: string;
|
|
246
|
-
} | Promise<{
|
|
247
|
-
content: Array<{
|
|
248
|
-
text: string;
|
|
249
|
-
type: 'text';
|
|
250
|
-
}>;
|
|
251
|
-
role?: string;
|
|
252
|
-
}>;
|
|
253
|
-
/**
|
|
254
|
-
* Set the name of the tool. This is the name that will be used to identify the tool. LLMs will interperate the name to determine when to use the tool.
|
|
255
|
-
*/
|
|
256
|
-
name: string;
|
|
257
|
-
/**
|
|
258
|
-
* Set the parameters of the tool. This is the parameters that will be passed to the tool.
|
|
259
|
-
*/
|
|
260
|
-
parameters: z.ZodRawShape;
|
|
261
|
-
}[];
|
|
182
|
+
verboseLogs?: boolean;
|
|
262
183
|
};
|
|
263
|
-
/**
|
|
264
|
-
* Override the API key collection.
|
|
265
|
-
* This allows you to add fields to the API key collection or modify the collection in any way you want.
|
|
266
|
-
* @param collection - The API key collection.
|
|
267
|
-
* @returns The modified API key collection.
|
|
268
|
-
*/
|
|
269
184
|
overrideApiKeyCollection?: (collection: CollectionConfig) => CollectionConfig;
|
|
270
|
-
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
185
|
+
/** Replace the default API-key auth with a custom resolver. */
|
|
186
|
+
overrideAuth?: (args: {
|
|
187
|
+
getAPIKeyDoc: (overrideApiKey?: string) => Promise<MCPAPIKeysDoc>;
|
|
188
|
+
getAuthorizedMCP: (args: {
|
|
189
|
+
apiKeyDoc: MCPAPIKeysDoc;
|
|
190
|
+
}) => AuthorizedMCP;
|
|
191
|
+
pluginConfig: SanitizedMCPPluginConfig;
|
|
192
|
+
req: PayloadRequest;
|
|
193
|
+
}) => MaybePromise<AuthorizedMCP>;
|
|
194
|
+
prompts?: Record<string, Prompt>;
|
|
195
|
+
resources?: Record<string, Resource>;
|
|
196
|
+
/** Cross-cutting tools (not scoped to any collection or global). */
|
|
197
|
+
tools?: MCPTopLevelToolsMap;
|
|
280
198
|
userCollection?: CollectionSlug;
|
|
281
199
|
};
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
*/
|
|
290
|
-
basePath?: string;
|
|
291
|
-
/**
|
|
292
|
-
* If true, disables the SSE endpoint. Only Streamable HTTP will be available.
|
|
293
|
-
* @default true
|
|
294
|
-
*/
|
|
295
|
-
disableSse?: boolean;
|
|
296
|
-
/**
|
|
297
|
-
* Set the maximum duration of the MCP handler. This is the maximum duration that the MCP handler will run for.
|
|
298
|
-
* @default 60
|
|
299
|
-
*/
|
|
300
|
-
maxDuration?: number;
|
|
301
|
-
/**
|
|
302
|
-
* Callback function that receives MCP events.
|
|
303
|
-
* This can be used to track analytics, debug issues, or implement custom behaviors.
|
|
304
|
-
*/
|
|
305
|
-
onEvent?: (event: unknown) => void;
|
|
306
|
-
/**
|
|
307
|
-
* Set the Redis URL for the MCP handler. This is the URL that will be used to access the Redis server.
|
|
308
|
-
* @default process.env.REDIS_URL
|
|
309
|
-
*/
|
|
310
|
-
redisUrl?: string;
|
|
311
|
-
/**
|
|
312
|
-
* Set verbose logging.
|
|
313
|
-
* @default false
|
|
314
|
-
*/
|
|
315
|
-
verboseLogs?: boolean;
|
|
200
|
+
export type SanitizedMCPPluginConfig = {
|
|
201
|
+
items: MCPItem[];
|
|
202
|
+
userCollection: CollectionSlug;
|
|
203
|
+
} & Pick<MCPPluginConfig, 'disabled' | 'mcp' | 'overrideApiKeyCollection' | 'overrideAuth'>;
|
|
204
|
+
export type MCPServerOptions = {
|
|
205
|
+
options?: ConstructorParameters<typeof McpServer>[1];
|
|
206
|
+
serverInfo?: Partial<ConstructorParameters<typeof McpServer>[0]>;
|
|
316
207
|
};
|
|
317
208
|
/**
|
|
318
|
-
*
|
|
209
|
+
* Nested access tree as stored in the collection.
|
|
210
|
+
* A `false` leaf disables that tool; missing keys defer to
|
|
211
|
+
* defaults (built-in CRUD is on, opt-in tools are off).
|
|
319
212
|
*/
|
|
320
|
-
export type
|
|
321
|
-
/**
|
|
322
|
-
* Optional instructions describing how to use the server and its features.
|
|
323
|
-
*/
|
|
324
|
-
instructions?: string;
|
|
325
|
-
/**
|
|
326
|
-
* Set the server info of the MCP server.
|
|
327
|
-
*/
|
|
328
|
-
serverInfo?: {
|
|
329
|
-
/**
|
|
330
|
-
* Set the name of the MCP server.
|
|
331
|
-
* @default 'Payload MCP Server'
|
|
332
|
-
*/
|
|
333
|
-
name: string;
|
|
334
|
-
/**
|
|
335
|
-
* Set the version of the MCP server.
|
|
336
|
-
* @default '1.0.0'
|
|
337
|
-
*/
|
|
338
|
-
version: string;
|
|
339
|
-
};
|
|
340
|
-
};
|
|
341
|
-
export type MCPAccessSettings = {
|
|
342
|
-
auth?: {
|
|
343
|
-
auth?: boolean;
|
|
344
|
-
forgotPassword?: boolean;
|
|
345
|
-
login?: boolean;
|
|
346
|
-
resetPassword?: boolean;
|
|
347
|
-
unlock?: boolean;
|
|
348
|
-
verify?: boolean;
|
|
349
|
-
};
|
|
213
|
+
export type MCPAPIKeysDocAccessTree = {
|
|
350
214
|
collections?: {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
update?: boolean;
|
|
355
|
-
};
|
|
356
|
-
config?: {
|
|
357
|
-
find?: boolean;
|
|
358
|
-
update?: boolean;
|
|
215
|
+
[CollectionSlug: CollectionSlug]: {
|
|
216
|
+
[ToolKey: string]: boolean;
|
|
217
|
+
};
|
|
359
218
|
};
|
|
360
|
-
custom?: Record<string, boolean>;
|
|
361
219
|
globals?: {
|
|
362
|
-
|
|
363
|
-
|
|
220
|
+
[GlobalSlug: GlobalSlug]: {
|
|
221
|
+
[ToolKey: string]: boolean;
|
|
222
|
+
};
|
|
364
223
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
run?: boolean;
|
|
368
|
-
update?: boolean;
|
|
224
|
+
prompts?: {
|
|
225
|
+
[PromptKey: string]: boolean;
|
|
369
226
|
};
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
'payload-mcp-tool'?: Record<string, boolean>;
|
|
373
|
-
user: TypedUser;
|
|
374
|
-
} & Record<string, unknown>;
|
|
375
|
-
export type EntityConfig = MCPPluginConfig['collections'] | MCPPluginConfig['globals'];
|
|
376
|
-
export type FieldDefinition = {
|
|
377
|
-
description?: string;
|
|
378
|
-
name: string;
|
|
379
|
-
options?: {
|
|
380
|
-
label: string;
|
|
381
|
-
value: string;
|
|
382
|
-
}[];
|
|
383
|
-
position?: 'main' | 'sidebar';
|
|
384
|
-
required?: boolean;
|
|
385
|
-
type: string;
|
|
386
|
-
};
|
|
387
|
-
export type FieldModification = {
|
|
388
|
-
changes: {
|
|
389
|
-
description?: string;
|
|
390
|
-
options?: {
|
|
391
|
-
label: string;
|
|
392
|
-
value: string;
|
|
393
|
-
}[];
|
|
394
|
-
position?: 'main' | 'sidebar';
|
|
395
|
-
required?: boolean;
|
|
396
|
-
type?: string;
|
|
227
|
+
resources?: {
|
|
228
|
+
[ResourceKey: string]: boolean;
|
|
397
229
|
};
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
export type CollectionConfigUpdates = {
|
|
401
|
-
access?: {
|
|
402
|
-
create?: string;
|
|
403
|
-
delete?: string;
|
|
404
|
-
read?: string;
|
|
405
|
-
update?: string;
|
|
230
|
+
tools?: {
|
|
231
|
+
[ToolKey: string]: boolean;
|
|
406
232
|
};
|
|
407
|
-
description?: string;
|
|
408
|
-
slug?: string;
|
|
409
|
-
timestamps?: boolean;
|
|
410
|
-
versioning?: boolean;
|
|
411
233
|
};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
label: string;
|
|
421
|
-
name: string;
|
|
422
|
-
width: number;
|
|
423
|
-
}>;
|
|
424
|
-
};
|
|
425
|
-
logoutRoute?: string;
|
|
426
|
-
meta?: {
|
|
427
|
-
favicon?: string;
|
|
428
|
-
ogImage?: string;
|
|
429
|
-
titleSuffix?: string;
|
|
430
|
-
};
|
|
431
|
-
user?: string;
|
|
432
|
-
};
|
|
433
|
-
export type DatabaseConfig = {
|
|
434
|
-
connectOptions?: string;
|
|
435
|
-
type?: 'mongodb' | 'postgres';
|
|
436
|
-
url?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Stored on `payload-mcp-api-keys` docs
|
|
236
|
+
*/
|
|
237
|
+
export type MCPAPIKeysDoc = {
|
|
238
|
+
access: MCPAPIKeysDocAccessTree;
|
|
239
|
+
id: DefaultDocumentIDType;
|
|
240
|
+
overrideAccess?: boolean;
|
|
241
|
+
user: null | TypedUser;
|
|
437
242
|
};
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
243
|
+
/**
|
|
244
|
+
* One MCP primitive — tool, prompt, or resource — paired with the metadata both
|
|
245
|
+
* the endpoint and the API key collection need. Built by `sanitizeMCPConfig`,
|
|
246
|
+
* filtered by `getAuthorizedMCP`, registered by the MCP endpoint.
|
|
247
|
+
*
|
|
248
|
+
* - `key`: the config identifier (`find`, `echo`). Used for the API-key deny
|
|
249
|
+
* lookup and as the admin checkbox field name. For collection/global tools,
|
|
250
|
+
* the MCP wire name (`findPosts`) is derived from `key + slug` at
|
|
251
|
+
* registration time.
|
|
252
|
+
* - `label`: human-readable admin-UI display text for the checkbox.
|
|
253
|
+
* - `tool` / `prompt` / `resource`: the live primitive (its own
|
|
254
|
+
* `description` is what both MCP clients and the admin UI surface).
|
|
255
|
+
*/
|
|
256
|
+
export type MCPItemBase = {
|
|
257
|
+
key: string;
|
|
258
|
+
label: string;
|
|
441
259
|
};
|
|
442
|
-
export type
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
260
|
+
export type MCPItem = ({
|
|
261
|
+
collectionSlug: CollectionSlug;
|
|
262
|
+
tool: CollectionTool;
|
|
263
|
+
type: 'collectionTool';
|
|
264
|
+
} & MCPItemBase) | ({
|
|
265
|
+
globalSlug: GlobalSlug;
|
|
266
|
+
tool: GlobalTool;
|
|
267
|
+
type: 'globalTool';
|
|
268
|
+
} & MCPItemBase) | ({
|
|
269
|
+
prompt: Prompt;
|
|
270
|
+
type: 'prompt';
|
|
271
|
+
} & MCPItemBase) | ({
|
|
272
|
+
resource: Resource;
|
|
273
|
+
type: 'resource';
|
|
274
|
+
} & MCPItemBase) | ({
|
|
275
|
+
tool: Tool;
|
|
276
|
+
type: 'tool';
|
|
277
|
+
} & MCPItemBase);
|
|
278
|
+
/**
|
|
279
|
+
* The caller's identity + the MCP items they can use for this request. Returned
|
|
280
|
+
* by `getAuthorizedMCP`; denied items are simply absent from `items`. Handlers
|
|
281
|
+
* receive this via `args.authorizedMCP` so they can spread
|
|
282
|
+
* `localAPIDefaults(authorizedMCP)` into every local API call.
|
|
283
|
+
*/
|
|
284
|
+
export type AuthorizedMCP = {
|
|
285
|
+
items: MCPItem[];
|
|
286
|
+
overrideAccess: boolean;
|
|
287
|
+
user: null | TypedUser;
|
|
461
288
|
};
|
|
462
|
-
export interface SchemaField {
|
|
463
|
-
description?: string;
|
|
464
|
-
name: string;
|
|
465
|
-
options?: string[];
|
|
466
|
-
required?: boolean;
|
|
467
|
-
type: string;
|
|
468
|
-
}
|
|
469
|
-
export interface TaskSequenceItem {
|
|
470
|
-
description?: string;
|
|
471
|
-
retries?: number;
|
|
472
|
-
taskId: string;
|
|
473
|
-
taskSlug: string;
|
|
474
|
-
timeout?: number;
|
|
475
|
-
}
|
|
476
|
-
export interface JobConfigUpdate {
|
|
477
|
-
description?: string;
|
|
478
|
-
queue?: string;
|
|
479
|
-
retries?: number;
|
|
480
|
-
timeout?: number;
|
|
481
|
-
}
|
|
482
289
|
//# sourceMappingURL=types.d.ts.map
|