@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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Payload } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { getPluginConfig } from './getPluginConfig.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the logger for the MCP plugin. Child of the main Payload logger, prefixed with `[plugin-mcp]`
|
|
7
|
+
* and tagged with a structured `plugin: 'mcp'` field. When `verboseLogs` is off, info/debug calls
|
|
8
|
+
* are silenced; warn/error still surface so operators don't lose error signal.
|
|
9
|
+
*/
|
|
10
|
+
export const getLogger: (args: { payload: Payload }) => Payload['logger'] = ({ payload }) => {
|
|
11
|
+
const pluginConfig = getPluginConfig({ config: payload.config })
|
|
12
|
+
|
|
13
|
+
const useVerboseLogs = pluginConfig?.mcp?.verboseLogs ?? false
|
|
14
|
+
|
|
15
|
+
const logger = payload.logger.child({ plugin: 'mcp' }, { msgPrefix: '[plugin-mcp] ' })
|
|
16
|
+
|
|
17
|
+
if (!useVerboseLogs) {
|
|
18
|
+
logger.level = 'warn'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return logger
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PluginsMap, SanitizedConfig } from 'payload'
|
|
2
|
+
|
|
3
|
+
import type { SanitizedMCPPluginConfig } from '../types.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns the sanitized plugin config — the form produced by
|
|
7
|
+
* `sanitizeMCPConfig` and stashed back on the plugin's `options` during init.
|
|
8
|
+
* Callers downstream of plugin init can rely on `items` and other defaults
|
|
9
|
+
* being fully resolved.
|
|
10
|
+
*/
|
|
11
|
+
export const getPluginConfig: (args: { config: SanitizedConfig }) => SanitizedMCPPluginConfig = ({
|
|
12
|
+
config,
|
|
13
|
+
}) => {
|
|
14
|
+
const plugin = config.plugins?.find(
|
|
15
|
+
(plugin) => plugin.slug === '@payloadcms/plugin-mcp',
|
|
16
|
+
) as PluginsMap['@payloadcms/plugin-mcp']
|
|
17
|
+
|
|
18
|
+
if (!plugin) {
|
|
19
|
+
throw new Error('MCP Plugin not found in config.plugins.')
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// @ts-expect-error
|
|
23
|
+
return plugin.sanitizedOptions
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the project root: the parent of the outermost `node_modules` segment in
|
|
5
|
+
* `fromPath`. Returns `null` when the path has no `node_modules` (e.g. running from
|
|
6
|
+
* source inside the Payload monorepo).
|
|
7
|
+
*/
|
|
8
|
+
export const resolveProjectRoot = (fromPath: string): null | string => {
|
|
9
|
+
const segments = fromPath.split(path.sep)
|
|
10
|
+
const nodeModulesIndex = segments.indexOf('node_modules')
|
|
11
|
+
|
|
12
|
+
if (nodeModulesIndex <= 0) {
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return segments.slice(0, nodeModulesIndex).join(path.sep) || null
|
|
17
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Encrypts data for the client to hold, so it doesn't need to be stored. `type` keeps one kind
|
|
5
|
+
* from being used as another, e.g. a client ID as an authorization code.
|
|
6
|
+
*/
|
|
7
|
+
export const seal = ({
|
|
8
|
+
type,
|
|
9
|
+
data,
|
|
10
|
+
expiresInSeconds,
|
|
11
|
+
req,
|
|
12
|
+
}: {
|
|
13
|
+
data: object
|
|
14
|
+
expiresInSeconds?: number
|
|
15
|
+
req: PayloadRequest
|
|
16
|
+
type: string
|
|
17
|
+
}): string =>
|
|
18
|
+
req.payload.encrypt(
|
|
19
|
+
JSON.stringify({
|
|
20
|
+
...data,
|
|
21
|
+
type,
|
|
22
|
+
exp: expiresInSeconds && Date.now() + expiresInSeconds * 1000,
|
|
23
|
+
}),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
export const unseal = <T>({
|
|
27
|
+
type,
|
|
28
|
+
req,
|
|
29
|
+
value,
|
|
30
|
+
}: {
|
|
31
|
+
req: PayloadRequest
|
|
32
|
+
type: string
|
|
33
|
+
value: null | string
|
|
34
|
+
}): T | undefined => {
|
|
35
|
+
// Only the v1 format is authenticated. Older formats decrypt anything without an error.
|
|
36
|
+
if (!value?.startsWith('v1:')) {
|
|
37
|
+
return undefined
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
const data = JSON.parse(req.payload.decrypt(value, { secret: req.payload.config.secret }))
|
|
42
|
+
return data.type === type && (!data.exp || data.exp > Date.now()) ? data : undefined
|
|
43
|
+
} catch {
|
|
44
|
+
return undefined
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { fromJsonSchema, type StandardSchemaWithJSON } from '@modelcontextprotocol/server'
|
|
2
|
+
|
|
3
|
+
import type { ToolInputSchema } from '../types.js'
|
|
4
|
+
|
|
5
|
+
/** Normalize a tool/prompt input to a Standard Schema. Raw JSON Schema gets wrapped; Standard Schema instances pass through. */
|
|
6
|
+
export const toStandardSchema = (schema: ToolInputSchema): StandardSchemaWithJSON =>
|
|
7
|
+
typeof schema === 'object' && schema !== null && '~standard' in schema
|
|
8
|
+
? schema
|
|
9
|
+
: fromJsonSchema(schema)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { Button } from '@payloadcms/ui'
|
|
4
|
+
import React, { useEffect, useState, useSyncExternalStore } from 'react'
|
|
5
|
+
|
|
6
|
+
const baseClass = 'mcp-authorize'
|
|
7
|
+
|
|
8
|
+
/** How long the page must have been in front of the user before the buttons work, in ms. */
|
|
9
|
+
const enableDelay = 1000
|
|
10
|
+
|
|
11
|
+
// Whether the page is inside a frame never changes, so there's nothing to subscribe to
|
|
12
|
+
const subscribe = () => () => {}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The Allow and Deny buttons, protected against clicks the user didn't mean for this page:
|
|
16
|
+
*
|
|
17
|
+
* - Inside a frame they aren't shown, so other sites can't frame the page and trick users into
|
|
18
|
+
* clicking them. The server can't tell, so they're missing until the browser has checked.
|
|
19
|
+
* - They're disabled until the page has been visible and focused for a moment. Otherwise another
|
|
20
|
+
* site could open the page under the user's cursor while they double-click something else, so
|
|
21
|
+
* the second click lands on Allow. Leaving the page disables them again. Waiting works for every
|
|
22
|
+
* way of clicking, unlike requiring a mouse movement or key press first.
|
|
23
|
+
*
|
|
24
|
+
* @see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-7.11 for why the
|
|
25
|
+
* OAuth server must prevent clickjacking
|
|
26
|
+
* @see https://cheatsheetseries.owasp.org/cheatsheets/Clickjacking_Defense_Cheat_Sheet.html#defending-against-doubleclickjacking
|
|
27
|
+
* for the double-click attack and its mitigation
|
|
28
|
+
*/
|
|
29
|
+
export function AllowButtons() {
|
|
30
|
+
const isTopLevel = useSyncExternalStore(
|
|
31
|
+
subscribe,
|
|
32
|
+
() => window.top === window.self,
|
|
33
|
+
() => false,
|
|
34
|
+
)
|
|
35
|
+
const [isEnabled, setIsEnabled] = useState(false)
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
let timeout: ReturnType<typeof setTimeout> | undefined
|
|
39
|
+
|
|
40
|
+
const enableAfterDelay = () => {
|
|
41
|
+
clearTimeout(timeout)
|
|
42
|
+
if (document.visibilityState === 'visible' && document.hasFocus()) {
|
|
43
|
+
timeout = setTimeout(() => setIsEnabled(true), enableDelay)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const disable = () => {
|
|
47
|
+
clearTimeout(timeout)
|
|
48
|
+
setIsEnabled(false)
|
|
49
|
+
}
|
|
50
|
+
const onVisibilityChange = () => {
|
|
51
|
+
if (document.visibilityState === 'visible') {
|
|
52
|
+
enableAfterDelay()
|
|
53
|
+
} else {
|
|
54
|
+
disable()
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
enableAfterDelay()
|
|
59
|
+
window.addEventListener('focus', enableAfterDelay)
|
|
60
|
+
window.addEventListener('blur', disable)
|
|
61
|
+
document.addEventListener('visibilitychange', onVisibilityChange)
|
|
62
|
+
|
|
63
|
+
return () => {
|
|
64
|
+
clearTimeout(timeout)
|
|
65
|
+
window.removeEventListener('focus', enableAfterDelay)
|
|
66
|
+
window.removeEventListener('blur', disable)
|
|
67
|
+
document.removeEventListener('visibilitychange', onVisibilityChange)
|
|
68
|
+
}
|
|
69
|
+
}, [])
|
|
70
|
+
|
|
71
|
+
if (!isTopLevel) {
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className={`${baseClass}__actions`}>
|
|
77
|
+
<Button
|
|
78
|
+
buttonStyle="primary"
|
|
79
|
+
disabled={!isEnabled}
|
|
80
|
+
extraButtonProps={{ name: 'decision', value: 'allow' }}
|
|
81
|
+
margin={false}
|
|
82
|
+
type="submit"
|
|
83
|
+
>
|
|
84
|
+
Allow
|
|
85
|
+
</Button>
|
|
86
|
+
<Button
|
|
87
|
+
buttonStyle="secondary"
|
|
88
|
+
disabled={!isEnabled}
|
|
89
|
+
extraButtonProps={{ name: 'decision', value: 'deny' }}
|
|
90
|
+
margin={false}
|
|
91
|
+
type="submit"
|
|
92
|
+
>
|
|
93
|
+
Deny
|
|
94
|
+
</Button>
|
|
95
|
+
</div>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@layer payload-default {
|
|
2
|
+
.mcp-authorize {
|
|
3
|
+
overflow-wrap: anywhere;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.mcp-authorize__brand {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
width: 100%;
|
|
10
|
+
margin-block-end: var(--spacer-5);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.mcp-authorize__actions {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
gap: var(--spacer-2);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AdminViewServerProps } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { FormHeader, Logo, MinimalTemplate } from '@payloadcms/ui/rsc'
|
|
4
|
+
import { formatAdminURL } from 'payload/shared'
|
|
5
|
+
import React from 'react'
|
|
6
|
+
|
|
7
|
+
import type { AuthorizeViewError, Client, Consent } from '../../endpoint/oauthServer.js'
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports dir for proper client boundary
|
|
10
|
+
import { AllowButtons } from '../../exports/client.js'
|
|
11
|
+
import { unseal } from '../../utils/seal.js'
|
|
12
|
+
import './index.css'
|
|
13
|
+
|
|
14
|
+
const baseClass = 'mcp-authorize'
|
|
15
|
+
|
|
16
|
+
const errorTitles: Record<AuthorizeViewError, string> = {
|
|
17
|
+
expired: 'This sign-in request expired',
|
|
18
|
+
'invalid-link': 'This sign-in link is invalid',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The admin page where users allow an MCP client to use their account, for the built-in OAuth
|
|
23
|
+
* server. Its authorize endpoint sends users here with the consent to show, or with an error.
|
|
24
|
+
*/
|
|
25
|
+
export function MCPAuthorizeView({
|
|
26
|
+
initPageResult,
|
|
27
|
+
params,
|
|
28
|
+
searchParams,
|
|
29
|
+
server,
|
|
30
|
+
user,
|
|
31
|
+
}: AdminViewServerProps) {
|
|
32
|
+
const { locale, permissions, req } = initPageResult
|
|
33
|
+
const { i18n, payload } = req
|
|
34
|
+
const sealedConsent = getSearchParam(searchParams?.consent)
|
|
35
|
+
const consent = unseal<Consent>({ type: 'consent', req, value: sealedConsent })
|
|
36
|
+
const client = consent && unseal<Client>({ type: 'client', req, value: consent.clientID })
|
|
37
|
+
// The consent is only valid for the user it was made for
|
|
38
|
+
const isConsentValid =
|
|
39
|
+
client &&
|
|
40
|
+
consent &&
|
|
41
|
+
req.user?.id === consent.userID &&
|
|
42
|
+
req.user.collection === consent.collection
|
|
43
|
+
const error: AuthorizeViewError =
|
|
44
|
+
getSearchParam(searchParams?.error) === 'invalid-link' ? 'invalid-link' : 'expired'
|
|
45
|
+
const account = String(user?.email ?? consent?.userID)
|
|
46
|
+
const returnHost = consent && (new URL(consent.redirectURI).host || consent.redirectURI)
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<MinimalTemplate className={baseClass}>
|
|
50
|
+
<div className={`${baseClass}__brand`}>
|
|
51
|
+
<Logo
|
|
52
|
+
i18n={i18n}
|
|
53
|
+
locale={locale}
|
|
54
|
+
params={params}
|
|
55
|
+
payload={payload}
|
|
56
|
+
permissions={permissions}
|
|
57
|
+
searchParams={searchParams}
|
|
58
|
+
server={server}
|
|
59
|
+
user={user}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
{/* Not translated yet, so screen readers in other admin languages read it as English */}
|
|
63
|
+
<div lang="en">
|
|
64
|
+
{isConsentValid ? (
|
|
65
|
+
<>
|
|
66
|
+
<FormHeader
|
|
67
|
+
description={`It will be able to use this app's MCP tools as ${account}, and you will return to ${returnHost}.`}
|
|
68
|
+
heading={`Allow ${client.name} to use your account?`}
|
|
69
|
+
/>
|
|
70
|
+
<form
|
|
71
|
+
action={formatAdminURL({
|
|
72
|
+
apiRoute: payload.config.routes.api,
|
|
73
|
+
path: '/mcp/oauth/authorize',
|
|
74
|
+
})}
|
|
75
|
+
method="post"
|
|
76
|
+
>
|
|
77
|
+
<input name="consent" type="hidden" value={sealedConsent!} />
|
|
78
|
+
<AllowButtons />
|
|
79
|
+
</form>
|
|
80
|
+
</>
|
|
81
|
+
) : (
|
|
82
|
+
<FormHeader
|
|
83
|
+
description="Start the sign-in again from your MCP client."
|
|
84
|
+
heading={errorTitles[error]}
|
|
85
|
+
/>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
</MinimalTemplate>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const getSearchParam = (value: string | string[] | undefined): null | string =>
|
|
93
|
+
typeof value === 'string' ? value : null
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CollectionConfig } from 'payload';
|
|
2
|
-
import type { MCPPluginConfig } from '../types.js';
|
|
3
|
-
export declare const createAPIKeysCollection: (collections: MCPPluginConfig["collections"], globals: MCPPluginConfig["globals"], customTools: Array<{
|
|
4
|
-
description: string;
|
|
5
|
-
name: string;
|
|
6
|
-
}> | undefined, experimentalTools: NonNullable<MCPPluginConfig["experimental"]>["tools"] | undefined, pluginOptions: MCPPluginConfig) => CollectionConfig;
|
|
7
|
-
//# sourceMappingURL=createApiKeysCollection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createApiKeysCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createApiKeysCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,SAAS,CAAA;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKlD,eAAO,MAAM,uBAAuB,gBACrB,eAAe,CAAC,aAAa,CAAC,WAClC,eAAe,CAAC,SAAS,CAAC,eACtB,KAAK,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,iCACtC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,6BACzD,eAAe,KAC7B,gBAuWF,CAAA"}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import { toCamelCase } from '../utils/camelCase.js';
|
|
2
|
-
import { createApiKeyFields } from '../utils/createApiKeyFields.js';
|
|
3
|
-
export const createAPIKeysCollection = (collections, globals, customTools = [], experimentalTools = {}, pluginOptions)=>{
|
|
4
|
-
const customToolsFields = customTools.map((tool)=>{
|
|
5
|
-
const camelCasedName = toCamelCase(tool.name);
|
|
6
|
-
return {
|
|
7
|
-
name: camelCasedName,
|
|
8
|
-
type: 'checkbox',
|
|
9
|
-
admin: {
|
|
10
|
-
description: tool.description
|
|
11
|
-
},
|
|
12
|
-
defaultValue: true,
|
|
13
|
-
label: camelCasedName
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
const customResourceFields = pluginOptions.mcp?.resources?.map((resource)=>{
|
|
17
|
-
const camelCasedName = toCamelCase(resource.name);
|
|
18
|
-
return {
|
|
19
|
-
name: camelCasedName,
|
|
20
|
-
type: 'checkbox',
|
|
21
|
-
admin: {
|
|
22
|
-
description: resource.description
|
|
23
|
-
},
|
|
24
|
-
defaultValue: true,
|
|
25
|
-
label: camelCasedName
|
|
26
|
-
};
|
|
27
|
-
}) || [];
|
|
28
|
-
const customPromptFields = pluginOptions.mcp?.prompts?.map((prompt)=>{
|
|
29
|
-
const camelCasedName = toCamelCase(prompt.name);
|
|
30
|
-
return {
|
|
31
|
-
name: camelCasedName,
|
|
32
|
-
type: 'checkbox',
|
|
33
|
-
admin: {
|
|
34
|
-
description: prompt.description
|
|
35
|
-
},
|
|
36
|
-
defaultValue: true,
|
|
37
|
-
label: camelCasedName
|
|
38
|
-
};
|
|
39
|
-
}) || [];
|
|
40
|
-
const userCollection = pluginOptions.userCollection;
|
|
41
|
-
return {
|
|
42
|
-
slug: 'payload-mcp-api-keys',
|
|
43
|
-
admin: {
|
|
44
|
-
description: 'API keys control which collections, resources, tools, and prompts MCP clients can access',
|
|
45
|
-
group: 'MCP',
|
|
46
|
-
useAsTitle: 'label'
|
|
47
|
-
},
|
|
48
|
-
auth: {
|
|
49
|
-
disableLocalStrategy: true,
|
|
50
|
-
useAPIKey: true
|
|
51
|
-
},
|
|
52
|
-
fields: [
|
|
53
|
-
{
|
|
54
|
-
name: 'user',
|
|
55
|
-
type: 'relationship',
|
|
56
|
-
admin: {
|
|
57
|
-
description: 'The user that the API key is associated with.'
|
|
58
|
-
},
|
|
59
|
-
relationTo: userCollection,
|
|
60
|
-
required: true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: 'label',
|
|
64
|
-
type: 'text',
|
|
65
|
-
admin: {
|
|
66
|
-
description: 'A useful label for the API key.'
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'description',
|
|
71
|
-
type: 'text',
|
|
72
|
-
admin: {
|
|
73
|
-
description: 'The purpose of the API key.'
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
...createApiKeyFields({
|
|
77
|
-
config: collections,
|
|
78
|
-
configType: 'collection'
|
|
79
|
-
}),
|
|
80
|
-
...createApiKeyFields({
|
|
81
|
-
config: globals,
|
|
82
|
-
configType: 'global'
|
|
83
|
-
}),
|
|
84
|
-
...customTools.length > 0 ? [
|
|
85
|
-
{
|
|
86
|
-
type: 'collapsible',
|
|
87
|
-
admin: {
|
|
88
|
-
description: 'Manage client access to tools',
|
|
89
|
-
position: 'sidebar'
|
|
90
|
-
},
|
|
91
|
-
fields: [
|
|
92
|
-
{
|
|
93
|
-
name: 'payload-mcp-tool',
|
|
94
|
-
type: 'group',
|
|
95
|
-
fields: customToolsFields,
|
|
96
|
-
label: false
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
label: 'Tools'
|
|
100
|
-
}
|
|
101
|
-
] : [],
|
|
102
|
-
...pluginOptions.mcp?.resources && pluginOptions.mcp?.resources.length > 0 ? [
|
|
103
|
-
{
|
|
104
|
-
type: 'collapsible',
|
|
105
|
-
admin: {
|
|
106
|
-
description: 'Manage client access to resources',
|
|
107
|
-
position: 'sidebar'
|
|
108
|
-
},
|
|
109
|
-
fields: [
|
|
110
|
-
{
|
|
111
|
-
name: 'payload-mcp-resource',
|
|
112
|
-
type: 'group',
|
|
113
|
-
fields: customResourceFields,
|
|
114
|
-
label: false
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
|
-
label: 'Resources'
|
|
118
|
-
}
|
|
119
|
-
] : [],
|
|
120
|
-
...pluginOptions.mcp?.prompts && pluginOptions.mcp?.prompts.length > 0 ? [
|
|
121
|
-
{
|
|
122
|
-
type: 'collapsible',
|
|
123
|
-
admin: {
|
|
124
|
-
description: 'Manage client access to prompts',
|
|
125
|
-
position: 'sidebar'
|
|
126
|
-
},
|
|
127
|
-
fields: [
|
|
128
|
-
{
|
|
129
|
-
name: 'payload-mcp-prompt',
|
|
130
|
-
type: 'group',
|
|
131
|
-
fields: customPromptFields,
|
|
132
|
-
label: false
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
label: 'Prompts'
|
|
136
|
-
}
|
|
137
|
-
] : [],
|
|
138
|
-
// Experimental Tools
|
|
139
|
-
...process.env.NODE_ENV === 'development' && (experimentalTools?.collections?.enabled || experimentalTools?.jobs?.enabled || experimentalTools?.config?.enabled || experimentalTools?.auth?.enabled) ? [
|
|
140
|
-
{
|
|
141
|
-
type: 'collapsible',
|
|
142
|
-
admin: {
|
|
143
|
-
description: 'Manage client access to experimental tools',
|
|
144
|
-
position: 'sidebar'
|
|
145
|
-
},
|
|
146
|
-
fields: [
|
|
147
|
-
...experimentalTools?.collections?.enabled ? [
|
|
148
|
-
{
|
|
149
|
-
name: 'collections',
|
|
150
|
-
type: 'group',
|
|
151
|
-
fields: [
|
|
152
|
-
{
|
|
153
|
-
name: 'find',
|
|
154
|
-
type: 'checkbox',
|
|
155
|
-
admin: {
|
|
156
|
-
description: 'Allow LLMs to find and list Payload collections with optional content and document counts.'
|
|
157
|
-
},
|
|
158
|
-
defaultValue: false
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: 'create',
|
|
162
|
-
type: 'checkbox',
|
|
163
|
-
admin: {
|
|
164
|
-
description: 'Allow LLMs to create new Payload collections with specified fields and configuration.'
|
|
165
|
-
},
|
|
166
|
-
defaultValue: false
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: 'update',
|
|
170
|
-
type: 'checkbox',
|
|
171
|
-
admin: {
|
|
172
|
-
description: 'Allow LLMs to update existing Payload collections with new fields, modifications, or configuration changes.'
|
|
173
|
-
},
|
|
174
|
-
defaultValue: false
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'delete',
|
|
178
|
-
type: 'checkbox',
|
|
179
|
-
admin: {
|
|
180
|
-
description: 'Allow LLMs to delete Payload collections and optionally update the configuration.'
|
|
181
|
-
},
|
|
182
|
-
defaultValue: false
|
|
183
|
-
}
|
|
184
|
-
]
|
|
185
|
-
}
|
|
186
|
-
] : [],
|
|
187
|
-
...experimentalTools?.jobs?.enabled ? [
|
|
188
|
-
{
|
|
189
|
-
name: 'jobs',
|
|
190
|
-
type: 'group',
|
|
191
|
-
fields: [
|
|
192
|
-
{
|
|
193
|
-
name: 'create',
|
|
194
|
-
type: 'checkbox',
|
|
195
|
-
admin: {
|
|
196
|
-
description: 'Allow LLMs to create new Payload jobs (tasks and workflows) with custom schemas and configuration.'
|
|
197
|
-
},
|
|
198
|
-
defaultValue: false
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
name: 'run',
|
|
202
|
-
type: 'checkbox',
|
|
203
|
-
admin: {
|
|
204
|
-
description: 'Allow LLMs to execute Payload jobs with custom input data and queue options.'
|
|
205
|
-
},
|
|
206
|
-
defaultValue: false
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: 'update',
|
|
210
|
-
type: 'checkbox',
|
|
211
|
-
admin: {
|
|
212
|
-
description: 'Allow LLMs to update existing Payload jobs with new schemas, configuration, or handler code.'
|
|
213
|
-
},
|
|
214
|
-
defaultValue: false
|
|
215
|
-
}
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
] : [],
|
|
219
|
-
...experimentalTools?.config?.enabled ? [
|
|
220
|
-
{
|
|
221
|
-
name: 'config',
|
|
222
|
-
type: 'group',
|
|
223
|
-
fields: [
|
|
224
|
-
{
|
|
225
|
-
name: 'find',
|
|
226
|
-
type: 'checkbox',
|
|
227
|
-
admin: {
|
|
228
|
-
description: 'Allow LLMs to read and display a Payload configuration file.'
|
|
229
|
-
},
|
|
230
|
-
defaultValue: false
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: 'update',
|
|
234
|
-
type: 'checkbox',
|
|
235
|
-
admin: {
|
|
236
|
-
description: 'Allow LLMs to update a Payload configuration file with various modifications.'
|
|
237
|
-
},
|
|
238
|
-
defaultValue: false
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
] : [],
|
|
243
|
-
...experimentalTools?.auth?.enabled ? [
|
|
244
|
-
{
|
|
245
|
-
name: 'auth',
|
|
246
|
-
type: 'group',
|
|
247
|
-
fields: [
|
|
248
|
-
{
|
|
249
|
-
name: 'auth',
|
|
250
|
-
type: 'checkbox',
|
|
251
|
-
admin: {
|
|
252
|
-
description: 'Allow LLMs to check authentication status for a user by setting custom headers. (e.g. {"Authorization": "Bearer <token>"})'
|
|
253
|
-
},
|
|
254
|
-
defaultValue: false,
|
|
255
|
-
label: 'Check Auth Status'
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
name: 'login',
|
|
259
|
-
type: 'checkbox',
|
|
260
|
-
admin: {
|
|
261
|
-
description: 'Allow LLMs to authenticate a user with email and password.'
|
|
262
|
-
},
|
|
263
|
-
defaultValue: false,
|
|
264
|
-
label: 'User Login'
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
name: 'verify',
|
|
268
|
-
type: 'checkbox',
|
|
269
|
-
admin: {
|
|
270
|
-
description: 'Allow LLMs to verify a user email with a verification token.'
|
|
271
|
-
},
|
|
272
|
-
defaultValue: false,
|
|
273
|
-
label: 'Email Verification'
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
name: 'resetPassword',
|
|
277
|
-
type: 'checkbox',
|
|
278
|
-
admin: {
|
|
279
|
-
description: 'Allow LLMs to reset a user password with a reset token.'
|
|
280
|
-
},
|
|
281
|
-
defaultValue: false,
|
|
282
|
-
label: 'Reset Password'
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: 'forgotPassword',
|
|
286
|
-
type: 'checkbox',
|
|
287
|
-
admin: {
|
|
288
|
-
description: 'Allow LLMs to send a password reset email to a user.'
|
|
289
|
-
},
|
|
290
|
-
defaultValue: false,
|
|
291
|
-
label: 'Forgot Password'
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: 'unlock',
|
|
295
|
-
type: 'checkbox',
|
|
296
|
-
admin: {
|
|
297
|
-
description: 'Allow LLMs to unlock a user account that has been locked due to failed login attempts.'
|
|
298
|
-
},
|
|
299
|
-
defaultValue: false,
|
|
300
|
-
label: 'Unlock Account'
|
|
301
|
-
}
|
|
302
|
-
]
|
|
303
|
-
}
|
|
304
|
-
] : []
|
|
305
|
-
],
|
|
306
|
-
label: 'Experimental Tools'
|
|
307
|
-
}
|
|
308
|
-
] : []
|
|
309
|
-
],
|
|
310
|
-
labels: {
|
|
311
|
-
plural: 'API Keys',
|
|
312
|
-
singular: 'API Key'
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
//# sourceMappingURL=createApiKeysCollection.js.map
|