@payloadcms/plugin-mcp 4.0.0-internal.38b7f1d → 4.0.0-internal.4804abd
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/@types/assets.d.js +2 -0
- package/dist/@types/assets.d.js.map +1 -0
- package/dist/defaultAccess.d.ts +3 -0
- package/dist/defaultAccess.d.ts.map +1 -0
- package/dist/defaultAccess.js +3 -0
- package/dist/defaultAccess.js.map +1 -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 +22 -0
- package/dist/endpoint/access.d.ts.map +1 -0
- package/dist/endpoint/access.js +100 -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 +47 -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/exports/internal.d.ts +2 -0
- package/dist/exports/internal.d.ts.map +1 -0
- package/dist/exports/internal.js +3 -0
- package/dist/exports/internal.js.map +1 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -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 +201 -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 +288 -0
- package/dist/mcp/builtin/collections/authTools.js.map +1 -0
- package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countTool.js +69 -0
- package/dist/mcp/builtin/collections/countTool.js.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js +65 -0
- package/dist/mcp/builtin/collections/countVersionsTool.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 +111 -0
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.js +97 -0
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js +93 -0
- package/dist/mcp/builtin/collections/findDistinctTool.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 +165 -0
- package/dist/mcp/builtin/collections/findTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js +84 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js +99 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +9 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.js +60 -0
- package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +47 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js +82 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.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 +192 -0
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts +2 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.js +71 -0
- package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js +65 -0
- package/dist/mcp/builtin/globals/countVersionsTool.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 +73 -0
- package/dist/mcp/builtin/globals/findTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +80 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js +95 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +47 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js +78 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.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 +87 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
- package/dist/mcp/builtin/validateEntityData.d.ts +14 -0
- package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -0
- package/dist/mcp/builtin/validateEntityData.js +82 -0
- package/dist/mcp/builtin/validateEntityData.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +162 -0
- package/dist/mcp/builtinTools.d.ts.map +1 -0
- package/dist/mcp/builtinTools.js +163 -0
- package/dist/mcp/builtinTools.js.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts +16 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.js +229 -0
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -0
- package/dist/stdio.d.ts +9 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +108 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +222 -461
- 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/getEntityInputSchema.d.ts +11 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.js +32 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.js.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +10 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +384 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +133 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -0
- 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/dist/utils/whereSchema.d.ts +9 -0
- package/dist/utils/whereSchema.d.ts.map +1 -0
- package/dist/utils/whereSchema.js +13 -0
- package/dist/utils/whereSchema.js.map +1 -0
- package/package.json +32 -10
- package/src/@types/assets.d.ts +3 -0
- package/src/defaultAccess.ts +3 -0
- package/src/defineTool.ts +44 -0
- package/src/endpoint/access.ts +119 -0
- package/src/endpoint/index.ts +48 -0
- package/src/exports/client.ts +3 -0
- package/src/exports/internal.ts +1 -0
- package/src/index.ts +29 -87
- package/src/mcp/buildMcpServer.ts +264 -0
- package/src/mcp/builtin/collections/authTools.ts +269 -0
- package/src/mcp/builtin/collections/countTool.ts +74 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +70 -0
- package/src/mcp/builtin/collections/createTool.ts +112 -0
- package/src/mcp/builtin/collections/deleteTool.ts +126 -0
- package/src/mcp/builtin/collections/duplicateTool.ts +135 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +120 -0
- package/src/mcp/builtin/collections/findTool.ts +217 -0
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +110 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +155 -0
- package/src/mcp/builtin/collections/formatCollectionError.ts +84 -0
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +46 -0
- package/src/mcp/builtin/collections/restoreVersionTool.ts +108 -0
- package/src/mcp/builtin/collections/updateTool.ts +211 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +69 -0
- package/src/mcp/builtin/globals/countVersionsTool.ts +69 -0
- package/src/mcp/builtin/globals/findTool.ts +105 -0
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +104 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +148 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +41 -0
- package/src/mcp/builtin/globals/restoreVersionTool.ts +100 -0
- package/src/mcp/builtin/globals/updateTool.ts +115 -0
- package/src/mcp/builtin/validateEntityData.ts +132 -0
- package/src/mcp/builtinTools.ts +154 -0
- package/src/mcp/sanitizeMCPConfig.ts +277 -0
- package/src/stdio.ts +113 -0
- package/src/types.ts +263 -493
- 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/getEntityInputSchema.ts +62 -0
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +96 -0
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +432 -0
- package/src/utils/toStandardSchema.ts +9 -0
- package/src/utils/whereSchema.ts +24 -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/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +0 -7
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js +0 -20
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +0 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts +0 -13
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js +0 -56
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js.map +0 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts +0 -20
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts.map +0 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js +0 -53
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js.map +0 -1
- package/dist/utils/schemaConversion/transformPointFields.d.ts +0 -3
- package/dist/utils/schemaConversion/transformPointFields.d.ts.map +0 -1
- package/dist/utils/schemaConversion/transformPointFields.js +0 -51
- package/dist/utils/schemaConversion/transformPointFields.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/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
- package/src/utils/schemaConversion/sanitizeJsonSchema.ts +0 -62
- package/src/utils/schemaConversion/simplifyRelationshipFields.ts +0 -65
- package/src/utils/schemaConversion/transformPointFields.ts +0 -55
package/dist/types.d.ts
CHANGED
|
@@ -1,482 +1,243 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
collections?: Partial<Record<CollectionSlug, {
|
|
9
|
-
/**
|
|
10
|
-
* Set the description of the collection. This is used by MCP clients to determine when to use the collecton as a resource.
|
|
11
|
-
*/
|
|
12
|
-
description?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Set the enabled capabilities of the collection. Admins can then allow or disallow the use of the capability by MCP clients.
|
|
15
|
-
*/
|
|
16
|
-
enabled: {
|
|
17
|
-
create?: boolean;
|
|
18
|
-
delete?: boolean;
|
|
19
|
-
find?: boolean;
|
|
20
|
-
update?: boolean;
|
|
21
|
-
} | boolean;
|
|
22
|
-
/**
|
|
23
|
-
* 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.
|
|
24
|
-
*/
|
|
25
|
-
overrideResponse?: (response: {
|
|
26
|
-
content: Array<{
|
|
27
|
-
text: string;
|
|
28
|
-
type: string;
|
|
29
|
-
}>;
|
|
30
|
-
}, doc: Record<string, unknown>, req: PayloadRequest) => {
|
|
31
|
-
content: Array<{
|
|
32
|
-
text: string;
|
|
33
|
-
type: string;
|
|
34
|
-
}>;
|
|
35
|
-
};
|
|
36
|
-
}>>;
|
|
37
|
-
/**
|
|
38
|
-
* Disable the MCP plugin.
|
|
39
|
-
*/
|
|
40
|
-
disabled?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Experimental features
|
|
43
|
-
* **These features are for experimental purposes -- They are Disabled in Production by Default**
|
|
44
|
-
*/
|
|
45
|
-
experimental?: {
|
|
46
|
-
/**
|
|
47
|
-
* These are MCP tools that can be used by a client to modify Payload.
|
|
48
|
-
*/
|
|
49
|
-
tools: {
|
|
50
|
-
/**
|
|
51
|
-
* **Experimental** -- Auth MCP tools allow a client to change authentication priviliages for users. This is for developing ideas that help Admins with authentication tasks.
|
|
52
|
-
*/
|
|
53
|
-
auth?: {
|
|
54
|
-
/**
|
|
55
|
-
* Enable the auth MCP tools. This allows Admins to enable or disable the auth capabilities.
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
enabled: boolean;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* **Experimental** -- Collection MCP tools allow for the creation, modification, and deletion of Payload collections. This is for developing ideas that help Developers with collection tasks.
|
|
62
|
-
*/
|
|
63
|
-
collections?: {
|
|
64
|
-
/**
|
|
65
|
-
* Set the directory path to the collections directory. This can be a directory outside of your default directory, or another Payload project.
|
|
66
|
-
*/
|
|
67
|
-
collectionsDirPath: string;
|
|
68
|
-
/**
|
|
69
|
-
* Enable the collection MCP tools. This allows Admins to enable or disable the Collection modification capabilities.
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
enabled: boolean;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* **Experimental** -- Config MCP tools allow for the modification of a Payload Config. This is for developing ideas that help Developers with config tasks.
|
|
76
|
-
*/
|
|
77
|
-
config?: {
|
|
78
|
-
/**
|
|
79
|
-
* Set the directory path to the config directory. This can be a directory outside of your default directory, or another Payload project.
|
|
80
|
-
*/
|
|
81
|
-
configFilePath: string;
|
|
82
|
-
/**
|
|
83
|
-
* Enable the config MCP tools. This allows Admins to enable or disable the Payload Config modification capabilities.
|
|
84
|
-
* @default false
|
|
85
|
-
*/
|
|
86
|
-
enabled: boolean;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* **Experimental** -- Jobs MCP tools allow for the modification of Payload jobs. This is for developing ideas that help Developers with job tasks.
|
|
90
|
-
*/
|
|
91
|
-
jobs?: {
|
|
92
|
-
/**
|
|
93
|
-
* Enable the jobs MCP tools. This allows Admins to enable or disable the Job modification capabilities.
|
|
94
|
-
* @default false
|
|
95
|
-
*/
|
|
96
|
-
enabled: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Set the directory path to the jobs directory. This can be a directory outside of your default directory, or another Payload project.
|
|
99
|
-
*/
|
|
100
|
-
jobsDirPath: string;
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
};
|
|
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
|
-
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
|
-
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
|
-
}[];
|
|
262
|
-
};
|
|
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
|
-
overrideApiKeyCollection?: (collection: CollectionConfig) => CollectionConfig;
|
|
270
|
-
/**
|
|
271
|
-
* Override the authentication method.
|
|
272
|
-
* This allows you to use a custom authentication method instead of the default API key authentication.
|
|
273
|
-
* @param req - The request object.
|
|
274
|
-
* @returns The MCP access settings.
|
|
275
|
-
*/
|
|
276
|
-
overrideAuth?: (req: PayloadRequest, getDefaultMcpAccessSettings: (overrideApiKey?: null | string) => Promise<MCPAccessSettings>) => MCPAccessSettings | Promise<MCPAccessSettings>;
|
|
277
|
-
/**
|
|
278
|
-
* Set the users collection that API keys should be associated with.
|
|
279
|
-
*/
|
|
280
|
-
userCollection?: CollectionSlug;
|
|
281
|
-
};
|
|
1
|
+
import type { CallToolResult, ContentBlock, JsonSchemaType, McpServer, ResourceTemplate, ServerContext, StandardSchemaWithJSON, ToolAnnotations } from '@modelcontextprotocol/server';
|
|
2
|
+
import type { AuthCollectionSlug, CollectionSlug, GlobalSlug, MaybePromise, PayloadRequest, SanitizedPermissions, TypedUser } from 'payload';
|
|
3
|
+
import type { GetAuthorizedMCPArgs } from './endpoint/access.js';
|
|
4
|
+
import type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName } from './mcp/builtinTools.js';
|
|
5
|
+
export type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName };
|
|
6
|
+
/** Re-exported from `@modelcontextprotocol/server` — common MCP types used in plugin config. */
|
|
7
|
+
export type { JsonSchemaType, StandardSchemaWithJSON, ToolAnnotations };
|
|
282
8
|
/**
|
|
283
|
-
*
|
|
9
|
+
* What a tool's `input` (or a prompt's `argsSchema`) can be — either a raw
|
|
10
|
+
* JSON Schema literal, or a Standard Schema instance (Zod, Valibot, …).
|
|
284
11
|
*/
|
|
285
|
-
export type
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
* @default /api
|
|
289
|
-
*/
|
|
290
|
-
basePath?: string;
|
|
12
|
+
export type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON;
|
|
13
|
+
export type MCPToolResponse = {
|
|
14
|
+
content: ContentBlock[];
|
|
291
15
|
/**
|
|
292
|
-
* If
|
|
293
|
-
*
|
|
16
|
+
* If available, return the document fetched within the
|
|
17
|
+
* mcp tool. This is threaded as an additional argument to
|
|
18
|
+
* overrideResponse functions and stripped before going on the wire.
|
|
294
19
|
*/
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
20
|
+
doc?: Record<string, unknown>;
|
|
21
|
+
} & Pick<CallToolResult, '_meta' | 'isError' | 'structuredContent'>;
|
|
22
|
+
export type MCPResponseOverride = (response: MCPToolResponse, doc: Record<string, unknown>, req: PayloadRequest) => MCPToolResponse;
|
|
23
|
+
/**
|
|
24
|
+
* The handler's `input` type. A specific Standard Schema (Zod, Valibot, …) gets
|
|
25
|
+
* its inferred output; anything else falls back to `Record<string, unknown>`.
|
|
26
|
+
*/
|
|
27
|
+
export type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON ? StandardSchemaWithJSON extends TSchema ? Record<string, unknown> : StandardSchemaWithJSON.InferOutput<TSchema> : Record<string, unknown>;
|
|
28
|
+
export type MCPAccessArgs = {
|
|
29
|
+
permissions?: SanitizedPermissions;
|
|
30
|
+
req: PayloadRequest;
|
|
31
|
+
};
|
|
32
|
+
export type CollectionMCPAccessArgs = {
|
|
33
|
+
collectionSlug: CollectionSlug;
|
|
34
|
+
} & MCPAccessArgs;
|
|
35
|
+
export type GlobalMCPAccessArgs = {
|
|
36
|
+
globalSlug: GlobalSlug;
|
|
37
|
+
} & MCPAccessArgs;
|
|
38
|
+
export type ToolHandlerArgs<TSchema = undefined> = {
|
|
39
|
+
authorizedMCP: AuthorizedMCP;
|
|
40
|
+
input: TypedInput<TSchema>;
|
|
41
|
+
req: PayloadRequest;
|
|
42
|
+
serverContext: ServerContext;
|
|
43
|
+
};
|
|
44
|
+
export type CollectionToolHandlerArgs<TSchema = undefined> = {
|
|
45
|
+
collectionSlug: CollectionSlug;
|
|
46
|
+
} & ToolHandlerArgs<TSchema>;
|
|
47
|
+
export type GlobalToolHandlerArgs<TSchema = undefined> = {
|
|
48
|
+
globalSlug: GlobalSlug;
|
|
49
|
+
} & ToolHandlerArgs<TSchema>;
|
|
50
|
+
export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
51
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
52
|
+
annotations?: ToolAnnotations;
|
|
53
|
+
description: string;
|
|
54
|
+
handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
55
|
+
input?: TSchema;
|
|
56
|
+
/**
|
|
57
|
+
* Override the return value of the tool handler
|
|
58
|
+
*/
|
|
59
|
+
overrideResponse?: MCPResponseOverride;
|
|
316
60
|
};
|
|
61
|
+
export type CollectionTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
62
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>;
|
|
63
|
+
handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
64
|
+
input?: TSchema;
|
|
65
|
+
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>;
|
|
66
|
+
export type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
67
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>;
|
|
68
|
+
handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
69
|
+
input?: TSchema;
|
|
70
|
+
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>;
|
|
317
71
|
/**
|
|
318
|
-
*
|
|
72
|
+
* Configures (or disables) a built-in tool without replacing it.
|
|
73
|
+
* `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a
|
|
74
|
+
* required handler) from being silently accepted at a built-in key slot.
|
|
319
75
|
*/
|
|
320
|
-
export type
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
-
};
|
|
76
|
+
export type MCPBuiltInCollectionToolOverride = {
|
|
77
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>;
|
|
78
|
+
annotations?: ToolAnnotations;
|
|
79
|
+
description?: string;
|
|
80
|
+
handler?: never;
|
|
81
|
+
overrideResponse?: MCPResponseOverride;
|
|
340
82
|
};
|
|
341
|
-
export type
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
forgotPassword?: boolean;
|
|
345
|
-
login?: boolean;
|
|
346
|
-
resetPassword?: boolean;
|
|
347
|
-
unlock?: boolean;
|
|
348
|
-
verify?: boolean;
|
|
349
|
-
};
|
|
350
|
-
collections?: {
|
|
351
|
-
create?: boolean;
|
|
352
|
-
delete?: boolean;
|
|
353
|
-
find?: boolean;
|
|
354
|
-
update?: boolean;
|
|
355
|
-
};
|
|
356
|
-
config?: {
|
|
357
|
-
find?: boolean;
|
|
358
|
-
update?: boolean;
|
|
359
|
-
};
|
|
360
|
-
custom?: Record<string, boolean>;
|
|
361
|
-
globals?: {
|
|
362
|
-
find?: boolean;
|
|
363
|
-
update?: boolean;
|
|
364
|
-
};
|
|
365
|
-
jobs?: {
|
|
366
|
-
create?: boolean;
|
|
367
|
-
run?: boolean;
|
|
368
|
-
update?: boolean;
|
|
369
|
-
};
|
|
370
|
-
'payload-mcp-prompt'?: Record<string, boolean>;
|
|
371
|
-
'payload-mcp-resource'?: Record<string, boolean>;
|
|
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 = {
|
|
83
|
+
export type MCPBuiltInGlobalToolOverride = {
|
|
84
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>;
|
|
85
|
+
annotations?: ToolAnnotations;
|
|
377
86
|
description?: string;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
label: string;
|
|
381
|
-
value: string;
|
|
382
|
-
}[];
|
|
383
|
-
position?: 'main' | 'sidebar';
|
|
384
|
-
required?: boolean;
|
|
385
|
-
type: string;
|
|
87
|
+
handler?: never;
|
|
88
|
+
overrideResponse?: MCPResponseOverride;
|
|
386
89
|
};
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
};
|
|
398
|
-
fieldName: string;
|
|
90
|
+
/**
|
|
91
|
+
* Value at a custom (non-built-in) tool key. Either the tool itself, or `false`
|
|
92
|
+
* to disable it (useful when one plugin defines a custom tool and another
|
|
93
|
+
* wants to opt out per-collection).
|
|
94
|
+
*/
|
|
95
|
+
export type MCPTopLevelToolEntry = Tool;
|
|
96
|
+
export type MCPCollectionToolsMap = {
|
|
97
|
+
[customToolName: string]: boolean | CollectionTool | MCPBuiltInCollectionToolOverride | undefined;
|
|
98
|
+
} & {
|
|
99
|
+
[K in MCPCollectionBuiltinName]?: false | MCPBuiltInCollectionToolOverride;
|
|
399
100
|
};
|
|
400
|
-
export type
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
101
|
+
export type MCPAuthCollectionToolsMap = {
|
|
102
|
+
[K in MCPCollectionAuthToolName]?: MCPBuiltInCollectionToolOverride | true;
|
|
103
|
+
} & MCPCollectionToolsMap;
|
|
104
|
+
/** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */
|
|
105
|
+
export type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends AuthCollectionSlug ? MCPAuthCollectionToolsMap : MCPCollectionToolsMap;
|
|
106
|
+
export type MCPGlobalToolsMap = {
|
|
107
|
+
[customToolName: string]: boolean | GlobalTool | MCPBuiltInGlobalToolOverride | undefined;
|
|
108
|
+
} & {
|
|
109
|
+
[K in MCPGlobalBuiltinName]?: false | MCPBuiltInGlobalToolOverride;
|
|
110
|
+
};
|
|
111
|
+
export type MCPTopLevelToolsMap = Record<string, Tool>;
|
|
112
|
+
export type PromptHandlerArgs<TSchema = undefined> = {
|
|
113
|
+
input: TypedInput<TSchema>;
|
|
114
|
+
req: PayloadRequest;
|
|
115
|
+
serverContext: ServerContext;
|
|
411
116
|
};
|
|
412
|
-
export type
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
117
|
+
export type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {
|
|
118
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
119
|
+
argsSchema: TSchema;
|
|
120
|
+
description: string;
|
|
121
|
+
handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{
|
|
122
|
+
messages: Array<{
|
|
123
|
+
content: {
|
|
124
|
+
text: string;
|
|
125
|
+
type: 'text';
|
|
126
|
+
};
|
|
127
|
+
role: 'assistant' | 'user';
|
|
423
128
|
}>;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
129
|
+
}>;
|
|
130
|
+
title: string;
|
|
131
|
+
};
|
|
132
|
+
export type ResourceHandlerArgs = {
|
|
133
|
+
/** Variables extracted from a `ResourceTemplate` URI. Empty for static-URI resources. */
|
|
134
|
+
params: Record<string, string>;
|
|
135
|
+
req: PayloadRequest;
|
|
136
|
+
serverContext: ServerContext;
|
|
137
|
+
uri: URL;
|
|
432
138
|
};
|
|
433
|
-
export type
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
139
|
+
export type Resource = {
|
|
140
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
141
|
+
description: string;
|
|
142
|
+
handler: (args: ResourceHandlerArgs) => MaybePromise<{
|
|
143
|
+
contents: Array<{
|
|
144
|
+
text: string;
|
|
145
|
+
uri: string;
|
|
146
|
+
}>;
|
|
147
|
+
}>;
|
|
148
|
+
mimeType: string;
|
|
149
|
+
title: string;
|
|
150
|
+
uri: ResourceTemplate | string;
|
|
151
|
+
};
|
|
152
|
+
export type MCPPluginCollectionConfig<TSlug extends CollectionSlug> = {
|
|
153
|
+
description?: string;
|
|
154
|
+
/** Fallback for built-in tools that don't set their own `overrideResponse`. */
|
|
155
|
+
overrideResponse?: MCPResponseOverride;
|
|
156
|
+
tools?: MCPToolsMapForCollection<TSlug>;
|
|
437
157
|
};
|
|
438
|
-
export type
|
|
439
|
-
|
|
440
|
-
|
|
158
|
+
export type MCPPluginGlobalConfig = {
|
|
159
|
+
description?: string;
|
|
160
|
+
overrideResponse?: MCPResponseOverride;
|
|
161
|
+
tools?: MCPGlobalToolsMap;
|
|
441
162
|
};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
163
|
+
/**
|
|
164
|
+
* The user-facing config shape passed to `mcpPlugin({ ... })`. Tools, prompts,
|
|
165
|
+
* resources, and per-collection/global tool maps live in their own nested
|
|
166
|
+
* fields. `sanitizeMCPConfig` flattens those into `items` and applies defaults
|
|
167
|
+
* to produce a `SanitizedMCPPluginConfig` — the form every internal consumer
|
|
168
|
+
* actually works with.
|
|
169
|
+
*/
|
|
170
|
+
export type MCPPluginConfig = {
|
|
171
|
+
collections?: {
|
|
172
|
+
[Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>;
|
|
449
173
|
};
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
174
|
+
/** Skip MCP endpoint registration. */
|
|
175
|
+
disabled?: boolean;
|
|
176
|
+
globals?: {
|
|
177
|
+
[Slug in GlobalSlug]?: MCPPluginGlobalConfig;
|
|
454
178
|
};
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
declare?: boolean;
|
|
459
|
-
outputFile?: string;
|
|
179
|
+
mcp?: {
|
|
180
|
+
serverOptions?: MCPServerOptions;
|
|
181
|
+
verboseLogs?: boolean;
|
|
460
182
|
};
|
|
183
|
+
/** Replace the default MCP authorization resolver. */
|
|
184
|
+
overrideGetAuthorizedMCP?: (args: {
|
|
185
|
+
pluginConfig: SanitizedMCPPluginConfig;
|
|
186
|
+
} & GetAuthorizedMCPArgs) => MaybePromise<AuthorizedMCP>;
|
|
187
|
+
prompts?: Record<string, Prompt>;
|
|
188
|
+
resources?: Record<string, Resource>;
|
|
189
|
+
/** Cross-cutting tools (not scoped to any collection or global). */
|
|
190
|
+
tools?: MCPTopLevelToolsMap;
|
|
191
|
+
};
|
|
192
|
+
export type SanitizedMCPPluginConfig = {
|
|
193
|
+
items: MCPItem[];
|
|
194
|
+
} & Pick<MCPPluginConfig, 'disabled' | 'mcp' | 'overrideGetAuthorizedMCP'>;
|
|
195
|
+
export type MCPServerOptions = {
|
|
196
|
+
options?: ConstructorParameters<typeof McpServer>[1];
|
|
197
|
+
serverInfo?: Partial<ConstructorParameters<typeof McpServer>[0]>;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* One MCP primitive plus the metadata needed for config-driven filtering and
|
|
201
|
+
* registration.
|
|
202
|
+
*
|
|
203
|
+
* - `configKey`: the config identifier, e.g. `find` or `echo`.
|
|
204
|
+
* - `mcpName`: the MCP wire name, e.g. `findDocuments` or `echo`.
|
|
205
|
+
* - `label`: human-readable display text.
|
|
206
|
+
*/
|
|
207
|
+
export type MCPItemBase = {
|
|
208
|
+
configKey: string;
|
|
209
|
+
label: string;
|
|
210
|
+
mcpName: string;
|
|
211
|
+
};
|
|
212
|
+
export type CollectionMCPItem = {
|
|
213
|
+
collectionSlug: CollectionSlug;
|
|
214
|
+
tool: CollectionTool;
|
|
215
|
+
type: 'collectionTool';
|
|
216
|
+
} & MCPItemBase;
|
|
217
|
+
export type GlobalMCPItem = {
|
|
218
|
+
globalSlug: GlobalSlug;
|
|
219
|
+
tool: GlobalTool;
|
|
220
|
+
type: 'globalTool';
|
|
221
|
+
} & MCPItemBase;
|
|
222
|
+
export type MCPItem = ({
|
|
223
|
+
prompt: Prompt;
|
|
224
|
+
type: 'prompt';
|
|
225
|
+
} & MCPItemBase) | ({
|
|
226
|
+
resource: Resource;
|
|
227
|
+
type: 'resource';
|
|
228
|
+
} & MCPItemBase) | ({
|
|
229
|
+
tool: Tool;
|
|
230
|
+
type: 'tool';
|
|
231
|
+
} & MCPItemBase) | CollectionMCPItem | GlobalMCPItem;
|
|
232
|
+
/**
|
|
233
|
+
* The caller's identity + the MCP items authorized for this request. Disabled
|
|
234
|
+
* items and items blocked by access callbacks or Payload operation access are
|
|
235
|
+
* absent from `items`. Tool handlers receive this via `args.authorizedMCP` so
|
|
236
|
+
* they can spread `localAPIDefaults(authorizedMCP)` into every local API call.
|
|
237
|
+
*/
|
|
238
|
+
export type AuthorizedMCP = {
|
|
239
|
+
items: MCPItem[];
|
|
240
|
+
overrideAccess: boolean;
|
|
241
|
+
user: null | TypedUser;
|
|
461
242
|
};
|
|
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
243
|
//# sourceMappingURL=types.d.ts.map
|