@payloadcms/plugin-mcp 4.0.0-internal.e16cf59 → 4.0.0-internal.e38d3ac
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 +46 -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 +17 -0
- package/dist/endpoint/access.d.ts.map +1 -0
- package/dist/endpoint/access.js +93 -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 +87 -0
- package/dist/endpoint/index.js.map +1 -0
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +4 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/internal.d.ts +2 -0
- package/dist/exports/internal.d.ts.map +1 -0
- package/dist/exports/internal.js +3 -0
- package/dist/exports/internal.js.map +1 -0
- package/dist/index.d.ts +6 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -67
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +19 -0
- package/dist/mcp/buildMcpServer.d.ts.map +1 -0
- package/dist/mcp/buildMcpServer.js +223 -0
- package/dist/mcp/buildMcpServer.js.map +1 -0
- package/dist/mcp/builtin/collections/authTools.d.ts +7 -0
- package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/authTools.js +288 -0
- package/dist/mcp/builtin/collections/authTools.js.map +1 -0
- package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countTool.js +68 -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 +64 -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 +138 -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 +110 -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 +96 -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 +124 -0
- package/dist/mcp/builtin/collections/fileInput.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js +86 -0
- package/dist/mcp/builtin/collections/fileInput.spec.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 +92 -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 +164 -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 +83 -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 +98 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +9 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.js +60 -0
- package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +87 -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 +81 -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 +204 -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/getConfigInfoTool.d.ts +2 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.js +68 -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 +64 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findTool.js +73 -0
- package/dist/mcp/builtin/globals/findTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +79 -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 +94 -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 +65 -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 +77 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.js +87 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
- package/dist/mcp/builtin/validateEntityData.d.ts +14 -0
- package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -0
- package/dist/mcp/builtin/validateEntityData.js +82 -0
- package/dist/mcp/builtin/validateEntityData.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +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 +233 -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 +127 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +256 -447
- 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/schemaConversion/filterFieldsByAccess.d.ts +28 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts.map +1 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js +71 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +13 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.js +66 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.js.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +10 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +384 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +133 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -0
- package/dist/utils/toStandardSchema.d.ts +5 -0
- package/dist/utils/toStandardSchema.d.ts.map +1 -0
- package/dist/utils/toStandardSchema.js +4 -0
- package/dist/utils/toStandardSchema.js.map +1 -0
- package/dist/utils/whereSchema.d.ts +9 -0
- package/dist/utils/whereSchema.d.ts.map +1 -0
- package/dist/utils/whereSchema.js +13 -0
- package/dist/utils/whereSchema.js.map +1 -0
- package/package.json +30 -10
- package/src/defaultAccess.ts +3 -0
- package/src/defineTool.ts +44 -0
- package/src/endpoint/access.ts +112 -0
- package/src/endpoint/index.ts +77 -0
- package/src/exports/client.ts +3 -0
- package/src/exports/internal.ts +1 -0
- package/src/index.ts +31 -89
- package/src/mcp/buildMcpServer.ts +284 -0
- package/src/mcp/builtin/collections/authTools.ts +269 -0
- package/src/mcp/builtin/collections/countTool.ts +73 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +69 -0
- package/src/mcp/builtin/collections/createTool.ts +168 -0
- package/src/mcp/builtin/collections/deleteTool.ts +125 -0
- package/src/mcp/builtin/collections/duplicateTool.ts +134 -0
- package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
- package/src/mcp/builtin/collections/fileInput.ts +164 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +119 -0
- package/src/mcp/builtin/collections/findTool.ts +216 -0
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +109 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +154 -0
- package/src/mcp/builtin/collections/formatCollectionError.ts +84 -0
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +80 -0
- package/src/mcp/builtin/collections/restoreVersionTool.ts +107 -0
- package/src/mcp/builtin/collections/updateTool.ts +227 -0
- package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +67 -0
- package/src/mcp/builtin/globals/countVersionsTool.ts +68 -0
- package/src/mcp/builtin/globals/findTool.ts +105 -0
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +103 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +147 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +63 -0
- package/src/mcp/builtin/globals/restoreVersionTool.ts +99 -0
- package/src/mcp/builtin/globals/updateTool.ts +115 -0
- package/src/mcp/builtin/validateEntityData.ts +132 -0
- package/src/mcp/builtinTools.ts +161 -0
- package/src/mcp/sanitizeMCPConfig.ts +281 -0
- package/src/stdio.ts +131 -0
- package/src/types.ts +304 -486
- package/src/utils/getLogger.ts +22 -0
- package/src/utils/getPluginConfig.ts +24 -0
- package/src/utils/resolveProjectRoot.ts +17 -0
- package/src/utils/schemaConversion/filterFieldsByAccess.ts +123 -0
- package/src/utils/schemaConversion/getEntityInputSchema.ts +96 -0
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +96 -0
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +432 -0
- package/src/utils/toStandardSchema.ts +9 -0
- package/src/utils/whereSchema.ts +24 -0
- package/dist/collections/createApiKeysCollection.d.ts +0 -7
- package/dist/collections/createApiKeysCollection.d.ts.map +0 -1
- package/dist/collections/createApiKeysCollection.js +0 -317
- package/dist/collections/createApiKeysCollection.js.map +0 -1
- package/dist/defaults.d.ts +0 -4
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js +0 -5
- package/dist/defaults.js.map +0 -1
- package/dist/endpoints/mcp.d.ts +0 -4
- package/dist/endpoints/mcp.d.ts.map +0 -1
- package/dist/endpoints/mcp.js +0 -71
- package/dist/endpoints/mcp.js.map +0 -1
- package/dist/mcp/createRequest.d.ts +0 -3
- package/dist/mcp/createRequest.d.ts.map +0 -1
- package/dist/mcp/createRequest.js +0 -14
- package/dist/mcp/createRequest.js.map +0 -1
- package/dist/mcp/getMcpHandler.d.ts +0 -4
- package/dist/mcp/getMcpHandler.d.ts.map +0 -1
- package/dist/mcp/getMcpHandler.js +0 -231
- package/dist/mcp/getMcpHandler.js.map +0 -1
- package/dist/mcp/helpers/config.d.ts +0 -22
- package/dist/mcp/helpers/config.d.ts.map +0 -1
- package/dist/mcp/helpers/config.js +0 -153
- package/dist/mcp/helpers/config.js.map +0 -1
- package/dist/mcp/helpers/fields.d.ts +0 -19
- package/dist/mcp/helpers/fields.d.ts.map +0 -1
- package/dist/mcp/helpers/fields.js +0 -102
- package/dist/mcp/helpers/fields.js.map +0 -1
- package/dist/mcp/helpers/fileValidation.d.ts +0 -67
- package/dist/mcp/helpers/fileValidation.d.ts.map +0 -1
- package/dist/mcp/helpers/fileValidation.js +0 -267
- package/dist/mcp/helpers/fileValidation.js.map +0 -1
- package/dist/mcp/registerTool.d.ts +0 -6
- package/dist/mcp/registerTool.d.ts.map +0 -1
- package/dist/mcp/registerTool.js +0 -18
- package/dist/mcp/registerTool.js.map +0 -1
- package/dist/mcp/tools/auth/auth.d.ts +0 -4
- package/dist/mcp/tools/auth/auth.d.ts.map +0 -1
- package/dist/mcp/tools/auth/auth.js +0 -57
- package/dist/mcp/tools/auth/auth.js.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/forgotPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.js +0 -48
- package/dist/mcp/tools/auth/forgotPassword.js.map +0 -1
- package/dist/mcp/tools/auth/login.d.ts +0 -4
- package/dist/mcp/tools/auth/login.d.ts.map +0 -1
- package/dist/mcp/tools/auth/login.js +0 -51
- package/dist/mcp/tools/auth/login.js.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/resetPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.js +0 -49
- package/dist/mcp/tools/auth/resetPassword.js.map +0 -1
- package/dist/mcp/tools/auth/unlock.d.ts +0 -4
- package/dist/mcp/tools/auth/unlock.d.ts.map +0 -1
- package/dist/mcp/tools/auth/unlock.js +0 -48
- package/dist/mcp/tools/auth/unlock.js.map +0 -1
- package/dist/mcp/tools/auth/verify.d.ts +0 -4
- package/dist/mcp/tools/auth/verify.d.ts.map +0 -1
- package/dist/mcp/tools/auth/verify.js +0 -45
- package/dist/mcp/tools/auth/verify.js.map +0 -1
- package/dist/mcp/tools/collection/create.d.ts +0 -10
- package/dist/mcp/tools/collection/create.d.ts.map +0 -1
- package/dist/mcp/tools/collection/create.js +0 -139
- package/dist/mcp/tools/collection/create.js.map +0 -1
- package/dist/mcp/tools/collection/delete.d.ts +0 -10
- package/dist/mcp/tools/collection/delete.d.ts.map +0 -1
- package/dist/mcp/tools/collection/delete.js +0 -154
- package/dist/mcp/tools/collection/delete.js.map +0 -1
- package/dist/mcp/tools/collection/find.d.ts +0 -10
- package/dist/mcp/tools/collection/find.d.ts.map +0 -1
- package/dist/mcp/tools/collection/find.js +0 -165
- package/dist/mcp/tools/collection/find.js.map +0 -1
- package/dist/mcp/tools/collection/update.d.ts +0 -10
- package/dist/mcp/tools/collection/update.d.ts.map +0 -1
- package/dist/mcp/tools/collection/update.js +0 -209
- package/dist/mcp/tools/collection/update.js.map +0 -1
- package/dist/mcp/tools/config/find.d.ts +0 -10
- package/dist/mcp/tools/config/find.d.ts.map +0 -1
- package/dist/mcp/tools/config/find.js +0 -97
- package/dist/mcp/tools/config/find.js.map +0 -1
- package/dist/mcp/tools/config/update.d.ts +0 -10
- package/dist/mcp/tools/config/update.d.ts.map +0 -1
- package/dist/mcp/tools/config/update.js +0 -215
- package/dist/mcp/tools/config/update.js.map +0 -1
- package/dist/mcp/tools/global/find.d.ts +0 -5
- package/dist/mcp/tools/global/find.d.ts.map +0 -1
- package/dist/mcp/tools/global/find.js +0 -82
- package/dist/mcp/tools/global/find.js.map +0 -1
- package/dist/mcp/tools/global/update.d.ts +0 -6
- package/dist/mcp/tools/global/update.d.ts.map +0 -1
- package/dist/mcp/tools/global/update.js +0 -124
- package/dist/mcp/tools/global/update.js.map +0 -1
- package/dist/mcp/tools/job/create.d.ts +0 -10
- package/dist/mcp/tools/job/create.d.ts.map +0 -1
- package/dist/mcp/tools/job/create.js +0 -293
- package/dist/mcp/tools/job/create.js.map +0 -1
- package/dist/mcp/tools/job/run.d.ts +0 -10
- package/dist/mcp/tools/job/run.d.ts.map +0 -1
- package/dist/mcp/tools/job/run.js +0 -129
- package/dist/mcp/tools/job/run.js.map +0 -1
- package/dist/mcp/tools/job/update.d.ts +0 -11
- package/dist/mcp/tools/job/update.d.ts.map +0 -1
- package/dist/mcp/tools/job/update.js +0 -186
- package/dist/mcp/tools/job/update.js.map +0 -1
- package/dist/mcp/tools/resource/create.d.ts +0 -6
- package/dist/mcp/tools/resource/create.d.ts.map +0 -1
- package/dist/mcp/tools/resource/create.js +0 -124
- package/dist/mcp/tools/resource/create.js.map +0 -1
- package/dist/mcp/tools/resource/delete.d.ts +0 -5
- package/dist/mcp/tools/resource/delete.d.ts.map +0 -1
- package/dist/mcp/tools/resource/delete.js +0 -151
- package/dist/mcp/tools/resource/delete.js.map +0 -1
- package/dist/mcp/tools/resource/find.d.ts +0 -5
- package/dist/mcp/tools/resource/find.d.ts.map +0 -1
- package/dist/mcp/tools/resource/find.js +0 -170
- package/dist/mcp/tools/resource/find.js.map +0 -1
- package/dist/mcp/tools/resource/update.d.ts +0 -6
- package/dist/mcp/tools/resource/update.d.ts.map +0 -1
- package/dist/mcp/tools/resource/update.js +0 -256
- package/dist/mcp/tools/resource/update.js.map +0 -1
- package/dist/mcp/tools/schemas.d.ts +0 -457
- package/dist/mcp/tools/schemas.d.ts.map +0 -1
- package/dist/mcp/tools/schemas.js +0 -243
- package/dist/mcp/tools/schemas.js.map +0 -1
- package/dist/utils/adminEntitySettings.d.ts +0 -17
- package/dist/utils/adminEntitySettings.d.ts.map +0 -1
- package/dist/utils/adminEntitySettings.js +0 -41
- package/dist/utils/adminEntitySettings.js.map +0 -1
- package/dist/utils/createApiKeyFields.d.ts +0 -15
- package/dist/utils/createApiKeyFields.d.ts.map +0 -1
- package/dist/utils/createApiKeyFields.js +0 -57
- package/dist/utils/createApiKeyFields.js.map +0 -1
- package/dist/utils/getEnabledSlugs.d.ts +0 -13
- package/dist/utils/getEnabledSlugs.d.ts.map +0 -1
- package/dist/utils/getEnabledSlugs.js +0 -32
- package/dist/utils/getEnabledSlugs.js.map +0 -1
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts +0 -3
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts.map +0 -1
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js +0 -43
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +0 -7
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js +0 -20
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +0 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts +0 -13
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js +0 -56
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js.map +0 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts +0 -20
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts.map +0 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js +0 -53
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js.map +0 -1
- package/dist/utils/schemaConversion/transformPointFields.d.ts +0 -3
- package/dist/utils/schemaConversion/transformPointFields.d.ts.map +0 -1
- package/dist/utils/schemaConversion/transformPointFields.js +0 -51
- package/dist/utils/schemaConversion/transformPointFields.js.map +0 -1
- package/src/collections/createApiKeysCollection.ts +0 -373
- package/src/defaults.ts +0 -3
- package/src/endpoints/mcp.ts +0 -91
- package/src/mcp/createRequest.ts +0 -13
- package/src/mcp/getMcpHandler.ts +0 -545
- package/src/mcp/helpers/config.ts +0 -213
- package/src/mcp/helpers/fields.ts +0 -154
- package/src/mcp/helpers/fileValidation.ts +0 -362
- package/src/mcp/registerTool.ts +0 -22
- package/src/mcp/tools/auth/auth.ts +0 -71
- package/src/mcp/tools/auth/forgotPassword.ts +0 -70
- package/src/mcp/tools/auth/login.ts +0 -72
- package/src/mcp/tools/auth/resetPassword.ts +0 -61
- package/src/mcp/tools/auth/unlock.ts +0 -64
- package/src/mcp/tools/auth/verify.ts +0 -57
- package/src/mcp/tools/collection/create.ts +0 -210
- package/src/mcp/tools/collection/delete.ts +0 -211
- package/src/mcp/tools/collection/find.ts +0 -224
- package/src/mcp/tools/collection/update.ts +0 -290
- package/src/mcp/tools/config/find.ts +0 -128
- package/src/mcp/tools/config/update.ts +0 -280
- package/src/mcp/tools/global/find.ts +0 -128
- package/src/mcp/tools/global/update.ts +0 -207
- package/src/mcp/tools/job/create.ts +0 -416
- package/src/mcp/tools/job/run.ts +0 -167
- package/src/mcp/tools/job/update.ts +0 -274
- package/src/mcp/tools/resource/create.ts +0 -211
- package/src/mcp/tools/resource/delete.ts +0 -218
- package/src/mcp/tools/resource/find.ts +0 -246
- package/src/mcp/tools/resource/update.ts +0 -383
- package/src/mcp/tools/schemas.ts +0 -520
- package/src/utils/adminEntitySettings.ts +0 -40
- package/src/utils/createApiKeyFields.ts +0 -72
- package/src/utils/getEnabledSlugs.ts +0 -42
- package/src/utils/schemaConversion/convertCollectionSchemaToZod.ts +0 -52
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
- package/src/utils/schemaConversion/sanitizeJsonSchema.ts +0 -62
- package/src/utils/schemaConversion/simplifyRelationshipFields.ts +0 -65
- package/src/utils/schemaConversion/transformPointFields.ts +0 -55
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mcp/builtin/validateEntityData.ts"],"sourcesContent":["import type { CollectionSlug, GlobalSlug, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/server/validators/cf-worker'\n\nimport type { JsonSchemaType, MCPToolResponse } from '../../types.js'\n\nimport {\n getCollectionInputSchema,\n getGlobalInputSchema,\n} from '../../utils/schemaConversion/getEntityInputSchema.js'\n\n/**\n * Keep the default `shortcircuit: true` - `false` makes validating nested rich text exponentially slow.\n */\nconst validator = new CfWorkerJsonSchemaValidator({ shortcircuit: true })\n\ntype EntityValidator = {\n schema: JsonSchemaType\n validate: ReturnType<(typeof validator)['getValidator']>\n}\n\n/**\n * - Caches each entity's schema and validator, so both are only built on the first request.\n * - Keyed by payload config, then by entity type, slug, partial and language.\n */\nconst validatorCache = new WeakMap<SanitizedConfig, Map<string, EntityValidator>>()\n\nexport const validateCollectionData = ({\n collectionSlug,\n data,\n partial,\n req,\n}: {\n collectionSlug: CollectionSlug\n data: Record<string, unknown>\n partial?: boolean\n req: PayloadRequest\n}): MCPToolResponse | null =>\n validateData({\n slug: collectionSlug,\n buildSchema: () => getCollectionInputSchema({ collectionSlug, req }),\n data,\n entity: 'collection',\n partial,\n req,\n })\n\nexport const validateGlobalData = ({\n data,\n globalSlug,\n req,\n}: {\n data: Record<string, unknown>\n globalSlug: GlobalSlug\n req: PayloadRequest\n}): MCPToolResponse | null =>\n validateData({\n slug: globalSlug,\n buildSchema: () => getGlobalInputSchema({ globalSlug, req }),\n data,\n entity: 'global',\n partial: true,\n req,\n })\n\nconst validateData = ({\n slug,\n buildSchema,\n data,\n entity,\n partial,\n req,\n}: {\n buildSchema: () => JsonSchemaType | null\n data: Record<string, unknown>\n entity: 'collection' | 'global'\n partial?: boolean\n req: PayloadRequest\n slug: string\n}): MCPToolResponse | null => {\n let cache = validatorCache.get(req.payload.config)\n if (!cache) {\n cache = new Map()\n validatorCache.set(req.payload.config, cache)\n }\n\n const cacheKey = `${entity}:${slug}:${partial ? 'partial' : 'full'}:${req.i18n.language}`\n let entityValidator = cache.get(cacheKey)\n\n if (!entityValidator) {\n const schema = buildSchema()\n\n if (!schema) {\n return null\n }\n\n entityValidator = {\n schema,\n validate: validator.getValidator(partial ? withoutRequired(schema) : schema),\n }\n cache.set(cacheKey, entityValidator)\n }\n\n const result = entityValidator.validate(data)\n\n if (result.valid) {\n return null\n }\n\n const { schema } = entityValidator\n\n return {\n content: [\n {\n type: 'text',\n text: `Invalid data for ${entity} \"${slug}\": ${result.errorMessage}\\n\\nUse this schema for data:\\n\\`\\`\\`json\\n${JSON.stringify(schema)}\\n\\`\\`\\``,\n },\n ],\n isError: true,\n structuredContent: {\n [`${entity}Slug`]: slug,\n errors: [{ message: result.errorMessage }],\n schema,\n },\n }\n}\n\n/** Updates are partial — drop the schema's top-level `required` before validating. */\nconst withoutRequired = (schema: JsonSchemaType): JsonSchemaType => {\n const { required: _required, ...rest } = schema\n return rest\n}\n"],"names":["CfWorkerJsonSchemaValidator","getCollectionInputSchema","getGlobalInputSchema","validator","shortcircuit","validatorCache","WeakMap","validateCollectionData","collectionSlug","data","partial","req","validateData","slug","buildSchema","entity","validateGlobalData","globalSlug","cache","get","payload","config","Map","set","cacheKey","i18n","language","entityValidator","schema","validate","getValidator","withoutRequired","result","valid","content","type","text","errorMessage","JSON","stringify","isError","structuredContent","errors","message","required","_required","rest"],"mappings":"AAEA,SAASA,2BAA2B,QAAQ,oDAAmD;AAI/F,SACEC,wBAAwB,EACxBC,oBAAoB,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AgBE,QAAQ,CAACpB;IAExC,IAAIuB,OAAOC,KAAK,EAAE;QAChB,OAAO;IACT;IAEA,MAAM,EAAEL,MAAM,EAAE,GAAGD;IAEnB,OAAO;QACLO,SAAS;YACP;gBACEC,MAAM;gBACNC,MAAM,CAAC,iBAAiB,EAAErB,OAAO,EAAE,EAAEF,KAAK,GAAG,EAAEmB,OAAOK,YAAY,CAAC,2CAA2C,EAAEC,KAAKC,SAAS,CAACX,QAAQ,QAAQ,CAAC;YAClJ;SACD;QACDY,SAAS;QACTC,mBAAmB;YACjB,CAAC,GAAG1B,OAAO,IAAI,CAAC,CAAC,EAAEF;YACnB6B,QAAQ;gBAAC;oBAAEC,SAASX,OAAOK,YAAY;gBAAC;aAAE;YAC1CT;QACF;IACF;AACF;AAEA,oFAAoF,GACpF,MAAMG,kBAAkB,CAACH;IACvB,MAAM,EAAEgB,UAAUC,SAAS,EAAE,GAAGC,MAAM,GAAGlB;IACzC,OAAOkB;AACT"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { CollectionTool, GlobalTool, Tool } from '../types.js';
|
|
2
|
+
type CollectionBuiltin = {
|
|
3
|
+
mcpName: string;
|
|
4
|
+
requiresDuplicateEnabled?: boolean;
|
|
5
|
+
requiresUpload?: boolean;
|
|
6
|
+
requiresVersions?: boolean;
|
|
7
|
+
tool: CollectionTool;
|
|
8
|
+
};
|
|
9
|
+
type GlobalBuiltin = {
|
|
10
|
+
mcpName: string;
|
|
11
|
+
requiresVersions?: boolean;
|
|
12
|
+
tool: GlobalTool;
|
|
13
|
+
};
|
|
14
|
+
export declare const TOOL_BUILTINS: {
|
|
15
|
+
getConfigInfo: {
|
|
16
|
+
mcpName: string;
|
|
17
|
+
tool: Tool;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The static built-in collection CRUD tools. Keys here are the source of truth
|
|
22
|
+
* for `MCPCollectionBuiltinName` — adding/removing an entry updates the type
|
|
23
|
+
* automatically.
|
|
24
|
+
*/
|
|
25
|
+
export declare const COLLECTION_BUILTINS: {
|
|
26
|
+
count: {
|
|
27
|
+
mcpName: string;
|
|
28
|
+
tool: CollectionTool;
|
|
29
|
+
};
|
|
30
|
+
countVersions: {
|
|
31
|
+
mcpName: string;
|
|
32
|
+
requiresVersions: true;
|
|
33
|
+
tool: CollectionTool;
|
|
34
|
+
};
|
|
35
|
+
create: {
|
|
36
|
+
mcpName: string;
|
|
37
|
+
tool: CollectionTool;
|
|
38
|
+
};
|
|
39
|
+
delete: {
|
|
40
|
+
mcpName: string;
|
|
41
|
+
tool: CollectionTool;
|
|
42
|
+
};
|
|
43
|
+
duplicate: {
|
|
44
|
+
mcpName: string;
|
|
45
|
+
requiresDuplicateEnabled: true;
|
|
46
|
+
tool: CollectionTool;
|
|
47
|
+
};
|
|
48
|
+
find: {
|
|
49
|
+
mcpName: string;
|
|
50
|
+
tool: CollectionTool;
|
|
51
|
+
};
|
|
52
|
+
findDistinct: {
|
|
53
|
+
mcpName: string;
|
|
54
|
+
tool: CollectionTool;
|
|
55
|
+
};
|
|
56
|
+
findVersionByID: {
|
|
57
|
+
mcpName: string;
|
|
58
|
+
requiresVersions: true;
|
|
59
|
+
tool: CollectionTool;
|
|
60
|
+
};
|
|
61
|
+
findVersions: {
|
|
62
|
+
mcpName: string;
|
|
63
|
+
requiresVersions: true;
|
|
64
|
+
tool: CollectionTool;
|
|
65
|
+
};
|
|
66
|
+
getCollectionSchema: {
|
|
67
|
+
mcpName: string;
|
|
68
|
+
tool: CollectionTool;
|
|
69
|
+
};
|
|
70
|
+
getUploadInstructions: {
|
|
71
|
+
mcpName: string;
|
|
72
|
+
requiresUpload: true;
|
|
73
|
+
tool: CollectionTool;
|
|
74
|
+
};
|
|
75
|
+
restoreVersion: {
|
|
76
|
+
mcpName: string;
|
|
77
|
+
requiresVersions: true;
|
|
78
|
+
tool: CollectionTool;
|
|
79
|
+
};
|
|
80
|
+
update: {
|
|
81
|
+
mcpName: string;
|
|
82
|
+
tool: CollectionTool;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The static auth tools surfaced under auth-enabled collections. Keys are the
|
|
87
|
+
* source of truth for `MCPCollectionAuthToolName`.
|
|
88
|
+
*/
|
|
89
|
+
export declare const COLLECTION_AUTH_BUILTINS: {
|
|
90
|
+
auth: {
|
|
91
|
+
mcpName: string;
|
|
92
|
+
tool: CollectionTool;
|
|
93
|
+
};
|
|
94
|
+
forgotPassword: {
|
|
95
|
+
mcpName: string;
|
|
96
|
+
tool: CollectionTool;
|
|
97
|
+
};
|
|
98
|
+
login: {
|
|
99
|
+
mcpName: string;
|
|
100
|
+
tool: CollectionTool;
|
|
101
|
+
};
|
|
102
|
+
resetPassword: {
|
|
103
|
+
mcpName: string;
|
|
104
|
+
tool: CollectionTool;
|
|
105
|
+
};
|
|
106
|
+
unlock: {
|
|
107
|
+
mcpName: string;
|
|
108
|
+
tool: CollectionTool;
|
|
109
|
+
};
|
|
110
|
+
verify: {
|
|
111
|
+
mcpName: string;
|
|
112
|
+
tool: CollectionTool;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The static built-in global tools. Keys are the source of truth for
|
|
117
|
+
* `MCPGlobalBuiltinName`.
|
|
118
|
+
*/
|
|
119
|
+
export declare const GLOBAL_BUILTINS: {
|
|
120
|
+
countGlobalVersions: {
|
|
121
|
+
mcpName: string;
|
|
122
|
+
requiresVersions: true;
|
|
123
|
+
tool: GlobalTool;
|
|
124
|
+
};
|
|
125
|
+
find: {
|
|
126
|
+
mcpName: string;
|
|
127
|
+
tool: GlobalTool;
|
|
128
|
+
};
|
|
129
|
+
findGlobalVersionByID: {
|
|
130
|
+
mcpName: string;
|
|
131
|
+
requiresVersions: true;
|
|
132
|
+
tool: GlobalTool;
|
|
133
|
+
};
|
|
134
|
+
findGlobalVersions: {
|
|
135
|
+
mcpName: string;
|
|
136
|
+
requiresVersions: true;
|
|
137
|
+
tool: GlobalTool;
|
|
138
|
+
};
|
|
139
|
+
getGlobalSchema: {
|
|
140
|
+
mcpName: string;
|
|
141
|
+
tool: GlobalTool;
|
|
142
|
+
};
|
|
143
|
+
restoreGlobalVersion: {
|
|
144
|
+
mcpName: string;
|
|
145
|
+
requiresVersions: true;
|
|
146
|
+
tool: GlobalTool;
|
|
147
|
+
};
|
|
148
|
+
update: {
|
|
149
|
+
mcpName: string;
|
|
150
|
+
tool: GlobalTool;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export type MCPCollectionBuiltinName = keyof typeof COLLECTION_BUILTINS;
|
|
154
|
+
export type MCPCollectionAuthToolName = keyof typeof COLLECTION_AUTH_BUILTINS;
|
|
155
|
+
export type MCPGlobalBuiltinName = keyof typeof GLOBAL_BUILTINS;
|
|
156
|
+
export type MCPTopLevelBuiltinName = keyof typeof TOOL_BUILTINS;
|
|
157
|
+
/**
|
|
158
|
+
* Pre-typed `Object.entries` for each registry. The cast from `string` to the
|
|
159
|
+
* literal key union lives here once so consumers can iterate without their own
|
|
160
|
+
* cast — TypeScript's `Object.entries` always widens keys to `string`, which
|
|
161
|
+
* defeats the narrow type lookups on `MCPCollectionToolsMap`.
|
|
162
|
+
*/
|
|
163
|
+
export declare const TOOL_BUILTIN_ENTRIES: Array<[MCPTopLevelBuiltinName, (typeof TOOL_BUILTINS)[MCPTopLevelBuiltinName]]>;
|
|
164
|
+
export declare const COLLECTION_BUILTIN_ENTRIES: Array<[MCPCollectionBuiltinName, CollectionBuiltin]>;
|
|
165
|
+
export declare const COLLECTION_AUTH_BUILTIN_ENTRIES: Array<[MCPCollectionAuthToolName, (typeof COLLECTION_AUTH_BUILTINS)[MCPCollectionAuthToolName]]>;
|
|
166
|
+
export declare const GLOBAL_BUILTIN_ENTRIES: Array<[MCPGlobalBuiltinName, GlobalBuiltin]>;
|
|
167
|
+
export {};
|
|
168
|
+
//# sourceMappingURL=builtinTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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AAM,MAAM,wBAAwB,GAAG,MAAM,OAAO,mBAAmB,CAAA;AAEvE,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,wBAAwB,CAAA;AAE7E,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,eAAe,CAAA;AAE/D,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,aAAa,CAAA;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAoC,KAAK,CACxE,CAAC,sBAAsB,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,sBAAsB,CAAC,CAAC,CACzE,CAAA;AAED,eAAO,MAAM,0BAA0B,EAA0C,KAAK,CACpF,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAC9C,CAAA;AAED,eAAO,MAAM,+BAA+B,EAA+C,KAAK,CAC9F,CAAC,yBAAyB,EAAE,CAAC,OAAO,wBAAwB,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAC1F,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAsC,KAAK,CAC5E,CAAC,oBAAoB,EAAE,aAAa,CAAC,CACtC,CAAA"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { authCollectionTool, forgotPasswordCollectionTool, loginCollectionTool, resetPasswordCollectionTool, unlockCollectionTool, verifyCollectionTool } from './builtin/collections/authTools.js';
|
|
2
|
+
import { countDocumentsTool } from './builtin/collections/countTool.js';
|
|
3
|
+
import { countVersionsTool } from './builtin/collections/countVersionsTool.js';
|
|
4
|
+
import { createDocumentsTool } from './builtin/collections/createTool.js';
|
|
5
|
+
import { deleteDocumentsTool } from './builtin/collections/deleteTool.js';
|
|
6
|
+
import { duplicateDocumentTool } from './builtin/collections/duplicateTool.js';
|
|
7
|
+
import { findDistinctTool } from './builtin/collections/findDistinctTool.js';
|
|
8
|
+
import { findDocumentsTool } from './builtin/collections/findTool.js';
|
|
9
|
+
import { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js';
|
|
10
|
+
import { findVersionsTool } from './builtin/collections/findVersionsTool.js';
|
|
11
|
+
import { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js';
|
|
12
|
+
import { restoreVersionTool } from './builtin/collections/restoreVersionTool.js';
|
|
13
|
+
import { updateDocumentTool } from './builtin/collections/updateTool.js';
|
|
14
|
+
import { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js';
|
|
15
|
+
import { getConfigInfoTool } from './builtin/getConfigInfoTool.js';
|
|
16
|
+
import { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js';
|
|
17
|
+
import { findGlobalTool } from './builtin/globals/findTool.js';
|
|
18
|
+
import { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js';
|
|
19
|
+
import { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js';
|
|
20
|
+
import { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js';
|
|
21
|
+
import { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js';
|
|
22
|
+
import { updateGlobalTool } from './builtin/globals/updateTool.js';
|
|
23
|
+
export const TOOL_BUILTINS = {
|
|
24
|
+
getConfigInfo: {
|
|
25
|
+
mcpName: 'getConfigInfo',
|
|
26
|
+
tool: getConfigInfoTool
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The static built-in collection CRUD tools. Keys here are the source of truth
|
|
31
|
+
* for `MCPCollectionBuiltinName` — adding/removing an entry updates the type
|
|
32
|
+
* automatically.
|
|
33
|
+
*/ export const COLLECTION_BUILTINS = {
|
|
34
|
+
count: {
|
|
35
|
+
mcpName: 'countDocuments',
|
|
36
|
+
tool: countDocumentsTool
|
|
37
|
+
},
|
|
38
|
+
countVersions: {
|
|
39
|
+
mcpName: 'countVersions',
|
|
40
|
+
requiresVersions: true,
|
|
41
|
+
tool: countVersionsTool
|
|
42
|
+
},
|
|
43
|
+
create: {
|
|
44
|
+
mcpName: 'createDocuments',
|
|
45
|
+
tool: createDocumentsTool
|
|
46
|
+
},
|
|
47
|
+
delete: {
|
|
48
|
+
mcpName: 'deleteDocuments',
|
|
49
|
+
tool: deleteDocumentsTool
|
|
50
|
+
},
|
|
51
|
+
duplicate: {
|
|
52
|
+
mcpName: 'duplicateDocument',
|
|
53
|
+
requiresDuplicateEnabled: true,
|
|
54
|
+
tool: duplicateDocumentTool
|
|
55
|
+
},
|
|
56
|
+
find: {
|
|
57
|
+
mcpName: 'findDocuments',
|
|
58
|
+
tool: findDocumentsTool
|
|
59
|
+
},
|
|
60
|
+
findDistinct: {
|
|
61
|
+
mcpName: 'findDistinct',
|
|
62
|
+
tool: findDistinctTool
|
|
63
|
+
},
|
|
64
|
+
findVersionByID: {
|
|
65
|
+
mcpName: 'findVersionByID',
|
|
66
|
+
requiresVersions: true,
|
|
67
|
+
tool: findVersionByIDTool
|
|
68
|
+
},
|
|
69
|
+
findVersions: {
|
|
70
|
+
mcpName: 'findVersions',
|
|
71
|
+
requiresVersions: true,
|
|
72
|
+
tool: findVersionsTool
|
|
73
|
+
},
|
|
74
|
+
getCollectionSchema: {
|
|
75
|
+
mcpName: 'getCollectionSchema',
|
|
76
|
+
tool: getCollectionSchemaTool
|
|
77
|
+
},
|
|
78
|
+
getUploadInstructions: {
|
|
79
|
+
mcpName: 'getUploadInstructions',
|
|
80
|
+
requiresUpload: true,
|
|
81
|
+
tool: getUploadInstructionsTool
|
|
82
|
+
},
|
|
83
|
+
restoreVersion: {
|
|
84
|
+
mcpName: 'restoreVersion',
|
|
85
|
+
requiresVersions: true,
|
|
86
|
+
tool: restoreVersionTool
|
|
87
|
+
},
|
|
88
|
+
update: {
|
|
89
|
+
mcpName: 'updateDocument',
|
|
90
|
+
tool: updateDocumentTool
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The static auth tools surfaced under auth-enabled collections. Keys are the
|
|
95
|
+
* source of truth for `MCPCollectionAuthToolName`.
|
|
96
|
+
*/ export const COLLECTION_AUTH_BUILTINS = {
|
|
97
|
+
auth: {
|
|
98
|
+
mcpName: 'auth',
|
|
99
|
+
tool: authCollectionTool
|
|
100
|
+
},
|
|
101
|
+
forgotPassword: {
|
|
102
|
+
mcpName: 'forgotPassword',
|
|
103
|
+
tool: forgotPasswordCollectionTool
|
|
104
|
+
},
|
|
105
|
+
login: {
|
|
106
|
+
mcpName: 'login',
|
|
107
|
+
tool: loginCollectionTool
|
|
108
|
+
},
|
|
109
|
+
resetPassword: {
|
|
110
|
+
mcpName: 'resetPassword',
|
|
111
|
+
tool: resetPasswordCollectionTool
|
|
112
|
+
},
|
|
113
|
+
unlock: {
|
|
114
|
+
mcpName: 'unlock',
|
|
115
|
+
tool: unlockCollectionTool
|
|
116
|
+
},
|
|
117
|
+
verify: {
|
|
118
|
+
mcpName: 'verify',
|
|
119
|
+
tool: verifyCollectionTool
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* The static built-in global tools. Keys are the source of truth for
|
|
124
|
+
* `MCPGlobalBuiltinName`.
|
|
125
|
+
*/ export const GLOBAL_BUILTINS = {
|
|
126
|
+
countGlobalVersions: {
|
|
127
|
+
mcpName: 'countGlobalVersions',
|
|
128
|
+
requiresVersions: true,
|
|
129
|
+
tool: countGlobalVersionsTool
|
|
130
|
+
},
|
|
131
|
+
find: {
|
|
132
|
+
mcpName: 'findGlobal',
|
|
133
|
+
tool: findGlobalTool
|
|
134
|
+
},
|
|
135
|
+
findGlobalVersionByID: {
|
|
136
|
+
mcpName: 'findGlobalVersionByID',
|
|
137
|
+
requiresVersions: true,
|
|
138
|
+
tool: findGlobalVersionByIDTool
|
|
139
|
+
},
|
|
140
|
+
findGlobalVersions: {
|
|
141
|
+
mcpName: 'findGlobalVersions',
|
|
142
|
+
requiresVersions: true,
|
|
143
|
+
tool: findGlobalVersionsTool
|
|
144
|
+
},
|
|
145
|
+
getGlobalSchema: {
|
|
146
|
+
mcpName: 'getGlobalSchema',
|
|
147
|
+
tool: getGlobalSchemaTool
|
|
148
|
+
},
|
|
149
|
+
restoreGlobalVersion: {
|
|
150
|
+
mcpName: 'restoreGlobalVersion',
|
|
151
|
+
requiresVersions: true,
|
|
152
|
+
tool: restoreGlobalVersionTool
|
|
153
|
+
},
|
|
154
|
+
update: {
|
|
155
|
+
mcpName: 'updateGlobal',
|
|
156
|
+
tool: updateGlobalTool
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Pre-typed `Object.entries` for each registry. The cast from `string` to the
|
|
161
|
+
* literal key union lives here once so consumers can iterate without their own
|
|
162
|
+
* cast — TypeScript's `Object.entries` always widens keys to `string`, which
|
|
163
|
+
* defeats the narrow type lookups on `MCPCollectionToolsMap`.
|
|
164
|
+
*/ export const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS);
|
|
165
|
+
export const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS);
|
|
166
|
+
export const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS);
|
|
167
|
+
export const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS);
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=builtinTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/builtinTools.ts"],"sourcesContent":["import type { CollectionTool, GlobalTool, Tool } from '../types.js'\n\nimport {\n authCollectionTool,\n forgotPasswordCollectionTool,\n loginCollectionTool,\n resetPasswordCollectionTool,\n unlockCollectionTool,\n verifyCollectionTool,\n} from './builtin/collections/authTools.js'\nimport { countDocumentsTool } from './builtin/collections/countTool.js'\nimport { countVersionsTool } from './builtin/collections/countVersionsTool.js'\nimport { createDocumentsTool } from './builtin/collections/createTool.js'\nimport { deleteDocumentsTool } from './builtin/collections/deleteTool.js'\nimport { duplicateDocumentTool } from './builtin/collections/duplicateTool.js'\nimport { findDistinctTool } from './builtin/collections/findDistinctTool.js'\nimport { findDocumentsTool } from './builtin/collections/findTool.js'\nimport { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js'\nimport { findVersionsTool } from './builtin/collections/findVersionsTool.js'\nimport { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js'\nimport { restoreVersionTool } from './builtin/collections/restoreVersionTool.js'\nimport { updateDocumentTool } from './builtin/collections/updateTool.js'\nimport { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js'\nimport { getConfigInfoTool } from './builtin/getConfigInfoTool.js'\nimport { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js'\nimport { findGlobalTool } from './builtin/globals/findTool.js'\nimport { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js'\nimport { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js'\nimport { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js'\nimport { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js'\nimport { updateGlobalTool } from './builtin/globals/updateTool.js'\n\ntype CollectionBuiltin = {\n mcpName: string\n requiresDuplicateEnabled?: boolean\n requiresUpload?: boolean\n requiresVersions?: boolean\n tool: CollectionTool\n}\n\ntype GlobalBuiltin = {\n mcpName: string\n requiresVersions?: boolean\n tool: GlobalTool\n}\n\nexport const TOOL_BUILTINS = {\n getConfigInfo: { mcpName: 'getConfigInfo', tool: getConfigInfoTool },\n} satisfies Record<string, { mcpName: string; tool: Tool }>\n\n/**\n * The static built-in collection CRUD tools. Keys here are the source of truth\n * for `MCPCollectionBuiltinName` — adding/removing an entry updates the type\n * automatically.\n */\nexport const COLLECTION_BUILTINS = {\n count: { mcpName: 'countDocuments', tool: countDocumentsTool },\n countVersions: { mcpName: 'countVersions', requiresVersions: true, tool: countVersionsTool },\n create: { mcpName: 'createDocuments', tool: createDocumentsTool },\n delete: { mcpName: 'deleteDocuments', tool: deleteDocumentsTool },\n duplicate: {\n mcpName: 'duplicateDocument',\n requiresDuplicateEnabled: true,\n tool: duplicateDocumentTool,\n },\n find: { mcpName: 'findDocuments', tool: findDocumentsTool },\n findDistinct: { mcpName: 'findDistinct', tool: findDistinctTool },\n findVersionByID: {\n mcpName: 'findVersionByID',\n requiresVersions: true,\n tool: findVersionByIDTool,\n },\n findVersions: { mcpName: 'findVersions', requiresVersions: true, tool: findVersionsTool },\n getCollectionSchema: { mcpName: 'getCollectionSchema', tool: getCollectionSchemaTool },\n getUploadInstructions: {\n mcpName: 'getUploadInstructions',\n requiresUpload: true,\n tool: getUploadInstructionsTool,\n },\n restoreVersion: { mcpName: 'restoreVersion', requiresVersions: true, tool: restoreVersionTool },\n update: { mcpName: 'updateDocument', tool: updateDocumentTool },\n} satisfies Record<string, CollectionBuiltin>\n\n/**\n * The static auth tools surfaced under auth-enabled collections. Keys are the\n * source of truth for `MCPCollectionAuthToolName`.\n */\nexport const COLLECTION_AUTH_BUILTINS = {\n auth: { mcpName: 'auth', tool: authCollectionTool },\n forgotPassword: {\n mcpName: 'forgotPassword',\n tool: forgotPasswordCollectionTool,\n },\n login: { mcpName: 'login', tool: loginCollectionTool },\n resetPassword: {\n mcpName: 'resetPassword',\n tool: resetPasswordCollectionTool,\n },\n unlock: { mcpName: 'unlock', tool: unlockCollectionTool },\n verify: { mcpName: 'verify', tool: verifyCollectionTool },\n} satisfies Record<string, { mcpName: string; tool: CollectionTool }>\n\n/**\n * The static built-in global tools. Keys are the source of truth for\n * `MCPGlobalBuiltinName`.\n */\nexport const GLOBAL_BUILTINS = {\n countGlobalVersions: {\n mcpName: 'countGlobalVersions',\n requiresVersions: true,\n tool: countGlobalVersionsTool,\n },\n find: { mcpName: 'findGlobal', tool: findGlobalTool },\n findGlobalVersionByID: {\n mcpName: 'findGlobalVersionByID',\n requiresVersions: true,\n tool: findGlobalVersionByIDTool,\n },\n findGlobalVersions: {\n mcpName: 'findGlobalVersions',\n requiresVersions: true,\n tool: findGlobalVersionsTool,\n },\n getGlobalSchema: { mcpName: 'getGlobalSchema', tool: getGlobalSchemaTool },\n restoreGlobalVersion: {\n mcpName: 'restoreGlobalVersion',\n requiresVersions: true,\n tool: restoreGlobalVersionTool,\n },\n update: { mcpName: 'updateGlobal', tool: updateGlobalTool },\n} satisfies Record<string, GlobalBuiltin>\n\nexport type MCPCollectionBuiltinName = keyof typeof COLLECTION_BUILTINS\n\nexport type MCPCollectionAuthToolName = keyof typeof COLLECTION_AUTH_BUILTINS\n\nexport type MCPGlobalBuiltinName = keyof typeof GLOBAL_BUILTINS\n\nexport type MCPTopLevelBuiltinName = keyof typeof TOOL_BUILTINS\n\n/**\n * Pre-typed `Object.entries` for each registry. The cast from `string` to the\n * literal key union lives here once so consumers can iterate without their own\n * cast — TypeScript's `Object.entries` always widens keys to `string`, which\n * defeats the narrow type lookups on `MCPCollectionToolsMap`.\n */\nexport const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS) as Array<\n [MCPTopLevelBuiltinName, (typeof TOOL_BUILTINS)[MCPTopLevelBuiltinName]]\n>\n\nexport const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS) as Array<\n [MCPCollectionBuiltinName, CollectionBuiltin]\n>\n\nexport const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS) as Array<\n [MCPCollectionAuthToolName, (typeof COLLECTION_AUTH_BUILTINS)[MCPCollectionAuthToolName]]\n>\n\nexport const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS) as Array<\n [MCPGlobalBuiltinName, GlobalBuiltin]\n>\n"],"names":["authCollectionTool","forgotPasswordCollectionTool","loginCollectionTool","resetPasswordCollectionTool","unlockCollectionTool","verifyCollectionTool","countDocumentsTool","countVersionsTool","createDocumentsTool","deleteDocumentsTool","duplicateDocumentTool","findDistinctTool","findDocumentsTool","findVersionByIDTool","findVersionsTool","getCollectionSchemaTool","restoreVersionTool","updateDocumentTool","getUploadInstructionsTool","getConfigInfoTool","countGlobalVersionsTool","findGlobalTool","findGlobalVersionByIDTool","findGlobalVersionsTool","getGlobalSchemaTool","restoreGlobalVersionTool","updateGlobalTool","TOOL_BUILTINS","getConfigInfo","mcpName","tool","COLLECTION_BUILTINS","count","countVersions","requiresVersions","create","delete","duplicate","requiresDuplicateEnabled","find","findDistinct","findVersionByID","findVersions","getCollectionSchema","getUploadInstructions","requiresUpload","restoreVersion","update","COLLECTION_AUTH_BUILTINS","auth","forgotPassword","login","resetPassword","unlock","verify","GLOBAL_BUILTINS","countGlobalVersions","findGlobalVersionByID","findGlobalVersions","getGlobalSchema","restoreGlobalVersion","TOOL_BUILTIN_ENTRIES","Object","entries","COLLECTION_BUILTIN_ENTRIES","COLLECTION_AUTH_BUILTIN_ENTRIES","GLOBAL_BUILTIN_ENTRIES"],"mappings":"AAEA,SACEA,kBAAkB,EAClBC,4BAA4B,EAC5BC,mBAAmB,EACnBC,2BAA2B,EAC3BC,oBAAoB,EACpBC,oBAAoB,QACf,qCAAoC;AAC3C,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,iBAAiB,QAAQ,6CAA4C;AAC9E,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,qBAAqB,QAAQ,yCAAwC;AAC9E,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,mBAAmB,QAAQ,+CAA8C;AAClF,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,uBAAuB,QAAQ,mDAAkD;AAC1F,SAASC,kBAAkB,QAAQ,8CAA6C;AAChF,SAASC,kBAAkB,QAAQ,sCAAqC;AACxE,SAASC,yBAAyB,QAAQ,kDAAiD;AAC3F,SAASC,iBAAiB,QAAQ,iCAAgC;AAClE,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,sBAAsB,QAAQ,wCA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DkD,eAAe;QACbvB,SAAS;QACTC,MAAM3B;IACR;IACAkD,QAAQ;QAAExB,SAAS;QAAUC,MAAM1B;IAAqB;IACxDkD,QAAQ;QAAEzB,SAAS;QAAUC,MAAMzB;IAAqB;AAC1D,EAAqE;AAErE;;;CAGC,GACD,OAAO,MAAMkD,kBAAkB;IAC7BC,qBAAqB;QACnB3B,SAAS;QACTK,kBAAkB;QAClBJ,MAAMV;IACR;IACAmB,MAAM;QAAEV,SAAS;QAAcC,MAAMT;IAAe;IACpDoC,uBAAuB;QACrB5B,SAAS;QACTK,kBAAkB;QAClBJ,MAAMR;IACR;IACAoC,oBAAoB;QAClB7B,SAAS;QACTK,kBAAkB;QAClBJ,MAAMP;IACR;IACAoC,iBAAiB;QAAE9B,SAAS;QAAmBC,MAAMN;IAAoB;IACzEoC,sBAAsB;QACpB/B,SAAS;QACTK,kBAAkB;QAClBJ,MAAML;IACR;IACAsB,QAAQ;QAAElB,SAAS;QAAgBC,MAAMJ;IAAiB;AAC5D,EAAyC;AAUzC;;;;;CAKC,GACD,OAAO,MAAMmC,uBAAuBC,OAAOC,OAAO,CAACpC,eAElD;AAED,OAAO,MAAMqC,6BAA6BF,OAAOC,OAAO,CAAChC,qBAExD;AAED,OAAO,MAAMkC,kCAAkCH,OAAOC,OAAO,CAACf,0BAE7D;AAED,OAAO,MAAMkB,yBAAyBJ,OAAOC,OAAO,CAACR,iBAEpD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Config, SanitizedConfig } from 'payload';
|
|
2
|
+
import type { MCPPluginConfig, SanitizedMCPPluginConfig } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Converts the user-configured `MCPPluginConfig` into a `SanitizedMCPPluginConfig`:
|
|
5
|
+
* - Flattens `tools` / `prompts` / `resources` / per-collection / per-global
|
|
6
|
+
* tool maps into a single `items` array.
|
|
7
|
+
* - Applies built-in tools for collections and globals, respecting opt-out user overrides.
|
|
8
|
+
*
|
|
9
|
+
* Called once during plugin init. After that, `plugins['@payloadcms/plugin-mcp']
|
|
10
|
+
* ?.options` holds the sanitized result
|
|
11
|
+
*/
|
|
12
|
+
export declare const sanitizeMCPConfig: ({ config, pluginConfig, }: {
|
|
13
|
+
config: Config | SanitizedConfig;
|
|
14
|
+
pluginConfig: MCPPluginConfig;
|
|
15
|
+
}) => SanitizedMCPPluginConfig;
|
|
16
|
+
//# sourceMappingURL=sanitizeMCPConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizeMCPConfig.d.ts","sourceRoot":"","sources":["../../src/mcp/sanitizeMCPConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,MAAM,EAGN,eAAe,EAEhB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAMV,eAAe,EACf,wBAAwB,EACzB,MAAM,aAAa,CAAA;AAcpB;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,8BAG3B;IACD,MAAM,EAAE,MAAM,GAAG,eAAe,CAAA;IAChC,YAAY,EAAE,eAAe,CAAA;CAC9B,KAAG,wBA6DH,CAAA"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { defaultAccess } from '../defaultAccess.js';
|
|
2
|
+
import { COLLECTION_AUTH_BUILTIN_ENTRIES, COLLECTION_AUTH_BUILTINS, COLLECTION_BUILTIN_ENTRIES, COLLECTION_BUILTINS, GLOBAL_BUILTIN_ENTRIES, GLOBAL_BUILTINS, TOOL_BUILTIN_ENTRIES, TOOL_BUILTINS } from './builtinTools.js';
|
|
3
|
+
/**
|
|
4
|
+
* Converts the user-configured `MCPPluginConfig` into a `SanitizedMCPPluginConfig`:
|
|
5
|
+
* - Flattens `tools` / `prompts` / `resources` / per-collection / per-global
|
|
6
|
+
* tool maps into a single `items` array.
|
|
7
|
+
* - Applies built-in tools for collections and globals, respecting opt-out user overrides.
|
|
8
|
+
*
|
|
9
|
+
* Called once during plugin init. After that, `plugins['@payloadcms/plugin-mcp']
|
|
10
|
+
* ?.options` holds the sanitized result
|
|
11
|
+
*/ export const sanitizeMCPConfig = ({ config, pluginConfig })=>{
|
|
12
|
+
const items = [];
|
|
13
|
+
for (const collection of config.collections ?? []){
|
|
14
|
+
items.push(...sanitizeCollectionConfig({
|
|
15
|
+
collection,
|
|
16
|
+
pluginConfig
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
for (const global of config.globals ?? []){
|
|
20
|
+
items.push(...sanitizeGlobalConfig({
|
|
21
|
+
global,
|
|
22
|
+
pluginConfig
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
for (const [configKey, { mcpName, tool }] of TOOL_BUILTIN_ENTRIES){
|
|
26
|
+
items.push({
|
|
27
|
+
type: 'tool',
|
|
28
|
+
configKey,
|
|
29
|
+
label: tool.annotations?.title ?? configKey,
|
|
30
|
+
mcpName,
|
|
31
|
+
tool: {
|
|
32
|
+
...tool,
|
|
33
|
+
access: tool.access ?? defaultAccess
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
for (const [configKey, tool] of Object.entries(pluginConfig.tools ?? {})){
|
|
38
|
+
if (configKey in TOOL_BUILTINS) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
items.push({
|
|
42
|
+
type: 'tool',
|
|
43
|
+
configKey,
|
|
44
|
+
label: tool.annotations?.title ?? configKey,
|
|
45
|
+
mcpName: configKey,
|
|
46
|
+
tool: {
|
|
47
|
+
...tool,
|
|
48
|
+
access: tool.access ?? defaultAccess
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
for (const [configKey, prompt] of Object.entries(pluginConfig.prompts ?? {})){
|
|
53
|
+
items.push({
|
|
54
|
+
type: 'prompt',
|
|
55
|
+
configKey,
|
|
56
|
+
label: prompt.title ?? configKey,
|
|
57
|
+
mcpName: configKey,
|
|
58
|
+
prompt: {
|
|
59
|
+
...prompt,
|
|
60
|
+
access: prompt.access ?? defaultAccess
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
for (const [configKey, resource] of Object.entries(pluginConfig.resources ?? {})){
|
|
65
|
+
items.push({
|
|
66
|
+
type: 'resource',
|
|
67
|
+
configKey,
|
|
68
|
+
label: resource.title ?? configKey,
|
|
69
|
+
mcpName: configKey,
|
|
70
|
+
resource: {
|
|
71
|
+
...resource,
|
|
72
|
+
access: resource.access ?? defaultAccess
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
disabled: pluginConfig.disabled,
|
|
78
|
+
hooks: pluginConfig.hooks,
|
|
79
|
+
items,
|
|
80
|
+
mcp: pluginConfig.mcp,
|
|
81
|
+
overrideGetAuthorizedMCP: pluginConfig.overrideGetAuthorizedMCP
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const sanitizeCollectionConfig = ({ collection, pluginConfig })=>{
|
|
85
|
+
const slug = collection.slug;
|
|
86
|
+
const collectionPluginConfig = pluginConfig.collections?.[slug];
|
|
87
|
+
const items = [];
|
|
88
|
+
/**
|
|
89
|
+
* Payload disables duplicate for auth collections by default unless the
|
|
90
|
+
* collection explicitly opts back in with `disableDuplicate: false`.
|
|
91
|
+
*/ const isDuplicateDisabled = collection.disableDuplicate === true || Boolean(collection.auth) && collection.disableDuplicate !== false;
|
|
92
|
+
for (const [toolKey, { mcpName, requiresDuplicateEnabled, requiresUpload, requiresVersions, tool }] of COLLECTION_BUILTIN_ENTRIES){
|
|
93
|
+
if (requiresVersions && !collection.versions) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (requiresDuplicateEnabled && isDuplicateDisabled) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (requiresUpload && !collection.upload) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const matchedConfigEntry = collectionPluginConfig?.tools?.[toolKey];
|
|
103
|
+
if (matchedConfigEntry === false) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined;
|
|
107
|
+
const annotations = {
|
|
108
|
+
...tool.annotations,
|
|
109
|
+
...override?.annotations
|
|
110
|
+
};
|
|
111
|
+
items.push({
|
|
112
|
+
type: 'collectionTool',
|
|
113
|
+
collectionSlug: slug,
|
|
114
|
+
configKey: toolKey,
|
|
115
|
+
label: annotations.title ?? toolKey,
|
|
116
|
+
mcpName,
|
|
117
|
+
tool: {
|
|
118
|
+
...tool,
|
|
119
|
+
access: override?.access ?? tool.access ?? defaultAccess,
|
|
120
|
+
annotations,
|
|
121
|
+
description: override?.description ?? tool.description,
|
|
122
|
+
overrideResponse: override?.overrideResponse ?? collectionPluginConfig?.overrideResponse ?? tool.overrideResponse
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (collection.auth) {
|
|
127
|
+
for (const [authToolKey, { mcpName, tool }] of COLLECTION_AUTH_BUILTIN_ENTRIES){
|
|
128
|
+
const matchedConfigEntry = collectionPluginConfig?.tools?.[authToolKey];
|
|
129
|
+
if (!matchedConfigEntry) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
// `true` means "enable, no override"; only the object form carries fields.
|
|
133
|
+
const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined;
|
|
134
|
+
const annotations = {
|
|
135
|
+
...tool.annotations,
|
|
136
|
+
...override?.annotations
|
|
137
|
+
};
|
|
138
|
+
items.push({
|
|
139
|
+
type: 'collectionTool',
|
|
140
|
+
collectionSlug: slug,
|
|
141
|
+
configKey: authToolKey,
|
|
142
|
+
label: annotations.title ?? authToolKey,
|
|
143
|
+
mcpName,
|
|
144
|
+
tool: {
|
|
145
|
+
...tool,
|
|
146
|
+
access: override?.access ?? tool.access ?? defaultAccess,
|
|
147
|
+
annotations,
|
|
148
|
+
description: override?.description ?? tool.description,
|
|
149
|
+
overrideResponse: override?.overrideResponse ?? collectionPluginConfig?.overrideResponse ?? tool.overrideResponse
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Cast: builtin keys are filtered out below, so the remaining values are
|
|
155
|
+
// always custom tools (`CollectionTool`) or undefined
|
|
156
|
+
const customEntries = Object.entries(collectionPluginConfig?.tools ?? {});
|
|
157
|
+
for (const [configKey, customTool] of customEntries){
|
|
158
|
+
if (configKey in COLLECTION_BUILTINS || configKey in COLLECTION_AUTH_BUILTINS) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (!customTool) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
items.push({
|
|
165
|
+
type: 'collectionTool',
|
|
166
|
+
collectionSlug: slug,
|
|
167
|
+
configKey,
|
|
168
|
+
label: customTool.annotations?.title ?? configKey,
|
|
169
|
+
mcpName: configKey,
|
|
170
|
+
tool: {
|
|
171
|
+
...customTool,
|
|
172
|
+
access: customTool.access ?? defaultAccess
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return items;
|
|
177
|
+
};
|
|
178
|
+
const sanitizeGlobalConfig = ({ global, pluginConfig })=>{
|
|
179
|
+
const slug = global.slug;
|
|
180
|
+
const globalPluginConfig = pluginConfig.globals?.[slug];
|
|
181
|
+
const items = [];
|
|
182
|
+
for (const [toolKey, { mcpName, requiresVersions, tool }] of GLOBAL_BUILTIN_ENTRIES){
|
|
183
|
+
if (requiresVersions && !global.versions) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const matchedConfigEntry = globalPluginConfig?.tools?.[toolKey];
|
|
187
|
+
if (matchedConfigEntry === false) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined;
|
|
191
|
+
const annotations = {
|
|
192
|
+
...tool.annotations,
|
|
193
|
+
...override?.annotations
|
|
194
|
+
};
|
|
195
|
+
items.push({
|
|
196
|
+
type: 'globalTool',
|
|
197
|
+
configKey: toolKey,
|
|
198
|
+
globalSlug: slug,
|
|
199
|
+
label: annotations.title ?? toolKey,
|
|
200
|
+
mcpName,
|
|
201
|
+
tool: {
|
|
202
|
+
...tool,
|
|
203
|
+
access: override?.access ?? tool.access ?? defaultAccess,
|
|
204
|
+
annotations,
|
|
205
|
+
description: override?.description ?? tool.description,
|
|
206
|
+
overrideResponse: override?.overrideResponse ?? globalPluginConfig?.overrideResponse ?? tool.overrideResponse
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const customEntries = Object.entries(globalPluginConfig?.tools ?? {});
|
|
211
|
+
for (const [configKey, customTool] of customEntries){
|
|
212
|
+
if (configKey in GLOBAL_BUILTINS) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (!customTool) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
items.push({
|
|
219
|
+
type: 'globalTool',
|
|
220
|
+
configKey,
|
|
221
|
+
globalSlug: slug,
|
|
222
|
+
label: customTool.annotations?.title ?? configKey,
|
|
223
|
+
mcpName: configKey,
|
|
224
|
+
tool: {
|
|
225
|
+
...customTool,
|
|
226
|
+
access: customTool.access ?? defaultAccess
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return items;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=sanitizeMCPConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/sanitizeMCPConfig.ts"],"sourcesContent":["import type {\n CollectionConfig,\n Config,\n GlobalConfig,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport type {\n CollectionMCPItem,\n CollectionTool,\n GlobalMCPItem,\n GlobalTool,\n MCPItem,\n MCPPluginConfig,\n SanitizedMCPPluginConfig,\n} from '../types.js'\n\nimport { defaultAccess } from '../defaultAccess.js'\nimport {\n COLLECTION_AUTH_BUILTIN_ENTRIES,\n COLLECTION_AUTH_BUILTINS,\n COLLECTION_BUILTIN_ENTRIES,\n COLLECTION_BUILTINS,\n GLOBAL_BUILTIN_ENTRIES,\n GLOBAL_BUILTINS,\n TOOL_BUILTIN_ENTRIES,\n TOOL_BUILTINS,\n} from './builtinTools.js'\n\n/**\n * Converts the user-configured `MCPPluginConfig` into a `SanitizedMCPPluginConfig`:\n * - Flattens `tools` / `prompts` / `resources` / per-collection / per-global\n * tool maps into a single `items` array.\n * - Applies built-in tools for collections and globals, respecting opt-out user overrides.\n *\n * Called once during plugin init. After that, `plugins['@payloadcms/plugin-mcp']\n * ?.options` holds the sanitized result\n */\nexport const sanitizeMCPConfig = ({\n config,\n pluginConfig,\n}: {\n config: Config | SanitizedConfig\n pluginConfig: MCPPluginConfig\n}): SanitizedMCPPluginConfig => {\n const items: MCPItem[] = []\n\n for (const collection of config.collections ?? []) {\n items.push(...sanitizeCollectionConfig({ collection, pluginConfig }))\n }\n\n for (const global of config.globals ?? []) {\n items.push(...sanitizeGlobalConfig({ global, pluginConfig }))\n }\n\n for (const [configKey, { mcpName, tool }] of TOOL_BUILTIN_ENTRIES) {\n items.push({\n type: 'tool',\n configKey,\n label: tool.annotations?.title ?? configKey,\n mcpName,\n tool: { ...tool, access: tool.access ?? defaultAccess },\n })\n }\n\n for (const [configKey, tool] of Object.entries(pluginConfig.tools ?? {})) {\n if (configKey in TOOL_BUILTINS) {\n continue\n }\n items.push({\n type: 'tool',\n configKey,\n label: tool.annotations?.title ?? configKey,\n mcpName: configKey,\n tool: { ...tool, access: tool.access ?? defaultAccess },\n })\n }\n\n for (const [configKey, prompt] of Object.entries(pluginConfig.prompts ?? {})) {\n items.push({\n type: 'prompt',\n configKey,\n label: prompt.title ?? configKey,\n mcpName: configKey,\n prompt: { ...prompt, access: prompt.access ?? defaultAccess },\n })\n }\n\n for (const [configKey, resource] of Object.entries(pluginConfig.resources ?? {})) {\n items.push({\n type: 'resource',\n configKey,\n label: resource.title ?? configKey,\n mcpName: configKey,\n resource: { ...resource, access: resource.access ?? defaultAccess },\n })\n }\n\n return {\n disabled: pluginConfig.disabled,\n hooks: pluginConfig.hooks,\n items,\n mcp: pluginConfig.mcp,\n overrideGetAuthorizedMCP: pluginConfig.overrideGetAuthorizedMCP,\n }\n}\n\nconst sanitizeCollectionConfig = ({\n collection,\n pluginConfig,\n}: {\n collection: CollectionConfig | SanitizedCollectionConfig\n pluginConfig: MCPPluginConfig\n}): CollectionMCPItem[] => {\n const slug = collection.slug\n const collectionPluginConfig = pluginConfig.collections?.[slug]\n const items: CollectionMCPItem[] = []\n /**\n * Payload disables duplicate for auth collections by default unless the\n * collection explicitly opts back in with `disableDuplicate: false`.\n */\n const isDuplicateDisabled =\n collection.disableDuplicate === true ||\n (Boolean(collection.auth) && collection.disableDuplicate !== false)\n\n for (const [\n toolKey,\n { mcpName, requiresDuplicateEnabled, requiresUpload, requiresVersions, tool },\n ] of COLLECTION_BUILTIN_ENTRIES) {\n if (requiresVersions && !collection.versions) {\n continue\n }\n if (requiresDuplicateEnabled && isDuplicateDisabled) {\n continue\n }\n if (requiresUpload && !collection.upload) {\n continue\n }\n const matchedConfigEntry = collectionPluginConfig?.tools?.[toolKey]\n if (matchedConfigEntry === false) {\n continue\n }\n const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined\n const annotations = { ...tool.annotations, ...override?.annotations }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n configKey: toolKey,\n label: annotations.title ?? toolKey,\n mcpName,\n tool: {\n ...tool,\n access: override?.access ?? tool.access ?? defaultAccess,\n annotations,\n description: override?.description ?? tool.description,\n overrideResponse:\n override?.overrideResponse ??\n collectionPluginConfig?.overrideResponse ??\n tool.overrideResponse,\n },\n })\n }\n\n if (collection.auth) {\n for (const [authToolKey, { mcpName, tool }] of COLLECTION_AUTH_BUILTIN_ENTRIES) {\n const matchedConfigEntry = collectionPluginConfig?.tools?.[authToolKey]\n if (!matchedConfigEntry) {\n continue\n }\n // `true` means \"enable, no override\"; only the object form carries fields.\n const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined\n const annotations = { ...tool.annotations, ...override?.annotations }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n configKey: authToolKey,\n label: annotations.title ?? authToolKey,\n mcpName,\n tool: {\n ...tool,\n access: override?.access ?? tool.access ?? defaultAccess,\n annotations,\n description: override?.description ?? tool.description,\n overrideResponse:\n override?.overrideResponse ??\n collectionPluginConfig?.overrideResponse ??\n tool.overrideResponse,\n },\n })\n }\n }\n\n // Cast: builtin keys are filtered out below, so the remaining values are\n // always custom tools (`CollectionTool`) or undefined\n const customEntries = Object.entries(collectionPluginConfig?.tools ?? {}) as Array<\n [string, CollectionTool | undefined]\n >\n for (const [configKey, customTool] of customEntries) {\n if (configKey in COLLECTION_BUILTINS || configKey in COLLECTION_AUTH_BUILTINS) {\n continue\n }\n if (!customTool) {\n continue\n }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n configKey,\n label: customTool.annotations?.title ?? configKey,\n mcpName: configKey,\n tool: { ...customTool, access: customTool.access ?? defaultAccess },\n })\n }\n\n return items\n}\n\nconst sanitizeGlobalConfig = ({\n global,\n pluginConfig,\n}: {\n global: GlobalConfig | SanitizedGlobalConfig\n pluginConfig: MCPPluginConfig\n}): GlobalMCPItem[] => {\n const slug = global.slug\n const globalPluginConfig = pluginConfig.globals?.[slug]\n const items: GlobalMCPItem[] = []\n\n for (const [toolKey, { mcpName, requiresVersions, tool }] of GLOBAL_BUILTIN_ENTRIES) {\n if (requiresVersions && !global.versions) {\n continue\n }\n const matchedConfigEntry = globalPluginConfig?.tools?.[toolKey]\n if (matchedConfigEntry === false) {\n continue\n }\n const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined\n const annotations = { ...tool.annotations, ...override?.annotations }\n items.push({\n type: 'globalTool',\n configKey: toolKey,\n globalSlug: slug,\n label: annotations.title ?? toolKey,\n mcpName,\n tool: {\n ...tool,\n access: override?.access ?? tool.access ?? defaultAccess,\n annotations,\n description: override?.description ?? tool.description,\n overrideResponse:\n override?.overrideResponse ??\n globalPluginConfig?.overrideResponse ??\n tool.overrideResponse,\n },\n })\n }\n\n const customEntries = Object.entries(globalPluginConfig?.tools ?? {}) as Array<\n [string, GlobalTool | undefined]\n >\n for (const [configKey, customTool] of customEntries) {\n if (configKey in GLOBAL_BUILTINS) {\n continue\n }\n if (!customTool) {\n continue\n }\n items.push({\n type: 'globalTool',\n configKey,\n globalSlug: slug,\n label: customTool.annotations?.title ?? configKey,\n mcpName: configKey,\n tool: { ...customTool, access: customTool.access ?? defaultAccess },\n })\n }\n\n return items\n}\n"],"names":["defaultAccess","COLLECTION_AUTH_BUILTIN_ENTRIES","COLLECTION_AUTH_BUILTINS","COLLECTION_BUILTIN_ENTRIES","COLLECTION_BUILTINS","GLOBAL_BUILTIN_ENTRIES","GLOBAL_BUILTINS","TOOL_BUILTIN_ENTRIES","TOOL_BUILTINS","sanitizeMCPConfig","config","pluginConfig","items","collection","collections","push","sanitizeCollectionConfig","global","globals","sanitizeGlobalConfig","configKey","mcpName","tool","type","label","annotations","title","access","Object","entries","tools","prompt","prompts","resource","resources","disabled","hooks","mcp","overrideGetAuthorizedMCP","slug","collectionPluginConfig","isDuplicateDisabled","disableDuplicate","Boolean","auth","toolKey","requiresDuplicateEnabled","requiresUpload","requiresVersions","versions","upload","matchedConfigEntry","override","undefined","collectionSlug","description","overrideResponse","authToolKey","customEntries","customTool","globalPluginConfig","globalSlug"],"mappings":"AAmBA,SAASA,aAAa,QAAQ,sBAAqB;AACnD,SACEC,+BAA+B,EAC/BC,wBAAwB,EACxBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,sBAAsB,EACtBC,eAAe,EACfC,oBAAoB,EACpBC,aAAa,QACR,oBAAmB;AAE1B;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,MAAM,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