@payloadcms/plugin-mcp 4.0.0-internal.d28e9fb → 4.0.0-internal.d3909a9
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 +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 +116 -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 +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 +111 -0
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.js +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 +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 +128 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +263 -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/toStandardSchema.d.ts +5 -0
- package/dist/utils/toStandardSchema.d.ts.map +1 -0
- package/dist/utils/toStandardSchema.js +4 -0
- package/dist/utils/toStandardSchema.js.map +1 -0
- package/package.json +41 -26
- package/src/defaultAccess.ts +3 -0
- package/src/defineTool.ts +44 -0
- package/src/endpoint/access.ts +111 -0
- package/src/endpoint/index.ts +107 -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 +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 +97 -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 +281 -0
- package/src/stdio.ts +131 -0
- package/src/types.ts +312 -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/toStandardSchema.ts +9 -0
- package/dist/collections/createApiKeysCollection.d.ts +0 -7
- package/dist/collections/createApiKeysCollection.d.ts.map +0 -1
- package/dist/collections/createApiKeysCollection.js +0 -317
- package/dist/collections/createApiKeysCollection.js.map +0 -1
- package/dist/defaults.d.ts +0 -4
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js +0 -5
- package/dist/defaults.js.map +0 -1
- package/dist/endpoints/mcp.d.ts +0 -4
- package/dist/endpoints/mcp.d.ts.map +0 -1
- package/dist/endpoints/mcp.js +0 -71
- package/dist/endpoints/mcp.js.map +0 -1
- package/dist/mcp/createRequest.d.ts +0 -3
- package/dist/mcp/createRequest.d.ts.map +0 -1
- package/dist/mcp/createRequest.js +0 -14
- package/dist/mcp/createRequest.js.map +0 -1
- package/dist/mcp/getMcpHandler.d.ts +0 -4
- package/dist/mcp/getMcpHandler.d.ts.map +0 -1
- package/dist/mcp/getMcpHandler.js +0 -231
- package/dist/mcp/getMcpHandler.js.map +0 -1
- package/dist/mcp/helpers/config.d.ts +0 -22
- package/dist/mcp/helpers/config.d.ts.map +0 -1
- package/dist/mcp/helpers/config.js +0 -153
- package/dist/mcp/helpers/config.js.map +0 -1
- package/dist/mcp/helpers/fields.d.ts +0 -19
- package/dist/mcp/helpers/fields.d.ts.map +0 -1
- package/dist/mcp/helpers/fields.js +0 -102
- package/dist/mcp/helpers/fields.js.map +0 -1
- package/dist/mcp/helpers/fileValidation.d.ts +0 -67
- package/dist/mcp/helpers/fileValidation.d.ts.map +0 -1
- package/dist/mcp/helpers/fileValidation.js +0 -267
- package/dist/mcp/helpers/fileValidation.js.map +0 -1
- package/dist/mcp/registerTool.d.ts +0 -6
- package/dist/mcp/registerTool.d.ts.map +0 -1
- package/dist/mcp/registerTool.js +0 -18
- package/dist/mcp/registerTool.js.map +0 -1
- package/dist/mcp/tools/auth/auth.d.ts +0 -4
- package/dist/mcp/tools/auth/auth.d.ts.map +0 -1
- package/dist/mcp/tools/auth/auth.js +0 -57
- package/dist/mcp/tools/auth/auth.js.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/forgotPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.js +0 -48
- package/dist/mcp/tools/auth/forgotPassword.js.map +0 -1
- package/dist/mcp/tools/auth/login.d.ts +0 -4
- package/dist/mcp/tools/auth/login.d.ts.map +0 -1
- package/dist/mcp/tools/auth/login.js +0 -51
- package/dist/mcp/tools/auth/login.js.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/resetPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.js +0 -49
- package/dist/mcp/tools/auth/resetPassword.js.map +0 -1
- package/dist/mcp/tools/auth/unlock.d.ts +0 -4
- package/dist/mcp/tools/auth/unlock.d.ts.map +0 -1
- package/dist/mcp/tools/auth/unlock.js +0 -48
- package/dist/mcp/tools/auth/unlock.js.map +0 -1
- package/dist/mcp/tools/auth/verify.d.ts +0 -4
- package/dist/mcp/tools/auth/verify.d.ts.map +0 -1
- package/dist/mcp/tools/auth/verify.js +0 -45
- package/dist/mcp/tools/auth/verify.js.map +0 -1
- package/dist/mcp/tools/collection/create.d.ts +0 -10
- package/dist/mcp/tools/collection/create.d.ts.map +0 -1
- package/dist/mcp/tools/collection/create.js +0 -139
- package/dist/mcp/tools/collection/create.js.map +0 -1
- package/dist/mcp/tools/collection/delete.d.ts +0 -10
- package/dist/mcp/tools/collection/delete.d.ts.map +0 -1
- package/dist/mcp/tools/collection/delete.js +0 -154
- package/dist/mcp/tools/collection/delete.js.map +0 -1
- package/dist/mcp/tools/collection/find.d.ts +0 -10
- package/dist/mcp/tools/collection/find.d.ts.map +0 -1
- package/dist/mcp/tools/collection/find.js +0 -165
- package/dist/mcp/tools/collection/find.js.map +0 -1
- package/dist/mcp/tools/collection/update.d.ts +0 -10
- package/dist/mcp/tools/collection/update.d.ts.map +0 -1
- package/dist/mcp/tools/collection/update.js +0 -209
- package/dist/mcp/tools/collection/update.js.map +0 -1
- package/dist/mcp/tools/config/find.d.ts +0 -10
- package/dist/mcp/tools/config/find.d.ts.map +0 -1
- package/dist/mcp/tools/config/find.js +0 -97
- package/dist/mcp/tools/config/find.js.map +0 -1
- package/dist/mcp/tools/config/update.d.ts +0 -10
- package/dist/mcp/tools/config/update.d.ts.map +0 -1
- package/dist/mcp/tools/config/update.js +0 -215
- package/dist/mcp/tools/config/update.js.map +0 -1
- package/dist/mcp/tools/global/find.d.ts +0 -5
- package/dist/mcp/tools/global/find.d.ts.map +0 -1
- package/dist/mcp/tools/global/find.js +0 -82
- package/dist/mcp/tools/global/find.js.map +0 -1
- package/dist/mcp/tools/global/update.d.ts +0 -6
- package/dist/mcp/tools/global/update.d.ts.map +0 -1
- package/dist/mcp/tools/global/update.js +0 -124
- package/dist/mcp/tools/global/update.js.map +0 -1
- package/dist/mcp/tools/job/create.d.ts +0 -10
- package/dist/mcp/tools/job/create.d.ts.map +0 -1
- package/dist/mcp/tools/job/create.js +0 -293
- package/dist/mcp/tools/job/create.js.map +0 -1
- package/dist/mcp/tools/job/run.d.ts +0 -10
- package/dist/mcp/tools/job/run.d.ts.map +0 -1
- package/dist/mcp/tools/job/run.js +0 -129
- package/dist/mcp/tools/job/run.js.map +0 -1
- package/dist/mcp/tools/job/update.d.ts +0 -11
- package/dist/mcp/tools/job/update.d.ts.map +0 -1
- package/dist/mcp/tools/job/update.js +0 -186
- package/dist/mcp/tools/job/update.js.map +0 -1
- package/dist/mcp/tools/resource/create.d.ts +0 -6
- package/dist/mcp/tools/resource/create.d.ts.map +0 -1
- package/dist/mcp/tools/resource/create.js +0 -124
- package/dist/mcp/tools/resource/create.js.map +0 -1
- package/dist/mcp/tools/resource/delete.d.ts +0 -5
- package/dist/mcp/tools/resource/delete.d.ts.map +0 -1
- package/dist/mcp/tools/resource/delete.js +0 -151
- package/dist/mcp/tools/resource/delete.js.map +0 -1
- package/dist/mcp/tools/resource/find.d.ts +0 -5
- package/dist/mcp/tools/resource/find.d.ts.map +0 -1
- package/dist/mcp/tools/resource/find.js +0 -170
- package/dist/mcp/tools/resource/find.js.map +0 -1
- package/dist/mcp/tools/resource/update.d.ts +0 -6
- package/dist/mcp/tools/resource/update.d.ts.map +0 -1
- package/dist/mcp/tools/resource/update.js +0 -256
- package/dist/mcp/tools/resource/update.js.map +0 -1
- package/dist/mcp/tools/schemas.d.ts +0 -457
- package/dist/mcp/tools/schemas.d.ts.map +0 -1
- package/dist/mcp/tools/schemas.js +0 -243
- package/dist/mcp/tools/schemas.js.map +0 -1
- package/dist/utils/adminEntitySettings.d.ts +0 -17
- package/dist/utils/adminEntitySettings.d.ts.map +0 -1
- package/dist/utils/adminEntitySettings.js +0 -41
- package/dist/utils/adminEntitySettings.js.map +0 -1
- package/dist/utils/createApiKeyFields.d.ts +0 -15
- package/dist/utils/createApiKeyFields.d.ts.map +0 -1
- package/dist/utils/createApiKeyFields.js +0 -57
- package/dist/utils/createApiKeyFields.js.map +0 -1
- package/dist/utils/getEnabledSlugs.d.ts +0 -13
- package/dist/utils/getEnabledSlugs.d.ts.map +0 -1
- package/dist/utils/getEnabledSlugs.js +0 -32
- package/dist/utils/getEnabledSlugs.js.map +0 -1
- package/dist/utils/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,64 @@
|
|
|
1
|
+
import { findGlobalVersionByIDInputSchema } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
4
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
5
|
+
import { getLogger } from '../../../utils/getLogger.js'
|
|
6
|
+
|
|
7
|
+
const DEFAULT_DESCRIPTION =
|
|
8
|
+
'Find a specific global version in any version-enabled global by passing the global slug and version ID.'
|
|
9
|
+
|
|
10
|
+
export const findGlobalVersionByIDTool = defineGlobalTool({
|
|
11
|
+
access: (args) =>
|
|
12
|
+
defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.readVersions),
|
|
13
|
+
annotations: {
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
idempotentHint: true,
|
|
16
|
+
openWorldHint: false,
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
title: 'Find Global Version By ID',
|
|
19
|
+
},
|
|
20
|
+
description: DEFAULT_DESCRIPTION,
|
|
21
|
+
input: findGlobalVersionByIDInputSchema,
|
|
22
|
+
}).handler(async ({ slug, authorizedMCP, input, req }) => {
|
|
23
|
+
const payload = req.payload
|
|
24
|
+
const logger = getLogger({ payload })
|
|
25
|
+
const { id, depth, fallbackLocale, locale, populate, select } = input
|
|
26
|
+
|
|
27
|
+
logger.info(`Finding version for global: ${slug} with ID: ${id}`)
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const result = await payload.findGlobalVersionByID({
|
|
31
|
+
id,
|
|
32
|
+
slug,
|
|
33
|
+
depth,
|
|
34
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
35
|
+
req,
|
|
36
|
+
...(fallbackLocale !== undefined ? { fallbackLocale } : {}),
|
|
37
|
+
...(locale ? { locale } : {}),
|
|
38
|
+
...(populate ? { populate } : {}),
|
|
39
|
+
...(select ? { select } : {}),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: 'text',
|
|
46
|
+
text: `Version "${id}" from global "${slug}":\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
doc: result as unknown as Record<string, unknown>,
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
53
|
+
logger.error(`Error finding version ${id} for global ${slug}: ${errorMessage}`)
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: `❌ **Error finding version "${id}" for global "${slug}":** ${errorMessage}`,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
isError: true,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
})
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { findGlobalVersionsInputSchema } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
4
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
5
|
+
import { getLogger } from '../../../utils/getLogger.js'
|
|
6
|
+
|
|
7
|
+
const DEFAULT_DESCRIPTION =
|
|
8
|
+
'Find global versions in any version-enabled global by passing the global slug and optional where clause.'
|
|
9
|
+
|
|
10
|
+
export const findGlobalVersionsTool = defineGlobalTool({
|
|
11
|
+
access: (args) =>
|
|
12
|
+
defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.readVersions),
|
|
13
|
+
annotations: {
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
idempotentHint: true,
|
|
16
|
+
openWorldHint: false,
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
title: 'Find Global Versions',
|
|
19
|
+
},
|
|
20
|
+
description: DEFAULT_DESCRIPTION,
|
|
21
|
+
input: findGlobalVersionsInputSchema,
|
|
22
|
+
}).handler(async ({ slug, authorizedMCP, input, req }) => {
|
|
23
|
+
const payload = req.payload
|
|
24
|
+
const logger = getLogger({ payload })
|
|
25
|
+
const { depth, fallbackLocale, limit, locale, page, pagination, populate, select, sort, where } =
|
|
26
|
+
input
|
|
27
|
+
|
|
28
|
+
logger.info(`Finding versions for global: ${slug}, limit: ${limit}, page: ${page}`)
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const result = await payload.findGlobalVersions({
|
|
32
|
+
slug,
|
|
33
|
+
depth,
|
|
34
|
+
limit,
|
|
35
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
36
|
+
page,
|
|
37
|
+
req,
|
|
38
|
+
...(fallbackLocale !== undefined ? { fallbackLocale } : {}),
|
|
39
|
+
...(locale ? { locale } : {}),
|
|
40
|
+
...(pagination !== undefined ? { pagination } : {}),
|
|
41
|
+
...(populate ? { populate } : {}),
|
|
42
|
+
...(select ? { select } : {}),
|
|
43
|
+
...(sort ? { sort } : {}),
|
|
44
|
+
...(where ? { where } : {}),
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: 'text',
|
|
51
|
+
text: `Versions for global "${slug}":\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
doc: result as unknown as Record<string, unknown>,
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
58
|
+
logger.error(`Error finding versions for global ${slug}: ${errorMessage}`)
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: 'text',
|
|
63
|
+
text: `❌ **Error finding versions for global "${slug}":** ${errorMessage}`,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
isError: true,
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { getAccessResults, getGlobalInputSchema, getGlobalSchemaInputSchema } from 'payload'
|
|
2
|
+
import { getLLMInstructions } from 'payload/internal'
|
|
3
|
+
|
|
4
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
5
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
6
|
+
|
|
7
|
+
export const getGlobalSchemaTool = defineGlobalTool({
|
|
8
|
+
access: (args) => {
|
|
9
|
+
const permissions = args.permissions?.globals?.[args.slug]
|
|
10
|
+
|
|
11
|
+
return defaultAccess(args) && Boolean(permissions?.update)
|
|
12
|
+
},
|
|
13
|
+
annotations: {
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
idempotentHint: true,
|
|
16
|
+
openWorldHint: false,
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
title: 'Get Global Schema',
|
|
19
|
+
},
|
|
20
|
+
description: 'Get the input schema and LLM instructions before updating a global.',
|
|
21
|
+
input: getGlobalSchemaInputSchema,
|
|
22
|
+
}).handler(async ({ slug, authorizedMCP, req }) => {
|
|
23
|
+
const permissions = authorizedMCP.overrideAccess
|
|
24
|
+
? null
|
|
25
|
+
: (await getAccessResults({ req })).globals?.[slug]
|
|
26
|
+
|
|
27
|
+
if (!authorizedMCP.overrideAccess && !permissions?.update) {
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
text: `Error: MCP access to "getGlobalSchema" is not enabled for global "${slug}"`,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
isError: true,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const inputSchema = getGlobalInputSchema({
|
|
40
|
+
globalSlug: slug,
|
|
41
|
+
req,
|
|
42
|
+
...(permissions ? { permissions } : {}),
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
if (!inputSchema) {
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: 'text', text: `Error: Global "${slug}" not found` }],
|
|
48
|
+
isError: true,
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const instructions = await getLLMInstructions({
|
|
53
|
+
slug,
|
|
54
|
+
type: 'global',
|
|
55
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
56
|
+
req,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: 'text',
|
|
63
|
+
text: `Schema for global "${slug}":\n\`\`\`json\n${JSON.stringify(inputSchema)}\n\`\`\``,
|
|
64
|
+
},
|
|
65
|
+
...(instructions ? [{ type: 'text' as const, text: instructions }] : []),
|
|
66
|
+
],
|
|
67
|
+
structuredContent: {
|
|
68
|
+
slug,
|
|
69
|
+
schema: inputSchema,
|
|
70
|
+
...(instructions ? { instructions } : {}),
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { restoreGlobalVersionInputSchema } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
4
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
5
|
+
import { getLogger } from '../../../utils/getLogger.js'
|
|
6
|
+
|
|
7
|
+
const DEFAULT_DESCRIPTION =
|
|
8
|
+
'Restore a global from a previous version in any version-enabled global.'
|
|
9
|
+
|
|
10
|
+
export const restoreGlobalVersionTool = defineGlobalTool({
|
|
11
|
+
access: (args) => defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),
|
|
12
|
+
annotations: {
|
|
13
|
+
destructiveHint: true,
|
|
14
|
+
idempotentHint: false,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
readOnlyHint: false,
|
|
17
|
+
title: 'Restore Global Version',
|
|
18
|
+
},
|
|
19
|
+
description: DEFAULT_DESCRIPTION,
|
|
20
|
+
input: restoreGlobalVersionInputSchema,
|
|
21
|
+
}).handler(async ({ slug, authorizedMCP, input, req }) => {
|
|
22
|
+
const payload = req.payload
|
|
23
|
+
const logger = getLogger({ payload })
|
|
24
|
+
const { id, depth, fallbackLocale, locale, populate, select } = input
|
|
25
|
+
|
|
26
|
+
logger.info(`Restoring version for global: ${slug} with ID: ${id}`)
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const result = await payload.restoreGlobalVersion({
|
|
30
|
+
id: String(id),
|
|
31
|
+
slug,
|
|
32
|
+
depth,
|
|
33
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
34
|
+
req,
|
|
35
|
+
...(fallbackLocale !== undefined ? { fallbackLocale } : {}),
|
|
36
|
+
...(locale ? { locale } : {}),
|
|
37
|
+
...(populate ? { populate } : {}),
|
|
38
|
+
...(select ? { select } : {}),
|
|
39
|
+
})
|
|
40
|
+
const resultObject = result as Record<string, unknown>
|
|
41
|
+
const restoredGlobal =
|
|
42
|
+
resultObject.version && typeof resultObject.version === 'object'
|
|
43
|
+
? (resultObject.version as Record<string, unknown>)
|
|
44
|
+
: resultObject
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: `Version "${id}" restored successfully for global "${slug}"!\nRestored global:\n\`\`\`json\n${JSON.stringify(restoredGlobal)}\n\`\`\``,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
doc: restoredGlobal,
|
|
54
|
+
}
|
|
55
|
+
} catch (error) {
|
|
56
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
57
|
+
logger.error(`Error restoring version ${id} for global ${slug}: ${errorMessage}`)
|
|
58
|
+
return {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: `❌ **Error restoring version "${id}" for global "${slug}":** ${errorMessage}`,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
isError: true,
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
})
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getGlobalVirtualFieldNames,
|
|
3
|
+
stripVirtualFields,
|
|
4
|
+
transformPointDataToPayload,
|
|
5
|
+
updateGlobalInputSchema,
|
|
6
|
+
validateGlobalData,
|
|
7
|
+
} from 'payload'
|
|
8
|
+
|
|
9
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
10
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
11
|
+
import { getLogger } from '../../../utils/getLogger.js'
|
|
12
|
+
import { formatEntityError } from '../formatEntityError.js'
|
|
13
|
+
|
|
14
|
+
const DEFAULT_DESCRIPTION = 'Update any Payload global by passing the global slug and data.'
|
|
15
|
+
|
|
16
|
+
export const updateGlobalTool = defineGlobalTool({
|
|
17
|
+
access: (args) => defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),
|
|
18
|
+
annotations: {
|
|
19
|
+
destructiveHint: true,
|
|
20
|
+
idempotentHint: false,
|
|
21
|
+
openWorldHint: false,
|
|
22
|
+
readOnlyHint: false,
|
|
23
|
+
title: 'Update Global',
|
|
24
|
+
},
|
|
25
|
+
description: DEFAULT_DESCRIPTION,
|
|
26
|
+
input: updateGlobalInputSchema,
|
|
27
|
+
}).handler(async ({ slug, authorizedMCP, input, req }) => {
|
|
28
|
+
const payload = req.payload
|
|
29
|
+
const logger = getLogger({ payload })
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
data,
|
|
33
|
+
depth,
|
|
34
|
+
draft,
|
|
35
|
+
fallbackLocale,
|
|
36
|
+
locale,
|
|
37
|
+
overrideLock,
|
|
38
|
+
populate,
|
|
39
|
+
publishAllLocales,
|
|
40
|
+
select,
|
|
41
|
+
unpublishAllLocales,
|
|
42
|
+
} = input
|
|
43
|
+
|
|
44
|
+
logger.info(`Updating global: ${slug}, draft: ${draft}${locale ? `, locale: ${locale}` : ''}`)
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const virtualFieldNames = getGlobalVirtualFieldNames(payload.config, slug)
|
|
48
|
+
const inputData = stripVirtualFields(data, virtualFieldNames)
|
|
49
|
+
validateGlobalData({ slug, data: inputData, req })
|
|
50
|
+
|
|
51
|
+
const parsedData = transformPointDataToPayload(inputData)
|
|
52
|
+
|
|
53
|
+
const updateOptions: Parameters<typeof payload.updateGlobal>[0] = {
|
|
54
|
+
slug,
|
|
55
|
+
data: parsedData,
|
|
56
|
+
depth,
|
|
57
|
+
draft,
|
|
58
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
59
|
+
overrideLock,
|
|
60
|
+
populate,
|
|
61
|
+
publishAllLocales,
|
|
62
|
+
req,
|
|
63
|
+
unpublishAllLocales,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (locale) {
|
|
67
|
+
updateOptions.locale = locale
|
|
68
|
+
}
|
|
69
|
+
if (fallbackLocale !== undefined) {
|
|
70
|
+
updateOptions.fallbackLocale = fallbackLocale
|
|
71
|
+
}
|
|
72
|
+
if (select) {
|
|
73
|
+
updateOptions.select = select
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const result = await payload.updateGlobal(updateOptions)
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: `Global "${slug}" updated successfully!\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
doc: result,
|
|
86
|
+
}
|
|
87
|
+
} catch (error) {
|
|
88
|
+
const message = error instanceof Error ? error.message : 'Unknown error'
|
|
89
|
+
logger.error(`Error updating global ${slug}: ${message}`)
|
|
90
|
+
return formatEntityError({ slug, action: 'updating', entity: 'global', error, req })
|
|
91
|
+
}
|
|
92
|
+
})
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { CollectionTool, GlobalTool, Tool } from '../types.js'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
authCollectionTool,
|
|
5
|
+
forgotPasswordCollectionTool,
|
|
6
|
+
loginCollectionTool,
|
|
7
|
+
resetPasswordCollectionTool,
|
|
8
|
+
unlockCollectionTool,
|
|
9
|
+
verifyCollectionTool,
|
|
10
|
+
} from './builtin/collections/authTools.js'
|
|
11
|
+
import { countDocumentsTool } from './builtin/collections/countTool.js'
|
|
12
|
+
import { countVersionsTool } from './builtin/collections/countVersionsTool.js'
|
|
13
|
+
import { createDocumentsTool } from './builtin/collections/createTool.js'
|
|
14
|
+
import { deleteDocumentsTool } from './builtin/collections/deleteTool.js'
|
|
15
|
+
import { duplicateDocumentTool } from './builtin/collections/duplicateTool.js'
|
|
16
|
+
import { findDistinctTool } from './builtin/collections/findDistinctTool.js'
|
|
17
|
+
import { findDocumentsTool } from './builtin/collections/findTool.js'
|
|
18
|
+
import { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js'
|
|
19
|
+
import { findVersionsTool } from './builtin/collections/findVersionsTool.js'
|
|
20
|
+
import { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js'
|
|
21
|
+
import { restoreVersionTool } from './builtin/collections/restoreVersionTool.js'
|
|
22
|
+
import { updateDocumentTool } from './builtin/collections/updateTool.js'
|
|
23
|
+
import { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js'
|
|
24
|
+
import { getConfigInfoTool } from './builtin/getConfigInfoTool.js'
|
|
25
|
+
import { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js'
|
|
26
|
+
import { findGlobalTool } from './builtin/globals/findTool.js'
|
|
27
|
+
import { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js'
|
|
28
|
+
import { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js'
|
|
29
|
+
import { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js'
|
|
30
|
+
import { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js'
|
|
31
|
+
import { updateGlobalTool } from './builtin/globals/updateTool.js'
|
|
32
|
+
|
|
33
|
+
type CollectionBuiltin = {
|
|
34
|
+
mcpName: string
|
|
35
|
+
requiresDuplicateEnabled?: boolean
|
|
36
|
+
requiresUpload?: boolean
|
|
37
|
+
requiresVersions?: boolean
|
|
38
|
+
tool: CollectionTool
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type GlobalBuiltin = {
|
|
42
|
+
mcpName: string
|
|
43
|
+
requiresVersions?: boolean
|
|
44
|
+
tool: GlobalTool
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const TOOL_BUILTINS = {
|
|
48
|
+
getConfigInfo: { mcpName: 'getConfigInfo', tool: getConfigInfoTool },
|
|
49
|
+
} satisfies Record<string, { mcpName: string; tool: Tool }>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The static built-in collection CRUD tools. Keys here are the source of truth
|
|
53
|
+
* for `MCPCollectionBuiltinName` — adding/removing an entry updates the type
|
|
54
|
+
* automatically.
|
|
55
|
+
*/
|
|
56
|
+
export const COLLECTION_BUILTINS = {
|
|
57
|
+
count: { mcpName: 'countDocuments', tool: countDocumentsTool },
|
|
58
|
+
countVersions: { mcpName: 'countVersions', requiresVersions: true, tool: countVersionsTool },
|
|
59
|
+
create: { mcpName: 'createDocuments', tool: createDocumentsTool },
|
|
60
|
+
delete: { mcpName: 'deleteDocuments', tool: deleteDocumentsTool },
|
|
61
|
+
duplicate: {
|
|
62
|
+
mcpName: 'duplicateDocument',
|
|
63
|
+
requiresDuplicateEnabled: true,
|
|
64
|
+
tool: duplicateDocumentTool,
|
|
65
|
+
},
|
|
66
|
+
find: { mcpName: 'findDocuments', tool: findDocumentsTool },
|
|
67
|
+
findDistinct: { mcpName: 'findDistinct', tool: findDistinctTool },
|
|
68
|
+
findVersionByID: {
|
|
69
|
+
mcpName: 'findVersionByID',
|
|
70
|
+
requiresVersions: true,
|
|
71
|
+
tool: findVersionByIDTool,
|
|
72
|
+
},
|
|
73
|
+
findVersions: { mcpName: 'findVersions', requiresVersions: true, tool: findVersionsTool },
|
|
74
|
+
getCollectionSchema: { mcpName: 'getCollectionSchema', tool: getCollectionSchemaTool },
|
|
75
|
+
getUploadInstructions: {
|
|
76
|
+
mcpName: 'getUploadInstructions',
|
|
77
|
+
requiresUpload: true,
|
|
78
|
+
tool: getUploadInstructionsTool,
|
|
79
|
+
},
|
|
80
|
+
restoreVersion: { mcpName: 'restoreVersion', requiresVersions: true, tool: restoreVersionTool },
|
|
81
|
+
update: { mcpName: 'updateDocument', tool: updateDocumentTool },
|
|
82
|
+
} satisfies Record<string, CollectionBuiltin>
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The static auth tools surfaced under auth-enabled collections. Keys are the
|
|
86
|
+
* source of truth for `MCPCollectionAuthToolName`.
|
|
87
|
+
*/
|
|
88
|
+
export const COLLECTION_AUTH_BUILTINS = {
|
|
89
|
+
auth: { mcpName: 'auth', tool: authCollectionTool },
|
|
90
|
+
forgotPassword: {
|
|
91
|
+
mcpName: 'forgotPassword',
|
|
92
|
+
tool: forgotPasswordCollectionTool,
|
|
93
|
+
},
|
|
94
|
+
login: { mcpName: 'login', tool: loginCollectionTool },
|
|
95
|
+
resetPassword: {
|
|
96
|
+
mcpName: 'resetPassword',
|
|
97
|
+
tool: resetPasswordCollectionTool,
|
|
98
|
+
},
|
|
99
|
+
unlock: { mcpName: 'unlock', tool: unlockCollectionTool },
|
|
100
|
+
verify: { mcpName: 'verify', tool: verifyCollectionTool },
|
|
101
|
+
} satisfies Record<string, { mcpName: string; tool: CollectionTool }>
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The static built-in global tools. Keys are the source of truth for
|
|
105
|
+
* `MCPGlobalBuiltinName`.
|
|
106
|
+
*/
|
|
107
|
+
export const GLOBAL_BUILTINS = {
|
|
108
|
+
countGlobalVersions: {
|
|
109
|
+
mcpName: 'countGlobalVersions',
|
|
110
|
+
requiresVersions: true,
|
|
111
|
+
tool: countGlobalVersionsTool,
|
|
112
|
+
},
|
|
113
|
+
find: { mcpName: 'findGlobal', tool: findGlobalTool },
|
|
114
|
+
findGlobalVersionByID: {
|
|
115
|
+
mcpName: 'findGlobalVersionByID',
|
|
116
|
+
requiresVersions: true,
|
|
117
|
+
tool: findGlobalVersionByIDTool,
|
|
118
|
+
},
|
|
119
|
+
findGlobalVersions: {
|
|
120
|
+
mcpName: 'findGlobalVersions',
|
|
121
|
+
requiresVersions: true,
|
|
122
|
+
tool: findGlobalVersionsTool,
|
|
123
|
+
},
|
|
124
|
+
getGlobalSchema: { mcpName: 'getGlobalSchema', tool: getGlobalSchemaTool },
|
|
125
|
+
restoreGlobalVersion: {
|
|
126
|
+
mcpName: 'restoreGlobalVersion',
|
|
127
|
+
requiresVersions: true,
|
|
128
|
+
tool: restoreGlobalVersionTool,
|
|
129
|
+
},
|
|
130
|
+
update: { mcpName: 'updateGlobal', tool: updateGlobalTool },
|
|
131
|
+
} satisfies Record<string, GlobalBuiltin>
|
|
132
|
+
|
|
133
|
+
export type MCPCollectionBuiltinName = keyof typeof COLLECTION_BUILTINS
|
|
134
|
+
|
|
135
|
+
export type MCPCollectionAuthToolName = keyof typeof COLLECTION_AUTH_BUILTINS
|
|
136
|
+
|
|
137
|
+
export type MCPGlobalBuiltinName = keyof typeof GLOBAL_BUILTINS
|
|
138
|
+
|
|
139
|
+
export type MCPTopLevelBuiltinName = keyof typeof TOOL_BUILTINS
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Pre-typed `Object.entries` for each registry. The cast from `string` to the
|
|
143
|
+
* literal key union lives here once so consumers can iterate without their own
|
|
144
|
+
* cast — TypeScript's `Object.entries` always widens keys to `string`, which
|
|
145
|
+
* defeats the narrow type lookups on `MCPCollectionToolsMap`.
|
|
146
|
+
*/
|
|
147
|
+
export const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS) as Array<
|
|
148
|
+
[MCPTopLevelBuiltinName, (typeof TOOL_BUILTINS)[MCPTopLevelBuiltinName]]
|
|
149
|
+
>
|
|
150
|
+
|
|
151
|
+
export const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS) as Array<
|
|
152
|
+
[MCPCollectionBuiltinName, CollectionBuiltin]
|
|
153
|
+
>
|
|
154
|
+
|
|
155
|
+
export const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS) as Array<
|
|
156
|
+
[MCPCollectionAuthToolName, (typeof COLLECTION_AUTH_BUILTINS)[MCPCollectionAuthToolName]]
|
|
157
|
+
>
|
|
158
|
+
|
|
159
|
+
export const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS) as Array<
|
|
160
|
+
[MCPGlobalBuiltinName, GlobalBuiltin]
|
|
161
|
+
>
|