@payloadcms/plugin-mcp 4.0.0-internal.5b1e7cd → 4.0.0-internal.5d2e3d1
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/LICENSE.md +1 -1
- package/bin.js +39 -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 +130 -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 +141 -0
- package/dist/endpoint/index.js.map +1 -0
- package/dist/endpoint/oauth.d.ts +37 -0
- package/dist/endpoint/oauth.d.ts.map +1 -0
- package/dist/endpoint/oauth.js +105 -0
- package/dist/endpoint/oauth.js.map +1 -0
- package/dist/endpoint/oauthLoginToken.d.ts +23 -0
- package/dist/endpoint/oauthLoginToken.d.ts.map +1 -0
- package/dist/endpoint/oauthLoginToken.js +80 -0
- package/dist/endpoint/oauthLoginToken.js.map +1 -0
- package/dist/endpoint/oauthServer.d.ts +28 -0
- package/dist/endpoint/oauthServer.d.ts.map +1 -0
- package/dist/endpoint/oauthServer.js +423 -0
- package/dist/endpoint/oauthServer.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/exports/rsc.d.ts +2 -0
- package/dist/exports/rsc.d.ts.map +1 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/index.d.ts +14 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -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 +235 -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 +312 -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 +63 -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 +60 -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 +137 -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 +113 -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 +90 -0
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts +28 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.js +88 -0
- package/dist/mcp/builtin/collections/fileInput.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 +77 -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 +146 -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 +74 -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 +84 -0
- package/dist/mcp/builtin/collections/findVersionsTool.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 +103 -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 +69 -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 +172 -0
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js +55 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -0
- package/dist/mcp/builtin/formatEntityError.d.ts +16 -0
- package/dist/mcp/builtin/formatEntityError.d.ts.map +1 -0
- package/dist/mcp/builtin/formatEntityError.js +55 -0
- package/dist/mcp/builtin/formatEntityError.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 +69 -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 +60 -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 +67 -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 +68 -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 +78 -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 +81 -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 +70 -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 +78 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +168 -0
- package/dist/mcp/builtinTools.d.ts.map +1 -0
- package/dist/mcp/builtinTools.js +169 -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 +236 -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 +128 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +352 -441
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.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/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/seal.d.ts +17 -0
- package/dist/utils/seal.d.ts.map +1 -0
- package/dist/utils/seal.js +24 -0
- package/dist/utils/seal.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/views/Authorize/AllowButtons/index.d.ts +18 -0
- package/dist/views/Authorize/AllowButtons/index.d.ts.map +1 -0
- package/dist/views/Authorize/AllowButtons/index.js +88 -0
- package/dist/views/Authorize/AllowButtons/index.js.map +1 -0
- package/dist/views/Authorize/index.css +19 -0
- package/dist/views/Authorize/index.d.ts +9 -0
- package/dist/views/Authorize/index.d.ts.map +1 -0
- package/dist/views/Authorize/index.js +86 -0
- package/dist/views/Authorize/index.js.map +1 -0
- package/package.json +48 -26
- package/src/defaultAccess.ts +3 -0
- package/src/defineTool.ts +44 -0
- package/src/endpoint/access.ts +153 -0
- package/src/endpoint/index.ts +123 -0
- package/src/endpoint/oauth.ts +108 -0
- package/src/endpoint/oauthLoginToken.ts +94 -0
- package/src/endpoint/oauthServer.ts +452 -0
- package/src/exports/client.ts +3 -0
- package/src/exports/internal.ts +1 -0
- package/src/exports/rsc.ts +1 -0
- package/src/index.ts +74 -88
- package/src/mcp/buildMcpServer.ts +294 -0
- package/src/mcp/builtin/collections/authTools.ts +280 -0
- package/src/mcp/builtin/collections/countTool.ts +61 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +60 -0
- package/src/mcp/builtin/collections/createTool.ts +143 -0
- package/src/mcp/builtin/collections/deleteTool.ts +99 -0
- package/src/mcp/builtin/collections/duplicateTool.ts +84 -0
- package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
- package/src/mcp/builtin/collections/fileInput.ts +127 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +67 -0
- package/src/mcp/builtin/collections/findTool.ts +134 -0
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +66 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +83 -0
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +91 -0
- package/src/mcp/builtin/collections/restoreVersionTool.ts +65 -0
- package/src/mcp/builtin/collections/updateTool.ts +173 -0
- package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
- package/src/mcp/builtin/formatEntityError.ts +77 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +68 -0
- package/src/mcp/builtin/globals/countVersionsTool.ts +60 -0
- package/src/mcp/builtin/globals/findTool.ts +66 -0
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +64 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +69 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +73 -0
- package/src/mcp/builtin/globals/restoreVersionTool.ts +68 -0
- package/src/mcp/builtin/globals/updateTool.ts +92 -0
- package/src/mcp/builtinTools.ts +161 -0
- package/src/mcp/sanitizeMCPConfig.ts +282 -0
- package/src/stdio.ts +131 -0
- package/src/types.ts +401 -481
- package/src/utils/getLogger.ts +22 -0
- package/src/utils/getPluginConfig.ts +24 -0
- package/src/utils/resolveProjectRoot.ts +17 -0
- package/src/utils/seal.ts +46 -0
- package/src/utils/toStandardSchema.ts +9 -0
- package/src/views/Authorize/AllowButtons/index.tsx +97 -0
- package/src/views/Authorize/index.css +19 -0
- package/src/views/Authorize/index.tsx +93 -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/getVirtualFieldNames.d.ts +0 -14
- package/dist/utils/getVirtualFieldNames.d.ts.map +0 -1
- package/dist/utils/getVirtualFieldNames.js +0 -35
- package/dist/utils/getVirtualFieldNames.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/dist/utils/transformPointDataToPayload.d.ts +0 -7
- package/dist/utils/transformPointDataToPayload.d.ts.map +0 -1
- package/dist/utils/transformPointDataToPayload.js +0 -28
- package/dist/utils/transformPointDataToPayload.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/getVirtualFieldNames.ts +0 -53
- 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/src/utils/transformPointDataToPayload.ts +0 -40
package/dist/types.d.ts
CHANGED
|
@@ -1,482 +1,393 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import type { CallToolResult, ContentBlock, Implementation, JsonSchemaType, McpServerOptions, ResourceTemplate, ServerContext, StandardSchemaWithJSON, ToolAnnotations } from '@modelcontextprotocol/server';
|
|
2
|
+
import type { AuthCollectionSlug, CollectionSlug, GlobalSlug, MaybePromise, PayloadRequest, SanitizedPermissions } 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 };
|
|
8
|
+
/**
|
|
9
|
+
* What a tool's `input` (or a prompt's `argsSchema`) can be — either a raw
|
|
10
|
+
* JSON Schema 2020-12 literal, or a Standard Schema instance (Zod, Valibot, …).
|
|
11
|
+
* Raw schemas may omit `$schema`; when present it must declare the 2020-12 dialect.
|
|
12
|
+
*/
|
|
13
|
+
export type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON;
|
|
14
|
+
export type MCPToolResponse = {
|
|
15
|
+
content: ContentBlock[];
|
|
5
16
|
/**
|
|
6
|
-
*
|
|
17
|
+
* If available, return the document fetched within the
|
|
18
|
+
* mcp tool. This is threaded as an additional argument to
|
|
19
|
+
* overrideResponse functions and stripped before going on the wire.
|
|
7
20
|
*/
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
doc?: Record<string, unknown>;
|
|
22
|
+
} & Pick<CallToolResult, '_meta' | 'isError' | 'structuredContent'>;
|
|
23
|
+
export type MCPResponseOverride = (response: MCPToolResponse, doc: Record<string, unknown>, req: PayloadRequest) => MCPToolResponse;
|
|
24
|
+
export type MCPAfterToolCallHook = (args: {
|
|
25
|
+
input: unknown;
|
|
26
|
+
req: PayloadRequest;
|
|
27
|
+
response: MCPToolResponse;
|
|
28
|
+
toolName: string;
|
|
29
|
+
}) => MaybePromise<MCPToolResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* The handler's `input` type. A specific Standard Schema (Zod, Valibot, …) gets
|
|
32
|
+
* its inferred output; anything else falls back to `Record<string, unknown>`.
|
|
33
|
+
*/
|
|
34
|
+
export type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON ? StandardSchemaWithJSON extends TSchema ? Record<string, unknown> : StandardSchemaWithJSON.InferOutput<TSchema> : Record<string, unknown>;
|
|
35
|
+
export type MCPAccessArgs = {
|
|
36
|
+
permissions?: SanitizedPermissions;
|
|
37
|
+
req: PayloadRequest;
|
|
38
|
+
};
|
|
39
|
+
export type CollectionMCPAccessArgs = {
|
|
40
|
+
slug: CollectionSlug;
|
|
41
|
+
} & MCPAccessArgs;
|
|
42
|
+
export type GlobalMCPAccessArgs = {
|
|
43
|
+
slug: GlobalSlug;
|
|
44
|
+
} & MCPAccessArgs;
|
|
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
|
+
slug: CollectionSlug;
|
|
53
|
+
} & ToolHandlerArgs<TSchema>;
|
|
54
|
+
export type GlobalToolHandlerArgs<TSchema = undefined> = {
|
|
55
|
+
slug: GlobalSlug;
|
|
56
|
+
} & ToolHandlerArgs<TSchema>;
|
|
57
|
+
export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
37
58
|
/**
|
|
38
|
-
*
|
|
59
|
+
* Runs while authorizing each MCP request, before the tool is advertised or called. Return
|
|
60
|
+
* `false` to make the tool unavailable for that request. This is skipped when `overrideAccess`
|
|
61
|
+
* is enabled.
|
|
39
62
|
*/
|
|
40
|
-
|
|
63
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
64
|
+
annotations?: ToolAnnotations;
|
|
65
|
+
description: string;
|
|
66
|
+
handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
67
|
+
input?: TSchema;
|
|
41
68
|
/**
|
|
42
|
-
*
|
|
43
|
-
* **These features are for experimental purposes -- They are Disabled in Production by Default**
|
|
69
|
+
* Override the return value of the tool handler
|
|
44
70
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
};
|
|
71
|
+
overrideResponse?: MCPResponseOverride;
|
|
72
|
+
};
|
|
73
|
+
export type CollectionTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
104
74
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
75
|
+
* Runs while authorizing each MCP request for this collection. Return `false` to reject calls
|
|
76
|
+
* to this tool for the collection. The shared tool is not advertised when no collections allow
|
|
77
|
+
* it, but can remain advertised when it is available for another collection. This is skipped
|
|
78
|
+
* when `overrideAccess` is enabled.
|
|
108
79
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
80
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>;
|
|
81
|
+
handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
82
|
+
input?: TSchema;
|
|
83
|
+
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>;
|
|
84
|
+
export type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
85
|
+
/**
|
|
86
|
+
* Runs while authorizing each MCP request for this global. Return `false` to reject calls to
|
|
87
|
+
* this tool for the global. The shared tool is not advertised when no globals allow it, but
|
|
88
|
+
* can remain advertised when it is available for another global. This is skipped when
|
|
89
|
+
* `overrideAccess` is enabled.
|
|
90
|
+
*/
|
|
91
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>;
|
|
92
|
+
handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
93
|
+
input?: TSchema;
|
|
94
|
+
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>;
|
|
95
|
+
/**
|
|
96
|
+
* Configures (or disables) a built-in tool without replacing it.
|
|
97
|
+
* `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a
|
|
98
|
+
* required handler) from being silently accepted at a built-in key slot.
|
|
99
|
+
*/
|
|
100
|
+
export type MCPBuiltInCollectionToolOverride = {
|
|
101
|
+
/**
|
|
102
|
+
* Replaces the built-in tool's access check. Return `false` to make the tool unavailable for
|
|
103
|
+
* this collection. This is skipped when `overrideAccess` is enabled.
|
|
104
|
+
*/
|
|
105
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>;
|
|
106
|
+
annotations?: ToolAnnotations;
|
|
107
|
+
description?: string;
|
|
108
|
+
handler?: never;
|
|
109
|
+
overrideResponse?: MCPResponseOverride;
|
|
110
|
+
};
|
|
111
|
+
export type MCPBuiltInGlobalToolOverride = {
|
|
112
|
+
/**
|
|
113
|
+
* Replaces the built-in tool's access check. Return `false` to make the tool unavailable for
|
|
114
|
+
* this global. This is skipped when `overrideAccess` is enabled.
|
|
115
|
+
*/
|
|
116
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>;
|
|
117
|
+
annotations?: ToolAnnotations;
|
|
118
|
+
description?: string;
|
|
119
|
+
handler?: never;
|
|
120
|
+
overrideResponse?: MCPResponseOverride;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Value at a custom (non-built-in) tool key. Either the tool itself, or `false`
|
|
124
|
+
* to disable it (useful when one plugin defines a custom tool and another
|
|
125
|
+
* wants to opt out per-collection).
|
|
126
|
+
*/
|
|
127
|
+
export type MCPTopLevelToolEntry = Tool;
|
|
128
|
+
export type MCPCollectionToolsMap = {
|
|
129
|
+
[customToolName: string]: boolean | CollectionTool | MCPBuiltInCollectionToolOverride | undefined;
|
|
130
|
+
} & {
|
|
131
|
+
[K in MCPCollectionBuiltinName]?: false | MCPBuiltInCollectionToolOverride;
|
|
132
|
+
};
|
|
133
|
+
export type MCPAuthCollectionToolsMap = {
|
|
134
|
+
[K in MCPCollectionAuthToolName]?: MCPBuiltInCollectionToolOverride | true;
|
|
135
|
+
} & MCPCollectionToolsMap;
|
|
136
|
+
/** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */
|
|
137
|
+
export type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends AuthCollectionSlug ? MCPAuthCollectionToolsMap : MCPCollectionToolsMap;
|
|
138
|
+
export type MCPGlobalToolsMap = {
|
|
139
|
+
[customToolName: string]: boolean | GlobalTool | MCPBuiltInGlobalToolOverride | undefined;
|
|
140
|
+
} & {
|
|
141
|
+
[K in MCPGlobalBuiltinName]?: false | MCPBuiltInGlobalToolOverride;
|
|
142
|
+
};
|
|
143
|
+
export type MCPTopLevelToolsMap = Record<string, Tool>;
|
|
144
|
+
export type PromptHandlerArgs<TSchema = undefined> = {
|
|
145
|
+
input: TypedInput<TSchema>;
|
|
146
|
+
req: PayloadRequest;
|
|
147
|
+
serverContext: ServerContext;
|
|
148
|
+
};
|
|
149
|
+
export type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {
|
|
150
|
+
/**
|
|
151
|
+
* Runs while authorizing each MCP request, before the prompt is advertised or used. Return
|
|
152
|
+
* `false` to make the prompt unavailable for that request. This is skipped when
|
|
153
|
+
* `overrideAccess` is enabled.
|
|
154
|
+
*/
|
|
155
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
156
|
+
argsSchema: TSchema;
|
|
157
|
+
description: string;
|
|
158
|
+
handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{
|
|
159
|
+
messages: Array<{
|
|
160
|
+
content: {
|
|
132
161
|
text: string;
|
|
133
|
-
type:
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
162
|
+
type: 'text';
|
|
163
|
+
};
|
|
164
|
+
role: 'assistant' | 'user';
|
|
165
|
+
}>;
|
|
166
|
+
}>;
|
|
167
|
+
title: string;
|
|
168
|
+
};
|
|
169
|
+
export type ResourceHandlerArgs = {
|
|
170
|
+
/** Variables extracted from a `ResourceTemplate` URI. Empty for static-URI resources. */
|
|
171
|
+
params: Record<string, string>;
|
|
172
|
+
req: PayloadRequest;
|
|
173
|
+
serverContext: ServerContext;
|
|
174
|
+
uri: URL;
|
|
175
|
+
};
|
|
176
|
+
export type Resource = {
|
|
137
177
|
/**
|
|
138
|
-
* MCP
|
|
178
|
+
* Runs while authorizing each MCP request, before the resource is advertised or read. Return
|
|
179
|
+
* `false` to make the resource unavailable for that request. This is skipped when
|
|
180
|
+
* `overrideAccess` is enabled.
|
|
139
181
|
*/
|
|
182
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
183
|
+
description: string;
|
|
184
|
+
handler: (args: ResourceHandlerArgs) => MaybePromise<{
|
|
185
|
+
contents: Array<{
|
|
186
|
+
text: string;
|
|
187
|
+
uri: string;
|
|
188
|
+
}>;
|
|
189
|
+
}>;
|
|
190
|
+
mimeType: string;
|
|
191
|
+
title: string;
|
|
192
|
+
uri: ResourceTemplate | string;
|
|
193
|
+
};
|
|
194
|
+
export type MCPPluginCollectionConfig<TSlug extends CollectionSlug> = {
|
|
195
|
+
description?: string;
|
|
196
|
+
/** Fallback for built-in tools that don't set their own `overrideResponse`. */
|
|
197
|
+
overrideResponse?: MCPResponseOverride;
|
|
198
|
+
tools?: MCPToolsMapForCollection<TSlug>;
|
|
199
|
+
};
|
|
200
|
+
export type MCPPluginGlobalConfig = {
|
|
201
|
+
description?: string;
|
|
202
|
+
overrideResponse?: MCPResponseOverride;
|
|
203
|
+
tools?: MCPGlobalToolsMap;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* The user-facing config shape passed to `mcpPlugin({ ... })`. Tools, prompts,
|
|
207
|
+
* resources, and per-collection/global tool maps live in their own nested
|
|
208
|
+
* fields. `sanitizeMCPConfig` flattens those into `items` and applies defaults
|
|
209
|
+
* to produce a `SanitizedMCPPluginConfig` — the form every internal consumer
|
|
210
|
+
* actually works with.
|
|
211
|
+
*/
|
|
212
|
+
export type MCPPluginConfig = {
|
|
213
|
+
collections?: {
|
|
214
|
+
[Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>;
|
|
215
|
+
};
|
|
216
|
+
/** Skip MCP endpoint registration. */
|
|
217
|
+
disabled?: boolean;
|
|
218
|
+
globals?: {
|
|
219
|
+
[Slug in GlobalSlug]?: MCPPluginGlobalConfig;
|
|
220
|
+
};
|
|
221
|
+
hooks?: {
|
|
222
|
+
/** Transform a tool response after its handler returns */
|
|
223
|
+
afterToolCall?: MCPAfterToolCallHook[];
|
|
224
|
+
};
|
|
140
225
|
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
226
|
/**
|
|
184
|
-
*
|
|
227
|
+
* Largest HTTP request body, in bytes, that the MCP endpoint accepts. Larger requests
|
|
228
|
+
* are answered with `413`. Base64 file uploads count toward this limit.
|
|
229
|
+
*
|
|
230
|
+
* @default 4194304 (4 MiB, the MCP SDK default)
|
|
185
231
|
*/
|
|
186
|
-
|
|
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
|
-
}[];
|
|
232
|
+
maxRequestBodySize?: number;
|
|
228
233
|
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
|
-
}[];
|
|
234
|
+
verboseLogs?: boolean;
|
|
262
235
|
};
|
|
263
236
|
/**
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
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.
|
|
237
|
+
* How MCP clients sign in. MCP requests without an authenticated user get a `401` that points
|
|
238
|
+
* to the protected resource metadata (RFC 9728). Set to `false` to only accept API keys and
|
|
239
|
+
* anonymous requests.
|
|
240
|
+
*
|
|
241
|
+
* @default { type: 'builtin' }
|
|
275
242
|
*/
|
|
276
|
-
|
|
243
|
+
oauth?: false | MCPOAuthConfig;
|
|
277
244
|
/**
|
|
278
|
-
*
|
|
245
|
+
* Replace the default MCP authorization resolver.
|
|
246
|
+
*
|
|
247
|
+
* This hook replaces the default authentication flow. It must set `req.user` to the
|
|
248
|
+
* authenticated Payload user, or to `null` for an anonymous caller, before returning.
|
|
279
249
|
*/
|
|
280
|
-
|
|
250
|
+
overrideGetAuthorizedMCP?: (args: {
|
|
251
|
+
pluginConfig: SanitizedMCPPluginConfig;
|
|
252
|
+
} & GetAuthorizedMCPArgs) => MaybePromise<AuthorizedMCP>;
|
|
253
|
+
prompts?: Record<string, Prompt>;
|
|
254
|
+
resources?: Record<string, Resource>;
|
|
255
|
+
/** Cross-cutting tools (not scoped to any collection or global). */
|
|
256
|
+
tools?: MCPTopLevelToolsMap;
|
|
281
257
|
};
|
|
258
|
+
export type MCPOAuthConfig = MCPBuiltinOAuthConfig | MCPExternalOAuthConfig;
|
|
282
259
|
/**
|
|
283
|
-
*
|
|
260
|
+
* This Payload app is the authorization server. Users sign in to the admin panel and allow the
|
|
261
|
+
* MCP client, which then gets an access token for them.
|
|
284
262
|
*/
|
|
285
|
-
export type
|
|
263
|
+
export type MCPBuiltinOAuthConfig = {
|
|
286
264
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
265
|
+
* Creates the tokens the MCP client gets when the user clicks Allow. `req` is the user's own
|
|
266
|
+
* browser request, so `req.user` is the user who allowed it. Pass `authenticate` too if
|
|
267
|
+
* Payload's auth strategies don't accept the access token.
|
|
268
|
+
*
|
|
269
|
+
* @default a Payload login token for that user that only works for MCP, with a refresh token when
|
|
270
|
+
* the collection uses sessions
|
|
289
271
|
*/
|
|
290
|
-
|
|
272
|
+
issueToken?: (args: {
|
|
273
|
+
req: PayloadRequest;
|
|
274
|
+
}) => MaybePromise<MCPOAuthTokens>;
|
|
291
275
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
276
|
+
* Trades a refresh token from `issueToken`, or from an earlier refresh, for new tokens. Return
|
|
277
|
+
* `null` when it's no longer valid, and the client sends the user through sign-in again. `req`
|
|
278
|
+
* is the MCP client's request, without a user. Only used together with `issueToken`.
|
|
279
|
+
*
|
|
280
|
+
* OAuth requires noticing copied refresh tokens: return a new refresh token every time, and
|
|
281
|
+
* revoke the tokens when an already used refresh token comes back.
|
|
282
|
+
*
|
|
283
|
+
* It also runs when the client trades its authorization code, on the refresh token from
|
|
284
|
+
* `issueToken`, with `reuseInterval: 0`. OAuth requires a code to work only once, so refuse that
|
|
285
|
+
* refresh token if it was used before, even moments ago.
|
|
294
286
|
*/
|
|
295
|
-
|
|
287
|
+
refreshToken?: (args: {
|
|
288
|
+
refreshToken: string;
|
|
289
|
+
req: PayloadRequest;
|
|
290
|
+
/**
|
|
291
|
+
* How long a refresh token that was just used may still be accepted, in milliseconds, e.g. for
|
|
292
|
+
* clients that refresh twice at once. `0` means not at all. When it's missing, use your usual
|
|
293
|
+
* leeway.
|
|
294
|
+
*/
|
|
295
|
+
reuseInterval?: number;
|
|
296
|
+
}) => MaybePromise<MCPOAuthTokens | null>;
|
|
297
|
+
type: 'builtin';
|
|
298
|
+
} & MCPOAuthSharedConfig;
|
|
299
|
+
export type MCPOAuthTokens = {
|
|
300
|
+
accessToken: string;
|
|
301
|
+
/** Seconds until the access token expires. */
|
|
302
|
+
expiresIn?: number;
|
|
303
|
+
/** Lets the client get new tokens without the user, through `refreshToken`. */
|
|
304
|
+
refreshToken?: string;
|
|
305
|
+
};
|
|
306
|
+
/** Another service, e.g. your identity provider, is the authorization server. */
|
|
307
|
+
export type MCPExternalOAuthConfig = {
|
|
296
308
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
309
|
+
* The authorization servers that issue access tokens for MCP clients. Clients require each one
|
|
310
|
+
* to exactly match the `issuer` in that server's metadata, so pass a function when the exact
|
|
311
|
+
* value is only known at runtime, e.g. from the server's OpenID configuration or per host.
|
|
299
312
|
*/
|
|
300
|
-
|
|
313
|
+
authorizationServers: ((args: {
|
|
314
|
+
req: PayloadRequest;
|
|
315
|
+
}) => MaybePromise<string[]>) | string[];
|
|
301
316
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
317
|
+
* Scopes MCP clients should request, e.g. `['openid', 'email', 'profile']`. Without them,
|
|
318
|
+
* clients request none, which some authorization servers reject or answer with a token that
|
|
319
|
+
* doesn't identify the user.
|
|
304
320
|
*/
|
|
305
|
-
|
|
321
|
+
scopes?: string[];
|
|
322
|
+
type: 'external';
|
|
323
|
+
} & MCPOAuthSharedConfig;
|
|
324
|
+
type MCPOAuthSharedConfig = {
|
|
306
325
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
326
|
+
* Called on MCP requests with a bearer token that Payload's auth strategies didn't accept.
|
|
327
|
+
* Return the Payload user, including its `collection`, or `null` to answer with the OAuth challenge.
|
|
309
328
|
*/
|
|
310
|
-
|
|
329
|
+
authenticate?: (args: {
|
|
330
|
+
req: PayloadRequest;
|
|
331
|
+
token: string;
|
|
332
|
+
}) => MaybePromise<PayloadRequest['user']>;
|
|
311
333
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
334
|
+
* The URL clients call to reach the MCP endpoint. The metadata link and the built-in
|
|
335
|
+
* authorization server's issuer are based on it.
|
|
336
|
+
*
|
|
337
|
+
* @default the absolute URL of `/api/mcp`, based on `serverURL` or the request URL
|
|
314
338
|
*/
|
|
315
|
-
|
|
339
|
+
resource?: ((args: {
|
|
340
|
+
req: PayloadRequest;
|
|
341
|
+
}) => string) | string;
|
|
316
342
|
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
*/
|
|
343
|
+
export type SanitizedMCPPluginConfig = {
|
|
344
|
+
items: MCPItem[];
|
|
345
|
+
/** `undefined` when OAuth is turned off. */
|
|
346
|
+
oauth?: MCPOAuthConfig;
|
|
347
|
+
} & Pick<MCPPluginConfig, 'disabled' | 'hooks' | 'mcp' | 'overrideGetAuthorizedMCP'>;
|
|
320
348
|
export type MCPServerOptions = {
|
|
321
|
-
|
|
322
|
-
|
|
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
|
-
};
|
|
349
|
+
options?: McpServerOptions;
|
|
350
|
+
serverInfo?: Partial<Implementation>;
|
|
340
351
|
};
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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 = {
|
|
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;
|
|
397
|
-
};
|
|
398
|
-
fieldName: string;
|
|
399
|
-
};
|
|
400
|
-
export type CollectionConfigUpdates = {
|
|
401
|
-
access?: {
|
|
402
|
-
create?: string;
|
|
403
|
-
delete?: string;
|
|
404
|
-
read?: string;
|
|
405
|
-
update?: string;
|
|
406
|
-
};
|
|
407
|
-
description?: string;
|
|
408
|
-
slug?: string;
|
|
409
|
-
timestamps?: boolean;
|
|
410
|
-
versioning?: boolean;
|
|
411
|
-
};
|
|
412
|
-
export type AdminConfig = {
|
|
413
|
-
avatar?: string;
|
|
414
|
-
css?: string;
|
|
415
|
-
dateFormat?: string;
|
|
416
|
-
inactivityRoute?: string;
|
|
417
|
-
livePreview?: {
|
|
418
|
-
breakpoints?: Array<{
|
|
419
|
-
height: number;
|
|
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;
|
|
437
|
-
};
|
|
438
|
-
export type PluginUpdates = {
|
|
439
|
-
add?: string[];
|
|
440
|
-
remove?: string[];
|
|
352
|
+
/**
|
|
353
|
+
* One MCP primitive plus the metadata needed for config-driven filtering and
|
|
354
|
+
* registration.
|
|
355
|
+
*
|
|
356
|
+
* - `configKey`: the config identifier, e.g. `find` or `echo`.
|
|
357
|
+
* - `mcpName`: the MCP wire name, e.g. `findDocuments` or `echo`.
|
|
358
|
+
* - `label`: human-readable display text.
|
|
359
|
+
*/
|
|
360
|
+
export type MCPItemBase = {
|
|
361
|
+
configKey: string;
|
|
362
|
+
label: string;
|
|
363
|
+
mcpName: string;
|
|
441
364
|
};
|
|
442
|
-
export type
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
365
|
+
export type CollectionMCPItem = {
|
|
366
|
+
collectionSlug: CollectionSlug;
|
|
367
|
+
tool: CollectionTool;
|
|
368
|
+
type: 'collectionTool';
|
|
369
|
+
} & MCPItemBase;
|
|
370
|
+
export type GlobalMCPItem = {
|
|
371
|
+
globalSlug: GlobalSlug;
|
|
372
|
+
tool: GlobalTool;
|
|
373
|
+
type: 'globalTool';
|
|
374
|
+
} & MCPItemBase;
|
|
375
|
+
export type MCPItem = ({
|
|
376
|
+
prompt: Prompt;
|
|
377
|
+
type: 'prompt';
|
|
378
|
+
} & MCPItemBase) | ({
|
|
379
|
+
resource: Resource;
|
|
380
|
+
type: 'resource';
|
|
381
|
+
} & MCPItemBase) | ({
|
|
382
|
+
tool: Tool;
|
|
383
|
+
type: 'tool';
|
|
384
|
+
} & MCPItemBase) | CollectionMCPItem | GlobalMCPItem;
|
|
385
|
+
/**
|
|
386
|
+
* The MCP items and access mode authorized for this request. The authenticated user is available
|
|
387
|
+
* as `req.user`.
|
|
388
|
+
*/
|
|
389
|
+
export type AuthorizedMCP = {
|
|
390
|
+
items: MCPItem[];
|
|
391
|
+
overrideAccess: boolean;
|
|
461
392
|
};
|
|
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
393
|
//# sourceMappingURL=types.d.ts.map
|