@payloadcms/plugin-mcp 4.0.0-internal.5b1e7cd → 4.0.0-internal.c2b57ce
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/bin.js +39 -0
- package/dist/collection/getAccessField.d.ts +12 -0
- package/dist/collection/getAccessField.d.ts.map +1 -0
- package/dist/collection/getAccessField.js +57 -0
- package/dist/collection/getAccessField.js.map +1 -0
- package/dist/collection/index.d.ts +6 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +59 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/components/AccessField/index.client.d.ts +10 -0
- package/dist/components/AccessField/index.client.d.ts.map +1 -0
- package/dist/components/AccessField/index.client.js +305 -0
- package/dist/components/AccessField/index.client.js.map +1 -0
- package/dist/components/AccessField/index.css +93 -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 +10 -0
- package/dist/endpoint/access.d.ts.map +1 -0
- package/dist/endpoint/access.js +106 -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 +36 -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/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -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 +163 -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 +250 -0
- package/dist/mcp/builtin/collections/authTools.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 +87 -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 +117 -0
- package/dist/mcp/builtin/collections/deleteTool.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 +159 -0
- package/dist/mcp/builtin/collections/findTool.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 +187 -0
- package/dist/mcp/builtin/collections/updateTool.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 +76 -0
- package/dist/mcp/builtin/globals/findTool.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 +92 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +37 -0
- package/dist/mcp/builtinTools.d.ts.map +1 -0
- package/dist/mcp/builtinTools.js +64 -0
- package/dist/mcp/builtinTools.js.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts +17 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.js +167 -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 +89 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +262 -455
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/camelCase.d.ts.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/localAPIDefaults.d.ts +20 -0
- package/dist/utils/localAPIDefaults.d.ts.map +1 -0
- package/dist/utils/localAPIDefaults.js +19 -0
- package/dist/utils/localAPIDefaults.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/prepareCollectionSchema.d.ts +7 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.js +37 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.js.map +1 -0
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +2 -2
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts +2 -2
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js.map +1 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts +2 -2
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts.map +1 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js +7 -4
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js.map +1 -1
- package/dist/utils/schemaConversion/transformPointFields.d.ts +2 -2
- package/dist/utils/schemaConversion/transformPointFields.d.ts.map +1 -1
- package/dist/utils/schemaConversion/transformPointFields.js +7 -1
- package/dist/utils/schemaConversion/transformPointFields.js.map +1 -1
- 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 +35 -10
- package/src/collection/getAccessField.ts +64 -0
- package/src/collection/index.ts +63 -0
- package/src/components/AccessField/index.client.tsx +344 -0
- package/src/components/AccessField/index.css +93 -0
- package/src/defineTool.ts +44 -0
- package/src/endpoint/access.ts +132 -0
- package/src/endpoint/index.ts +35 -0
- package/src/exports/client.ts +2 -0
- package/src/index.ts +35 -85
- package/src/mcp/buildMcpServer.ts +224 -0
- package/src/mcp/builtin/collections/authTools.ts +233 -0
- package/src/mcp/builtin/collections/createTool.ts +116 -0
- package/src/mcp/builtin/collections/deleteTool.ts +123 -0
- package/src/mcp/builtin/collections/findTool.ts +187 -0
- package/src/mcp/builtin/collections/updateTool.ts +205 -0
- package/src/mcp/builtin/globals/findTool.ts +96 -0
- package/src/mcp/builtin/globals/updateTool.ts +118 -0
- package/src/mcp/builtinTools.ts +84 -0
- package/src/mcp/sanitizeMCPConfig.ts +239 -0
- package/src/stdio.ts +98 -0
- package/src/types.ts +295 -490
- package/src/utils/getLogger.ts +22 -0
- package/src/utils/getPluginConfig.ts +24 -0
- package/src/utils/localAPIDefaults.ts +22 -0
- package/src/utils/resolveProjectRoot.ts +17 -0
- package/src/utils/schemaConversion/prepareCollectionSchema.ts +39 -0
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +3 -3
- package/src/utils/schemaConversion/sanitizeJsonSchema.ts +4 -4
- package/src/utils/schemaConversion/simplifyRelationshipFields.ts +11 -6
- package/src/utils/schemaConversion/transformPointFields.ts +6 -5
- 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/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/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/mcp/getMcpHandler.ts
DELETED
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema4 } from 'json-schema'
|
|
2
|
-
|
|
3
|
-
import { createMcpHandler } from 'mcp-handler'
|
|
4
|
-
import { join } from 'path'
|
|
5
|
-
import { APIError, configToJSONSchema, type PayloadRequest, type TypedUser } from 'payload'
|
|
6
|
-
|
|
7
|
-
import type { MCPAccessSettings, MCPPluginConfig } from '../types.js'
|
|
8
|
-
|
|
9
|
-
import { toCamelCase } from '../utils/camelCase.js'
|
|
10
|
-
import { getEnabledSlugs } from '../utils/getEnabledSlugs.js'
|
|
11
|
-
import {
|
|
12
|
-
getCollectionVirtualFieldNames,
|
|
13
|
-
getGlobalVirtualFieldNames,
|
|
14
|
-
} from '../utils/getVirtualFieldNames.js'
|
|
15
|
-
import { removeVirtualFieldsFromSchema } from '../utils/schemaConversion/removeVirtualFieldsFromSchema.js'
|
|
16
|
-
import { registerTool } from './registerTool.js'
|
|
17
|
-
|
|
18
|
-
// Tools
|
|
19
|
-
import { findGlobalTool } from './tools/global/find.js'
|
|
20
|
-
import { updateGlobalTool } from './tools/global/update.js'
|
|
21
|
-
import { createResourceTool } from './tools/resource/create.js'
|
|
22
|
-
import { deleteResourceTool } from './tools/resource/delete.js'
|
|
23
|
-
import { findResourceTool } from './tools/resource/find.js'
|
|
24
|
-
import { updateResourceTool } from './tools/resource/update.js'
|
|
25
|
-
|
|
26
|
-
// Experimental Tools
|
|
27
|
-
/**
|
|
28
|
-
* @experimental This tools are experimental and may change or be removed in the future.
|
|
29
|
-
*/
|
|
30
|
-
import { authTool } from './tools/auth/auth.js'
|
|
31
|
-
import { forgotPasswordTool } from './tools/auth/forgotPassword.js'
|
|
32
|
-
import { loginTool } from './tools/auth/login.js'
|
|
33
|
-
import { resetPasswordTool } from './tools/auth/resetPassword.js'
|
|
34
|
-
import { unlockTool } from './tools/auth/unlock.js'
|
|
35
|
-
import { verifyTool } from './tools/auth/verify.js'
|
|
36
|
-
import { createCollectionTool } from './tools/collection/create.js'
|
|
37
|
-
import { deleteCollectionTool } from './tools/collection/delete.js'
|
|
38
|
-
import { findCollectionTool } from './tools/collection/find.js'
|
|
39
|
-
import { updateCollectionTool } from './tools/collection/update.js'
|
|
40
|
-
import { findConfigTool } from './tools/config/find.js'
|
|
41
|
-
import { updateConfigTool } from './tools/config/update.js'
|
|
42
|
-
import { createJobTool } from './tools/job/create.js'
|
|
43
|
-
import { runJobTool } from './tools/job/run.js'
|
|
44
|
-
import { updateJobTool } from './tools/job/update.js'
|
|
45
|
-
|
|
46
|
-
export const getMCPHandler = (
|
|
47
|
-
pluginOptions: MCPPluginConfig,
|
|
48
|
-
mcpAccessSettings: MCPAccessSettings,
|
|
49
|
-
req: PayloadRequest,
|
|
50
|
-
) => {
|
|
51
|
-
const { payload } = req
|
|
52
|
-
const configSchema = configToJSONSchema(payload.config, payload.db.defaultIDType, req.i18n, {
|
|
53
|
-
forceInlineBlocks: true,
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
// Handler wrapper that injects req before the _extra argument
|
|
57
|
-
const wrapHandler = (handler: (...args: any[]) => any) => {
|
|
58
|
-
return async (...args: any[]) => {
|
|
59
|
-
const _extra = args[args.length - 1]
|
|
60
|
-
const handlerArgs = args.slice(0, -1)
|
|
61
|
-
return await handler(...handlerArgs, req, _extra)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const payloadToolHandler = (
|
|
66
|
-
handler: NonNullable<NonNullable<MCPPluginConfig['mcp']>['tools']>[number]['handler'],
|
|
67
|
-
) => wrapHandler(handler)
|
|
68
|
-
|
|
69
|
-
const payloadPromptHandler = (
|
|
70
|
-
handler: NonNullable<NonNullable<MCPPluginConfig['mcp']>['prompts']>[number]['handler'],
|
|
71
|
-
) => wrapHandler(handler)
|
|
72
|
-
|
|
73
|
-
const payloadResourceHandler = (
|
|
74
|
-
handler: NonNullable<NonNullable<MCPPluginConfig['mcp']>['resources']>[number]['handler'],
|
|
75
|
-
) => wrapHandler(handler)
|
|
76
|
-
|
|
77
|
-
// User
|
|
78
|
-
const user = mcpAccessSettings.user
|
|
79
|
-
|
|
80
|
-
// MCP Server and Handler Options
|
|
81
|
-
const MCPOptions = pluginOptions.mcp || {}
|
|
82
|
-
const customMCPTools = MCPOptions.tools || []
|
|
83
|
-
const customMCPPrompts = MCPOptions.prompts || []
|
|
84
|
-
const customMCPResources = MCPOptions.resources || []
|
|
85
|
-
const MCPHandlerOptions = MCPOptions.handlerOptions || {}
|
|
86
|
-
const serverOptions = MCPOptions.serverOptions || {}
|
|
87
|
-
const useVerboseLogs = MCPHandlerOptions.verboseLogs ?? false
|
|
88
|
-
|
|
89
|
-
// Experimental MCP Tool Requirements
|
|
90
|
-
const isDevelopment = process.env.NODE_ENV === 'development'
|
|
91
|
-
const experimentalTools: NonNullable<MCPPluginConfig['experimental']>['tools'] =
|
|
92
|
-
pluginOptions?.experimental?.tools || {}
|
|
93
|
-
const collectionsPluginConfig = pluginOptions.collections || {}
|
|
94
|
-
const globalsPluginConfig = pluginOptions.globals || {}
|
|
95
|
-
const collectionsDirPath =
|
|
96
|
-
experimentalTools && experimentalTools.collections?.collectionsDirPath
|
|
97
|
-
? experimentalTools.collections.collectionsDirPath
|
|
98
|
-
: join(process.cwd(), 'src/collections')
|
|
99
|
-
const configFilePath =
|
|
100
|
-
experimentalTools && experimentalTools.config?.configFilePath
|
|
101
|
-
? experimentalTools.config.configFilePath
|
|
102
|
-
: join(process.cwd(), 'src/payload.config.ts')
|
|
103
|
-
const jobsDirPath =
|
|
104
|
-
experimentalTools && experimentalTools.jobs?.jobsDirPath
|
|
105
|
-
? experimentalTools.jobs.jobsDirPath
|
|
106
|
-
: join(process.cwd(), 'src/jobs')
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
return createMcpHandler(
|
|
110
|
-
(server) => {
|
|
111
|
-
// Get enabled collections
|
|
112
|
-
const enabledCollectionSlugs = getEnabledSlugs(collectionsPluginConfig, 'collection')
|
|
113
|
-
|
|
114
|
-
// Collection Operation Tools
|
|
115
|
-
enabledCollectionSlugs.forEach((enabledCollectionSlug) => {
|
|
116
|
-
try {
|
|
117
|
-
const rawSchema = configSchema.definitions?.[enabledCollectionSlug] as JSONSchema4
|
|
118
|
-
|
|
119
|
-
const virtualFieldNames = getCollectionVirtualFieldNames(
|
|
120
|
-
payload.config,
|
|
121
|
-
enabledCollectionSlug,
|
|
122
|
-
)
|
|
123
|
-
const schema = removeVirtualFieldsFromSchema(
|
|
124
|
-
JSON.parse(JSON.stringify(rawSchema)) as JSONSchema4,
|
|
125
|
-
virtualFieldNames,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
const toolCapabilities = mcpAccessSettings?.[
|
|
129
|
-
`${toCamelCase(enabledCollectionSlug)}`
|
|
130
|
-
] as Record<string, unknown>
|
|
131
|
-
const allowCreate: boolean | undefined = toolCapabilities?.create as boolean
|
|
132
|
-
const allowUpdate: boolean | undefined = toolCapabilities?.update as boolean
|
|
133
|
-
const allowFind: boolean | undefined = toolCapabilities?.find as boolean
|
|
134
|
-
const allowDelete: boolean | undefined = toolCapabilities?.delete as boolean
|
|
135
|
-
|
|
136
|
-
if (allowCreate) {
|
|
137
|
-
registerTool(
|
|
138
|
-
allowCreate,
|
|
139
|
-
`Create ${enabledCollectionSlug}`,
|
|
140
|
-
() =>
|
|
141
|
-
createResourceTool(
|
|
142
|
-
server,
|
|
143
|
-
req,
|
|
144
|
-
user,
|
|
145
|
-
useVerboseLogs,
|
|
146
|
-
enabledCollectionSlug,
|
|
147
|
-
collectionsPluginConfig,
|
|
148
|
-
schema,
|
|
149
|
-
),
|
|
150
|
-
payload,
|
|
151
|
-
useVerboseLogs,
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
if (allowUpdate) {
|
|
155
|
-
registerTool(
|
|
156
|
-
allowUpdate,
|
|
157
|
-
`Update ${enabledCollectionSlug}`,
|
|
158
|
-
() =>
|
|
159
|
-
updateResourceTool(
|
|
160
|
-
server,
|
|
161
|
-
req,
|
|
162
|
-
user,
|
|
163
|
-
useVerboseLogs,
|
|
164
|
-
enabledCollectionSlug,
|
|
165
|
-
collectionsPluginConfig,
|
|
166
|
-
schema,
|
|
167
|
-
),
|
|
168
|
-
payload,
|
|
169
|
-
useVerboseLogs,
|
|
170
|
-
)
|
|
171
|
-
}
|
|
172
|
-
if (allowFind) {
|
|
173
|
-
registerTool(
|
|
174
|
-
allowFind,
|
|
175
|
-
`Find ${enabledCollectionSlug}`,
|
|
176
|
-
() =>
|
|
177
|
-
findResourceTool(
|
|
178
|
-
server,
|
|
179
|
-
req,
|
|
180
|
-
user,
|
|
181
|
-
useVerboseLogs,
|
|
182
|
-
enabledCollectionSlug,
|
|
183
|
-
collectionsPluginConfig,
|
|
184
|
-
),
|
|
185
|
-
payload,
|
|
186
|
-
useVerboseLogs,
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
if (allowDelete) {
|
|
190
|
-
registerTool(
|
|
191
|
-
allowDelete,
|
|
192
|
-
`Delete ${enabledCollectionSlug}`,
|
|
193
|
-
() =>
|
|
194
|
-
deleteResourceTool(
|
|
195
|
-
server,
|
|
196
|
-
req,
|
|
197
|
-
user,
|
|
198
|
-
useVerboseLogs,
|
|
199
|
-
enabledCollectionSlug,
|
|
200
|
-
collectionsPluginConfig,
|
|
201
|
-
),
|
|
202
|
-
payload,
|
|
203
|
-
useVerboseLogs,
|
|
204
|
-
)
|
|
205
|
-
}
|
|
206
|
-
} catch (error) {
|
|
207
|
-
throw new APIError(
|
|
208
|
-
`Error registering tools for collection ${enabledCollectionSlug}: ${String(error)}`,
|
|
209
|
-
500,
|
|
210
|
-
)
|
|
211
|
-
}
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
// Global Operation Tools
|
|
215
|
-
const enabledGlobalSlugs = getEnabledSlugs(globalsPluginConfig, 'global')
|
|
216
|
-
|
|
217
|
-
enabledGlobalSlugs.forEach((enabledGlobalSlug) => {
|
|
218
|
-
try {
|
|
219
|
-
const rawSchema = configSchema.definitions?.[enabledGlobalSlug] as JSONSchema4
|
|
220
|
-
|
|
221
|
-
const virtualFieldNames = getGlobalVirtualFieldNames(payload.config, enabledGlobalSlug)
|
|
222
|
-
const schema = removeVirtualFieldsFromSchema(
|
|
223
|
-
JSON.parse(JSON.stringify(rawSchema)) as JSONSchema4,
|
|
224
|
-
virtualFieldNames,
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
const toolCapabilities = mcpAccessSettings?.[
|
|
228
|
-
`${toCamelCase(enabledGlobalSlug)}`
|
|
229
|
-
] as Record<string, unknown>
|
|
230
|
-
const allowFind: boolean | undefined = toolCapabilities?.['find'] as boolean
|
|
231
|
-
const allowUpdate: boolean | undefined = toolCapabilities?.['update'] as boolean
|
|
232
|
-
|
|
233
|
-
if (allowFind) {
|
|
234
|
-
registerTool(
|
|
235
|
-
allowFind,
|
|
236
|
-
`Find ${enabledGlobalSlug}`,
|
|
237
|
-
() =>
|
|
238
|
-
findGlobalTool(
|
|
239
|
-
server,
|
|
240
|
-
req,
|
|
241
|
-
user,
|
|
242
|
-
useVerboseLogs,
|
|
243
|
-
enabledGlobalSlug,
|
|
244
|
-
globalsPluginConfig,
|
|
245
|
-
),
|
|
246
|
-
payload,
|
|
247
|
-
useVerboseLogs,
|
|
248
|
-
)
|
|
249
|
-
}
|
|
250
|
-
if (allowUpdate) {
|
|
251
|
-
registerTool(
|
|
252
|
-
allowUpdate,
|
|
253
|
-
`Update ${enabledGlobalSlug}`,
|
|
254
|
-
() =>
|
|
255
|
-
updateGlobalTool(
|
|
256
|
-
server,
|
|
257
|
-
req,
|
|
258
|
-
user,
|
|
259
|
-
useVerboseLogs,
|
|
260
|
-
enabledGlobalSlug,
|
|
261
|
-
globalsPluginConfig,
|
|
262
|
-
schema,
|
|
263
|
-
),
|
|
264
|
-
payload,
|
|
265
|
-
useVerboseLogs,
|
|
266
|
-
)
|
|
267
|
-
}
|
|
268
|
-
} catch (error) {
|
|
269
|
-
throw new APIError(
|
|
270
|
-
`Error registering tools for global ${enabledGlobalSlug}: ${String(error)}`,
|
|
271
|
-
500,
|
|
272
|
-
)
|
|
273
|
-
}
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
// Custom tools
|
|
277
|
-
customMCPTools.forEach((tool) => {
|
|
278
|
-
const camelCasedToolName = toCamelCase(tool.name)
|
|
279
|
-
const isToolEnabled = mcpAccessSettings['payload-mcp-tool']?.[camelCasedToolName] ?? false
|
|
280
|
-
|
|
281
|
-
registerTool(
|
|
282
|
-
isToolEnabled,
|
|
283
|
-
tool.name,
|
|
284
|
-
() =>
|
|
285
|
-
server.registerTool(
|
|
286
|
-
tool.name,
|
|
287
|
-
{
|
|
288
|
-
description: tool.description,
|
|
289
|
-
inputSchema: tool.parameters,
|
|
290
|
-
},
|
|
291
|
-
payloadToolHandler(tool.handler),
|
|
292
|
-
),
|
|
293
|
-
payload,
|
|
294
|
-
useVerboseLogs,
|
|
295
|
-
)
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
// Custom prompts
|
|
299
|
-
customMCPPrompts.forEach((prompt) => {
|
|
300
|
-
const camelCasedPromptName = toCamelCase(prompt.name)
|
|
301
|
-
const isPromptEnabled =
|
|
302
|
-
mcpAccessSettings['payload-mcp-prompt']?.[camelCasedPromptName] ?? false
|
|
303
|
-
|
|
304
|
-
if (isPromptEnabled) {
|
|
305
|
-
server.registerPrompt(
|
|
306
|
-
prompt.name,
|
|
307
|
-
{
|
|
308
|
-
argsSchema: prompt.argsSchema,
|
|
309
|
-
description: prompt.description,
|
|
310
|
-
title: prompt.title,
|
|
311
|
-
},
|
|
312
|
-
payloadPromptHandler(prompt.handler),
|
|
313
|
-
)
|
|
314
|
-
if (useVerboseLogs) {
|
|
315
|
-
payload.logger.info(`[payload-mcp] ✅ Prompt: ${prompt.title} Registered.`)
|
|
316
|
-
}
|
|
317
|
-
} else if (useVerboseLogs) {
|
|
318
|
-
payload.logger.info(`[payload-mcp] ⏭️ Prompt: ${prompt.title} Skipped.`)
|
|
319
|
-
}
|
|
320
|
-
})
|
|
321
|
-
|
|
322
|
-
// Custom resources
|
|
323
|
-
customMCPResources.forEach((resource) => {
|
|
324
|
-
const camelCasedResourceName = toCamelCase(resource.name)
|
|
325
|
-
const isResourceEnabled =
|
|
326
|
-
mcpAccessSettings['payload-mcp-resource']?.[camelCasedResourceName] ?? false
|
|
327
|
-
|
|
328
|
-
if (isResourceEnabled) {
|
|
329
|
-
server.registerResource(
|
|
330
|
-
resource.name,
|
|
331
|
-
// @ts-expect-error - Overload type is not working however -- ResourceTemplate OR String is a valid type
|
|
332
|
-
resource.uri,
|
|
333
|
-
{
|
|
334
|
-
description: resource.description,
|
|
335
|
-
mimeType: resource.mimeType,
|
|
336
|
-
title: resource.title,
|
|
337
|
-
},
|
|
338
|
-
payloadResourceHandler(resource.handler),
|
|
339
|
-
)
|
|
340
|
-
|
|
341
|
-
if (useVerboseLogs) {
|
|
342
|
-
payload.logger.info(`[payload-mcp] ✅ Resource: ${resource.title} Registered.`)
|
|
343
|
-
}
|
|
344
|
-
} else if (useVerboseLogs) {
|
|
345
|
-
payload.logger.info(`[payload-mcp] ⏭️ Resource: ${resource.title} Skipped.`)
|
|
346
|
-
}
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
// Experimental - Collection Schema Modfication Tools
|
|
350
|
-
if (
|
|
351
|
-
mcpAccessSettings.collections?.create &&
|
|
352
|
-
experimentalTools.collections?.enabled &&
|
|
353
|
-
isDevelopment
|
|
354
|
-
) {
|
|
355
|
-
registerTool(
|
|
356
|
-
mcpAccessSettings.collections.create,
|
|
357
|
-
'Create Collection',
|
|
358
|
-
() =>
|
|
359
|
-
createCollectionTool(server, req, useVerboseLogs, collectionsDirPath, configFilePath),
|
|
360
|
-
payload,
|
|
361
|
-
useVerboseLogs,
|
|
362
|
-
)
|
|
363
|
-
}
|
|
364
|
-
if (
|
|
365
|
-
mcpAccessSettings.collections?.delete &&
|
|
366
|
-
experimentalTools.collections?.enabled &&
|
|
367
|
-
isDevelopment
|
|
368
|
-
) {
|
|
369
|
-
registerTool(
|
|
370
|
-
mcpAccessSettings.collections.delete,
|
|
371
|
-
'Delete Collection',
|
|
372
|
-
() =>
|
|
373
|
-
deleteCollectionTool(server, req, useVerboseLogs, collectionsDirPath, configFilePath),
|
|
374
|
-
payload,
|
|
375
|
-
useVerboseLogs,
|
|
376
|
-
)
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if (
|
|
380
|
-
mcpAccessSettings.collections?.find &&
|
|
381
|
-
experimentalTools.collections?.enabled &&
|
|
382
|
-
isDevelopment
|
|
383
|
-
) {
|
|
384
|
-
registerTool(
|
|
385
|
-
mcpAccessSettings.collections.find,
|
|
386
|
-
'Find Collection',
|
|
387
|
-
() => findCollectionTool(server, req, useVerboseLogs, collectionsDirPath),
|
|
388
|
-
payload,
|
|
389
|
-
useVerboseLogs,
|
|
390
|
-
)
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (
|
|
394
|
-
mcpAccessSettings.collections?.update &&
|
|
395
|
-
experimentalTools.collections?.enabled &&
|
|
396
|
-
isDevelopment
|
|
397
|
-
) {
|
|
398
|
-
registerTool(
|
|
399
|
-
mcpAccessSettings.collections.update,
|
|
400
|
-
'Update Collection',
|
|
401
|
-
() =>
|
|
402
|
-
updateCollectionTool(server, req, useVerboseLogs, collectionsDirPath, configFilePath),
|
|
403
|
-
payload,
|
|
404
|
-
useVerboseLogs,
|
|
405
|
-
)
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// Experimental - Payload Config Modification Tools
|
|
409
|
-
if (mcpAccessSettings.config?.find && experimentalTools.config?.enabled && isDevelopment) {
|
|
410
|
-
registerTool(
|
|
411
|
-
mcpAccessSettings.config.find,
|
|
412
|
-
'Find Config',
|
|
413
|
-
() => findConfigTool(server, req, useVerboseLogs, configFilePath),
|
|
414
|
-
payload,
|
|
415
|
-
useVerboseLogs,
|
|
416
|
-
)
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
if (
|
|
420
|
-
mcpAccessSettings.config?.update &&
|
|
421
|
-
experimentalTools.config?.enabled &&
|
|
422
|
-
isDevelopment
|
|
423
|
-
) {
|
|
424
|
-
registerTool(
|
|
425
|
-
mcpAccessSettings.config.update,
|
|
426
|
-
'Update Config',
|
|
427
|
-
() => updateConfigTool(server, req, useVerboseLogs, configFilePath),
|
|
428
|
-
payload,
|
|
429
|
-
useVerboseLogs,
|
|
430
|
-
)
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// Experimental - Job Modification Tools
|
|
434
|
-
if (mcpAccessSettings.jobs?.create && experimentalTools.jobs?.enabled && isDevelopment) {
|
|
435
|
-
registerTool(
|
|
436
|
-
mcpAccessSettings.jobs.create,
|
|
437
|
-
'Create Job',
|
|
438
|
-
() => createJobTool(server, req, useVerboseLogs, jobsDirPath),
|
|
439
|
-
payload,
|
|
440
|
-
useVerboseLogs,
|
|
441
|
-
)
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (mcpAccessSettings.jobs?.update && experimentalTools.jobs?.enabled && isDevelopment) {
|
|
445
|
-
registerTool(
|
|
446
|
-
mcpAccessSettings.jobs.update,
|
|
447
|
-
'Update Job',
|
|
448
|
-
() => updateJobTool(server, req, useVerboseLogs, jobsDirPath),
|
|
449
|
-
payload,
|
|
450
|
-
useVerboseLogs,
|
|
451
|
-
)
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
if (mcpAccessSettings.jobs?.run && experimentalTools.jobs?.enabled && isDevelopment) {
|
|
455
|
-
registerTool(
|
|
456
|
-
mcpAccessSettings.jobs.run,
|
|
457
|
-
'Run Job',
|
|
458
|
-
() => runJobTool(server, req, useVerboseLogs),
|
|
459
|
-
payload,
|
|
460
|
-
useVerboseLogs,
|
|
461
|
-
)
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
// Experimental - Auth Modification Tools
|
|
465
|
-
if (mcpAccessSettings.auth?.auth && experimentalTools.auth?.enabled && isDevelopment) {
|
|
466
|
-
registerTool(
|
|
467
|
-
mcpAccessSettings.auth.auth,
|
|
468
|
-
'Auth',
|
|
469
|
-
() => authTool(server, req, useVerboseLogs),
|
|
470
|
-
payload,
|
|
471
|
-
useVerboseLogs,
|
|
472
|
-
)
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
if (mcpAccessSettings.auth?.login && experimentalTools.auth?.enabled && isDevelopment) {
|
|
476
|
-
registerTool(
|
|
477
|
-
mcpAccessSettings.auth.login,
|
|
478
|
-
'Login',
|
|
479
|
-
() => loginTool(server, req, useVerboseLogs),
|
|
480
|
-
payload,
|
|
481
|
-
useVerboseLogs,
|
|
482
|
-
)
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
if (mcpAccessSettings.auth?.verify && experimentalTools.auth?.enabled && isDevelopment) {
|
|
486
|
-
registerTool(
|
|
487
|
-
mcpAccessSettings.auth.verify,
|
|
488
|
-
'Verify',
|
|
489
|
-
() => verifyTool(server, req, useVerboseLogs),
|
|
490
|
-
payload,
|
|
491
|
-
useVerboseLogs,
|
|
492
|
-
)
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
if (mcpAccessSettings.auth?.resetPassword && experimentalTools.auth?.enabled) {
|
|
496
|
-
registerTool(
|
|
497
|
-
mcpAccessSettings.auth.resetPassword,
|
|
498
|
-
'Reset Password',
|
|
499
|
-
() => resetPasswordTool(server, req, useVerboseLogs),
|
|
500
|
-
payload,
|
|
501
|
-
useVerboseLogs,
|
|
502
|
-
)
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
if (mcpAccessSettings.auth?.forgotPassword && experimentalTools.auth?.enabled) {
|
|
506
|
-
registerTool(
|
|
507
|
-
mcpAccessSettings.auth.forgotPassword,
|
|
508
|
-
'Forgot Password',
|
|
509
|
-
() => forgotPasswordTool(server, req, useVerboseLogs),
|
|
510
|
-
payload,
|
|
511
|
-
useVerboseLogs,
|
|
512
|
-
)
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
if (mcpAccessSettings.auth?.unlock && experimentalTools.auth?.enabled) {
|
|
516
|
-
registerTool(
|
|
517
|
-
mcpAccessSettings.auth.unlock,
|
|
518
|
-
'Unlock',
|
|
519
|
-
() => unlockTool(server, req, useVerboseLogs),
|
|
520
|
-
payload,
|
|
521
|
-
useVerboseLogs,
|
|
522
|
-
)
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
if (useVerboseLogs) {
|
|
526
|
-
payload.logger.info('[payload-mcp] 🚀 MCP Server Ready.')
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
instructions: serverOptions.instructions,
|
|
531
|
-
serverInfo: serverOptions.serverInfo,
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
basePath: MCPHandlerOptions.basePath || payload.config.routes?.api || '/api',
|
|
535
|
-
disableSse: MCPHandlerOptions.disableSse ?? true,
|
|
536
|
-
maxDuration: MCPHandlerOptions.maxDuration || 60,
|
|
537
|
-
onEvent: MCPHandlerOptions.onEvent,
|
|
538
|
-
redisUrl: MCPHandlerOptions.redisUrl,
|
|
539
|
-
verboseLogs: useVerboseLogs,
|
|
540
|
-
},
|
|
541
|
-
)
|
|
542
|
-
} catch (error) {
|
|
543
|
-
throw new APIError(`Error initializing MCP handler: ${String(error)}`, 500)
|
|
544
|
-
}
|
|
545
|
-
}
|