@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
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import type { CollectionConfig, CollectionSlug } from 'payload'
|
|
2
|
-
|
|
3
|
-
import type { MCPPluginConfig } from '../types.js'
|
|
4
|
-
|
|
5
|
-
import { toCamelCase } from '../utils/camelCase.js'
|
|
6
|
-
import { createApiKeyFields } from '../utils/createApiKeyFields.js'
|
|
7
|
-
|
|
8
|
-
export const createAPIKeysCollection = (
|
|
9
|
-
collections: MCPPluginConfig['collections'],
|
|
10
|
-
globals: MCPPluginConfig['globals'],
|
|
11
|
-
customTools: Array<{ description: string; name: string }> = [],
|
|
12
|
-
experimentalTools: NonNullable<MCPPluginConfig['experimental']>['tools'] = {},
|
|
13
|
-
pluginOptions: MCPPluginConfig,
|
|
14
|
-
): CollectionConfig => {
|
|
15
|
-
const customToolsFields = customTools.map((tool) => {
|
|
16
|
-
const camelCasedName = toCamelCase(tool.name)
|
|
17
|
-
return {
|
|
18
|
-
name: camelCasedName,
|
|
19
|
-
type: 'checkbox' as const,
|
|
20
|
-
admin: {
|
|
21
|
-
description: tool.description,
|
|
22
|
-
},
|
|
23
|
-
defaultValue: true,
|
|
24
|
-
label: camelCasedName,
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const customResourceFields =
|
|
29
|
-
pluginOptions.mcp?.resources?.map((resource) => {
|
|
30
|
-
const camelCasedName = toCamelCase(resource.name)
|
|
31
|
-
return {
|
|
32
|
-
name: camelCasedName,
|
|
33
|
-
type: 'checkbox' as const,
|
|
34
|
-
admin: {
|
|
35
|
-
description: resource.description,
|
|
36
|
-
},
|
|
37
|
-
defaultValue: true,
|
|
38
|
-
label: camelCasedName,
|
|
39
|
-
}
|
|
40
|
-
}) || []
|
|
41
|
-
|
|
42
|
-
const customPromptFields =
|
|
43
|
-
pluginOptions.mcp?.prompts?.map((prompt) => {
|
|
44
|
-
const camelCasedName = toCamelCase(prompt.name)
|
|
45
|
-
return {
|
|
46
|
-
name: camelCasedName,
|
|
47
|
-
type: 'checkbox' as const,
|
|
48
|
-
admin: {
|
|
49
|
-
description: prompt.description,
|
|
50
|
-
},
|
|
51
|
-
defaultValue: true,
|
|
52
|
-
label: camelCasedName,
|
|
53
|
-
}
|
|
54
|
-
}) || []
|
|
55
|
-
|
|
56
|
-
const userCollection = pluginOptions.userCollection
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
slug: 'payload-mcp-api-keys',
|
|
60
|
-
admin: {
|
|
61
|
-
description:
|
|
62
|
-
'API keys control which collections, resources, tools, and prompts MCP clients can access',
|
|
63
|
-
group: 'MCP',
|
|
64
|
-
useAsTitle: 'label',
|
|
65
|
-
},
|
|
66
|
-
auth: {
|
|
67
|
-
disableLocalStrategy: true,
|
|
68
|
-
useAPIKey: true,
|
|
69
|
-
},
|
|
70
|
-
fields: [
|
|
71
|
-
{
|
|
72
|
-
name: 'user',
|
|
73
|
-
type: 'relationship',
|
|
74
|
-
admin: {
|
|
75
|
-
description: 'The user that the API key is associated with.',
|
|
76
|
-
},
|
|
77
|
-
relationTo: userCollection as CollectionSlug,
|
|
78
|
-
required: true,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: 'label',
|
|
82
|
-
type: 'text',
|
|
83
|
-
admin: {
|
|
84
|
-
description: 'A useful label for the API key.',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: 'description',
|
|
89
|
-
type: 'text',
|
|
90
|
-
admin: {
|
|
91
|
-
description: 'The purpose of the API key.',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
...createApiKeyFields({
|
|
96
|
-
config: collections,
|
|
97
|
-
configType: 'collection',
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
...createApiKeyFields({
|
|
101
|
-
config: globals,
|
|
102
|
-
configType: 'global',
|
|
103
|
-
}),
|
|
104
|
-
|
|
105
|
-
...(customTools.length > 0
|
|
106
|
-
? [
|
|
107
|
-
{
|
|
108
|
-
type: 'collapsible' as const,
|
|
109
|
-
admin: {
|
|
110
|
-
description: 'Manage client access to tools',
|
|
111
|
-
position: 'sidebar' as const,
|
|
112
|
-
},
|
|
113
|
-
fields: [
|
|
114
|
-
{
|
|
115
|
-
name: 'payload-mcp-tool',
|
|
116
|
-
type: 'group' as const,
|
|
117
|
-
fields: customToolsFields,
|
|
118
|
-
label: false as const,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
label: 'Tools',
|
|
122
|
-
},
|
|
123
|
-
]
|
|
124
|
-
: []),
|
|
125
|
-
|
|
126
|
-
...(pluginOptions.mcp?.resources && pluginOptions.mcp?.resources.length > 0
|
|
127
|
-
? [
|
|
128
|
-
{
|
|
129
|
-
type: 'collapsible' as const,
|
|
130
|
-
admin: {
|
|
131
|
-
description: 'Manage client access to resources',
|
|
132
|
-
position: 'sidebar' as const,
|
|
133
|
-
},
|
|
134
|
-
fields: [
|
|
135
|
-
{
|
|
136
|
-
name: 'payload-mcp-resource',
|
|
137
|
-
type: 'group' as const,
|
|
138
|
-
fields: customResourceFields,
|
|
139
|
-
label: false as const,
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
label: 'Resources',
|
|
143
|
-
},
|
|
144
|
-
]
|
|
145
|
-
: []),
|
|
146
|
-
|
|
147
|
-
...(pluginOptions.mcp?.prompts && pluginOptions.mcp?.prompts.length > 0
|
|
148
|
-
? [
|
|
149
|
-
{
|
|
150
|
-
type: 'collapsible' as const,
|
|
151
|
-
admin: {
|
|
152
|
-
description: 'Manage client access to prompts',
|
|
153
|
-
position: 'sidebar' as const,
|
|
154
|
-
},
|
|
155
|
-
fields: [
|
|
156
|
-
{
|
|
157
|
-
name: 'payload-mcp-prompt',
|
|
158
|
-
type: 'group' as const,
|
|
159
|
-
fields: customPromptFields,
|
|
160
|
-
label: false as const,
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
label: 'Prompts',
|
|
164
|
-
},
|
|
165
|
-
]
|
|
166
|
-
: []),
|
|
167
|
-
|
|
168
|
-
// Experimental Tools
|
|
169
|
-
...(process.env.NODE_ENV === 'development' &&
|
|
170
|
-
(experimentalTools?.collections?.enabled ||
|
|
171
|
-
experimentalTools?.jobs?.enabled ||
|
|
172
|
-
experimentalTools?.config?.enabled ||
|
|
173
|
-
experimentalTools?.auth?.enabled)
|
|
174
|
-
? [
|
|
175
|
-
{
|
|
176
|
-
type: 'collapsible' as const,
|
|
177
|
-
admin: {
|
|
178
|
-
description: 'Manage client access to experimental tools',
|
|
179
|
-
position: 'sidebar' as const,
|
|
180
|
-
},
|
|
181
|
-
fields: [
|
|
182
|
-
...(experimentalTools?.collections?.enabled
|
|
183
|
-
? [
|
|
184
|
-
{
|
|
185
|
-
name: 'collections',
|
|
186
|
-
type: 'group' as const,
|
|
187
|
-
fields: [
|
|
188
|
-
{
|
|
189
|
-
name: 'find',
|
|
190
|
-
type: 'checkbox' as const,
|
|
191
|
-
admin: {
|
|
192
|
-
description:
|
|
193
|
-
'Allow LLMs to find and list Payload collections with optional content and document counts.',
|
|
194
|
-
},
|
|
195
|
-
defaultValue: false,
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: 'create',
|
|
199
|
-
type: 'checkbox' as const,
|
|
200
|
-
admin: {
|
|
201
|
-
description:
|
|
202
|
-
'Allow LLMs to create new Payload collections with specified fields and configuration.',
|
|
203
|
-
},
|
|
204
|
-
defaultValue: false,
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: 'update',
|
|
208
|
-
type: 'checkbox' as const,
|
|
209
|
-
admin: {
|
|
210
|
-
description:
|
|
211
|
-
'Allow LLMs to update existing Payload collections with new fields, modifications, or configuration changes.',
|
|
212
|
-
},
|
|
213
|
-
defaultValue: false,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: 'delete',
|
|
217
|
-
type: 'checkbox' as const,
|
|
218
|
-
admin: {
|
|
219
|
-
description:
|
|
220
|
-
'Allow LLMs to delete Payload collections and optionally update the configuration.',
|
|
221
|
-
},
|
|
222
|
-
defaultValue: false,
|
|
223
|
-
},
|
|
224
|
-
],
|
|
225
|
-
},
|
|
226
|
-
]
|
|
227
|
-
: []),
|
|
228
|
-
...(experimentalTools?.jobs?.enabled
|
|
229
|
-
? [
|
|
230
|
-
{
|
|
231
|
-
name: 'jobs',
|
|
232
|
-
type: 'group' as const,
|
|
233
|
-
fields: [
|
|
234
|
-
{
|
|
235
|
-
name: 'create',
|
|
236
|
-
type: 'checkbox' as const,
|
|
237
|
-
admin: {
|
|
238
|
-
description:
|
|
239
|
-
'Allow LLMs to create new Payload jobs (tasks and workflows) with custom schemas and configuration.',
|
|
240
|
-
},
|
|
241
|
-
defaultValue: false,
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
name: 'run',
|
|
245
|
-
type: 'checkbox' as const,
|
|
246
|
-
admin: {
|
|
247
|
-
description:
|
|
248
|
-
'Allow LLMs to execute Payload jobs with custom input data and queue options.',
|
|
249
|
-
},
|
|
250
|
-
defaultValue: false,
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
name: 'update',
|
|
254
|
-
type: 'checkbox' as const,
|
|
255
|
-
admin: {
|
|
256
|
-
description:
|
|
257
|
-
'Allow LLMs to update existing Payload jobs with new schemas, configuration, or handler code.',
|
|
258
|
-
},
|
|
259
|
-
defaultValue: false,
|
|
260
|
-
},
|
|
261
|
-
],
|
|
262
|
-
},
|
|
263
|
-
]
|
|
264
|
-
: []),
|
|
265
|
-
...(experimentalTools?.config?.enabled
|
|
266
|
-
? [
|
|
267
|
-
{
|
|
268
|
-
name: 'config',
|
|
269
|
-
type: 'group' as const,
|
|
270
|
-
fields: [
|
|
271
|
-
{
|
|
272
|
-
name: 'find',
|
|
273
|
-
type: 'checkbox' as const,
|
|
274
|
-
admin: {
|
|
275
|
-
description:
|
|
276
|
-
'Allow LLMs to read and display a Payload configuration file.',
|
|
277
|
-
},
|
|
278
|
-
defaultValue: false,
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
name: 'update',
|
|
282
|
-
type: 'checkbox' as const,
|
|
283
|
-
admin: {
|
|
284
|
-
description:
|
|
285
|
-
'Allow LLMs to update a Payload configuration file with various modifications.',
|
|
286
|
-
},
|
|
287
|
-
defaultValue: false,
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
},
|
|
291
|
-
]
|
|
292
|
-
: []),
|
|
293
|
-
...(experimentalTools?.auth?.enabled
|
|
294
|
-
? [
|
|
295
|
-
{
|
|
296
|
-
name: 'auth',
|
|
297
|
-
type: 'group' as const,
|
|
298
|
-
fields: [
|
|
299
|
-
{
|
|
300
|
-
name: 'auth',
|
|
301
|
-
type: 'checkbox' as const,
|
|
302
|
-
admin: {
|
|
303
|
-
description:
|
|
304
|
-
'Allow LLMs to check authentication status for a user by setting custom headers. (e.g. {"Authorization": "Bearer <token>"})',
|
|
305
|
-
},
|
|
306
|
-
defaultValue: false,
|
|
307
|
-
label: 'Check Auth Status',
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
name: 'login',
|
|
311
|
-
type: 'checkbox' as const,
|
|
312
|
-
admin: {
|
|
313
|
-
description:
|
|
314
|
-
'Allow LLMs to authenticate a user with email and password.',
|
|
315
|
-
},
|
|
316
|
-
defaultValue: false,
|
|
317
|
-
label: 'User Login',
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
name: 'verify',
|
|
321
|
-
type: 'checkbox' as const,
|
|
322
|
-
admin: {
|
|
323
|
-
description:
|
|
324
|
-
'Allow LLMs to verify a user email with a verification token.',
|
|
325
|
-
},
|
|
326
|
-
defaultValue: false,
|
|
327
|
-
label: 'Email Verification',
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
name: 'resetPassword',
|
|
331
|
-
type: 'checkbox' as const,
|
|
332
|
-
admin: {
|
|
333
|
-
description:
|
|
334
|
-
'Allow LLMs to reset a user password with a reset token.',
|
|
335
|
-
},
|
|
336
|
-
defaultValue: false,
|
|
337
|
-
label: 'Reset Password',
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
name: 'forgotPassword',
|
|
341
|
-
type: 'checkbox' as const,
|
|
342
|
-
admin: {
|
|
343
|
-
description: 'Allow LLMs to send a password reset email to a user.',
|
|
344
|
-
},
|
|
345
|
-
defaultValue: false,
|
|
346
|
-
label: 'Forgot Password',
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: 'unlock',
|
|
350
|
-
type: 'checkbox' as const,
|
|
351
|
-
admin: {
|
|
352
|
-
description:
|
|
353
|
-
'Allow LLMs to unlock a user account that has been locked due to failed login attempts.',
|
|
354
|
-
},
|
|
355
|
-
defaultValue: false,
|
|
356
|
-
label: 'Unlock Account',
|
|
357
|
-
},
|
|
358
|
-
],
|
|
359
|
-
},
|
|
360
|
-
]
|
|
361
|
-
: []),
|
|
362
|
-
],
|
|
363
|
-
label: 'Experimental Tools',
|
|
364
|
-
},
|
|
365
|
-
]
|
|
366
|
-
: []),
|
|
367
|
-
],
|
|
368
|
-
labels: {
|
|
369
|
-
plural: 'API Keys',
|
|
370
|
-
singular: 'API Key',
|
|
371
|
-
},
|
|
372
|
-
}
|
|
373
|
-
}
|
package/src/defaults.ts
DELETED
package/src/endpoints/mcp.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import crypto from 'crypto'
|
|
2
|
-
import { type PayloadHandler, type TypedUser, UnauthorizedError, type Where } from 'payload'
|
|
3
|
-
|
|
4
|
-
import type { MCPAccessSettings, MCPPluginConfig } from '../types.js'
|
|
5
|
-
|
|
6
|
-
import { createRequestFromPayloadRequest } from '../mcp/createRequest.js'
|
|
7
|
-
import { getMCPHandler } from '../mcp/getMcpHandler.js'
|
|
8
|
-
|
|
9
|
-
export const initializeMCPHandler = (pluginOptions: MCPPluginConfig) => {
|
|
10
|
-
const mcpHandler: PayloadHandler = async (req) => {
|
|
11
|
-
const { payload } = req
|
|
12
|
-
const MCPOptions = pluginOptions.mcp || {}
|
|
13
|
-
const MCPHandlerOptions = MCPOptions.handlerOptions || {}
|
|
14
|
-
const useVerboseLogs = MCPHandlerOptions.verboseLogs ?? false
|
|
15
|
-
|
|
16
|
-
req.payloadAPI = 'MCP' as const
|
|
17
|
-
|
|
18
|
-
const getDefaultMcpAccessSettings = async (overrideApiKey?: null | string) => {
|
|
19
|
-
const apiKey =
|
|
20
|
-
(overrideApiKey ?? req.headers.get('Authorization')?.startsWith('Bearer '))
|
|
21
|
-
? req.headers.get('Authorization')?.replace('Bearer ', '').trim()
|
|
22
|
-
: null
|
|
23
|
-
|
|
24
|
-
if (apiKey === null) {
|
|
25
|
-
throw new UnauthorizedError()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const sha256APIKeyIndex = crypto
|
|
29
|
-
.createHmac('sha256', payload.secret)
|
|
30
|
-
.update(apiKey || '')
|
|
31
|
-
.digest('hex')
|
|
32
|
-
|
|
33
|
-
const where: Where = {
|
|
34
|
-
apiKeyIndex: {
|
|
35
|
-
equals: sha256APIKeyIndex,
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const { docs } = await payload.find({
|
|
40
|
-
collection: 'payload-mcp-api-keys',
|
|
41
|
-
depth: 1,
|
|
42
|
-
limit: 1,
|
|
43
|
-
pagination: false,
|
|
44
|
-
where,
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
if (docs.length === 0) {
|
|
48
|
-
throw new UnauthorizedError()
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (useVerboseLogs) {
|
|
52
|
-
payload.logger.info('[payload-mcp] API Key is valid')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const user = docs[0]?.user as TypedUser
|
|
56
|
-
user.collection = pluginOptions.userCollection as string
|
|
57
|
-
user._strategy = 'mcp-api-key' as const
|
|
58
|
-
|
|
59
|
-
return docs[0] as unknown as MCPAccessSettings
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const mcpAccessSettings = pluginOptions.overrideAuth
|
|
63
|
-
? await pluginOptions.overrideAuth(req, getDefaultMcpAccessSettings)
|
|
64
|
-
: await getDefaultMcpAccessSettings()
|
|
65
|
-
|
|
66
|
-
// @modelcontextprotocol/sdk's StreamableHTTPServerTransport uses @hono/node-server's
|
|
67
|
-
// getRequestListener, which replaces global.Request and global.Response with Hono
|
|
68
|
-
// custom classes. Unfortunately, we cannot pass overrideGlobalObjects: false because the option is
|
|
69
|
-
// consumed inside the SDK transport and is not exposed to callers.
|
|
70
|
-
// Save originals here and restore after the handler resolves so that Next.js
|
|
71
|
-
// instanceof Response checks on subsequent route handlers keep working.
|
|
72
|
-
const globals = globalThis as Record<string, unknown>
|
|
73
|
-
const originalResponse = globals['Response']
|
|
74
|
-
const originalRequest = globals['Request']
|
|
75
|
-
|
|
76
|
-
const handler = getMCPHandler(pluginOptions, mcpAccessSettings, req)
|
|
77
|
-
const request = createRequestFromPayloadRequest(req)
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
return await handler(request)
|
|
81
|
-
} finally {
|
|
82
|
-
if (globals['Response'] !== originalResponse) {
|
|
83
|
-
Object.defineProperty(globalThis, 'Response', { value: originalResponse })
|
|
84
|
-
}
|
|
85
|
-
if (globals['Request'] !== originalRequest) {
|
|
86
|
-
Object.defineProperty(globalThis, 'Request', { value: originalRequest })
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return mcpHandler
|
|
91
|
-
}
|
package/src/mcp/createRequest.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AuthenticationError, type PayloadRequest } from 'payload'
|
|
2
|
-
|
|
3
|
-
export const createRequestFromPayloadRequest = (req: PayloadRequest) => {
|
|
4
|
-
if (!req.url) {
|
|
5
|
-
throw new AuthenticationError()
|
|
6
|
-
}
|
|
7
|
-
return new Request(req.url, {
|
|
8
|
-
body: req.body,
|
|
9
|
-
duplex: 'half',
|
|
10
|
-
headers: req.headers,
|
|
11
|
-
method: req.method,
|
|
12
|
-
} as { duplex: 'half' } & RequestInit)
|
|
13
|
-
}
|