@payloadcms/plugin-mcp 4.0.0-internal.a0ef1b8 → 4.0.0-internal.add4c47
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 +7 -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 +8 -8
- package/dist/defineTool.d.ts.map +1 -1
- package/dist/endpoint/access.d.ts +12 -5
- package/dist/endpoint/access.d.ts.map +1 -1
- package/dist/endpoint/access.js +75 -88
- package/dist/endpoint/access.js.map +1 -1
- package/dist/endpoint/index.d.ts +1 -1
- package/dist/endpoint/index.d.ts.map +1 -1
- package/dist/endpoint/index.js +68 -17
- package/dist/endpoint/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- 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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -20
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +4 -4
- package/dist/mcp/buildMcpServer.d.ts.map +1 -1
- package/dist/mcp/buildMcpServer.js +133 -80
- package/dist/mcp/buildMcpServer.js.map +1 -1
- package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/authTools.js +44 -6
- package/dist/mcp/builtin/collections/authTools.js.map +1 -1
- package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countTool.js +68 -0
- package/dist/mcp/builtin/collections/countTool.js.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js +64 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/createTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/createTool.js +50 -45
- package/dist/mcp/builtin/collections/createTool.js.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.js +15 -22
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
- package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.js +96 -0
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts +28 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.js +117 -0
- package/dist/mcp/builtin/collections/fileInput.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js +86 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js +92 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findTool.js +52 -47
- package/dist/mcp/builtin/collections/findTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js +83 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js +98 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +9 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.js +60 -0
- package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +87 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js +81 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/updateTool.js +106 -93
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js +55 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts +2 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.js +68 -0
- package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js +64 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findTool.js +20 -23
- package/dist/mcp/builtin/globals/findTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +79 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js +94 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +65 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js +77 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/updateTool.js +33 -42
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
- package/dist/mcp/builtin/validateEntityData.d.ts +14 -0
- package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -0
- package/dist/mcp/builtin/validateEntityData.js +82 -0
- package/dist/mcp/builtin/validateEntityData.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +150 -19
- package/dist/mcp/builtinTools.d.ts.map +1 -1
- package/dist/mcp/builtinTools.js +125 -20
- package/dist/mcp/builtinTools.js.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts +0 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.js +124 -58
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -1
- package/dist/stdio.d.ts +3 -3
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +84 -46
- package/dist/stdio.js.map +1 -1
- package/dist/types.d.ts +112 -110
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/camelCase.d.ts.map +1 -1
- package/dist/utils/getPluginConfig.d.ts +1 -1
- package/dist/utils/getPluginConfig.js +1 -1
- package/dist/utils/getPluginConfig.js.map +1 -1
- package/dist/utils/resolveProjectRoot.d.ts.map +1 -1
- package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts +28 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts.map +1 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js +71 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +13 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.js +66 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.js.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +5 -10
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +15 -95
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +15 -40
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -1
- package/dist/utils/toStandardSchema.d.ts.map +1 -1
- package/dist/utils/whereSchema.d.ts +9 -0
- package/dist/utils/whereSchema.d.ts.map +1 -0
- package/dist/utils/whereSchema.js +13 -0
- package/dist/utils/whereSchema.js.map +1 -0
- package/package.json +10 -15
- package/src/defaultAccess.ts +3 -0
- package/src/endpoint/access.ts +81 -101
- package/src/endpoint/index.ts +58 -16
- package/src/exports/client.ts +2 -1
- package/src/exports/internal.ts +1 -0
- package/src/index.ts +12 -20
- package/src/mcp/buildMcpServer.ts +170 -115
- package/src/mcp/builtin/collections/authTools.ts +45 -9
- package/src/mcp/builtin/collections/countTool.ts +73 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +69 -0
- package/src/mcp/builtin/collections/createTool.ts +67 -62
- package/src/mcp/builtin/collections/deleteTool.ts +20 -18
- package/src/mcp/builtin/collections/duplicateTool.ts +134 -0
- package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
- package/src/mcp/builtin/collections/fileInput.ts +154 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +119 -0
- package/src/mcp/builtin/collections/findTool.ts +66 -37
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +109 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +154 -0
- package/src/mcp/builtin/collections/formatCollectionError.ts +84 -0
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +80 -0
- package/src/mcp/builtin/collections/restoreVersionTool.ts +107 -0
- package/src/mcp/builtin/collections/updateTool.ts +132 -115
- package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +67 -0
- package/src/mcp/builtin/globals/countVersionsTool.ts +68 -0
- package/src/mcp/builtin/globals/findTool.ts +28 -19
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +103 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +147 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +63 -0
- package/src/mcp/builtin/globals/restoreVersionTool.ts +99 -0
- package/src/mcp/builtin/globals/updateTool.ts +52 -57
- package/src/mcp/builtin/validateEntityData.ts +132 -0
- package/src/mcp/builtinTools.ts +118 -41
- package/src/mcp/sanitizeMCPConfig.ts +120 -78
- package/src/stdio.ts +79 -46
- package/src/types.ts +128 -115
- package/src/utils/getPluginConfig.ts +1 -1
- package/src/utils/schemaConversion/filterFieldsByAccess.ts +123 -0
- package/src/utils/schemaConversion/getEntityInputSchema.ts +96 -0
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +12 -19
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +17 -114
- package/src/utils/whereSchema.ts +24 -0
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/collection/getAccessField.d.ts +0 -12
- package/dist/collection/getAccessField.d.ts.map +0 -1
- package/dist/collection/getAccessField.js +0 -57
- package/dist/collection/getAccessField.js.map +0 -1
- package/dist/collection/index.d.ts +0 -6
- package/dist/collection/index.d.ts.map +0 -1
- package/dist/collection/index.js +0 -60
- package/dist/collection/index.js.map +0 -1
- package/dist/components/AccessField/index.client.d.ts +0 -10
- package/dist/components/AccessField/index.client.d.ts.map +0 -1
- package/dist/components/AccessField/index.client.js +0 -305
- package/dist/components/AccessField/index.client.js.map +0 -1
- package/dist/components/AccessField/index.css +0 -93
- package/dist/utils/localAPIDefaults.d.ts +0 -20
- package/dist/utils/localAPIDefaults.d.ts.map +0 -1
- package/dist/utils/localAPIDefaults.js +0 -19
- package/dist/utils/localAPIDefaults.js.map +0 -1
- package/dist/utils/schemaConversion/buildToolInput.d.ts +0 -29
- package/dist/utils/schemaConversion/buildToolInput.d.ts.map +0 -1
- package/dist/utils/schemaConversion/buildToolInput.js +0 -51
- package/dist/utils/schemaConversion/buildToolInput.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/src/@types/assets.d.ts +0 -3
- package/src/collection/getAccessField.ts +0 -64
- package/src/collection/index.ts +0 -64
- package/src/components/AccessField/index.client.tsx +0 -344
- package/src/components/AccessField/index.css +0 -93
- package/src/utils/localAPIDefaults.ts +0 -22
- package/src/utils/schemaConversion/buildToolInput.ts +0 -68
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
package/dist/stdio.js
CHANGED
|
@@ -1,76 +1,114 @@
|
|
|
1
|
-
/* eslint-disable no-console */ import {
|
|
1
|
+
/* eslint-disable no-console */ import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { createLocalReq, getPayload } from 'payload';
|
|
4
|
-
import { findConfig } from 'payload/node';
|
|
4
|
+
import { findConfig, loadEnv } from 'payload/node';
|
|
5
|
+
import { getAuthorizedMCP } from './endpoint/access.js';
|
|
5
6
|
import { buildMcpServer } from './mcp/buildMcpServer.js';
|
|
6
7
|
import { sanitizeMCPConfig } from './mcp/sanitizeMCPConfig.js';
|
|
7
8
|
import { getPluginConfig } from './utils/getPluginConfig.js';
|
|
8
9
|
import { resolveProjectRoot } from './utils/resolveProjectRoot.js';
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Starts Payload's MCP server over stdin and stdout.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* Set `PAYLOAD_MCP_AUTHORIZATION` to authenticate. In development,
|
|
14
|
+
* `PAYLOAD_MCP_OVERRIDE_ACCESS=true` skips access checks.
|
|
14
15
|
*/ export const runMcpStdio = async ()=>{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* its own. This module always lives inside the project's `node_modules`, so
|
|
19
|
-
* we derive the project root from its own path and `chdir` into it.
|
|
20
|
-
*
|
|
21
|
-
* An absolute `PAYLOAD_CONFIG_PATH` still overrides everything; unusual
|
|
22
|
-
* layouts (e.g. a monorepo where the package is hoisted above the app) can
|
|
23
|
-
* fall back to it. See the implementation of findConfig for details.
|
|
24
|
-
*/ const projectRoot = resolveProjectRoot(fileURLToPath(import.meta.url));
|
|
16
|
+
// MCP clients may start this command from another folder. Move to the Payload
|
|
17
|
+
// project so findConfig() can find the config.
|
|
18
|
+
const projectRoot = resolveProjectRoot(fileURLToPath(import.meta.url));
|
|
25
19
|
if (projectRoot) {
|
|
26
20
|
process.chdir(projectRoot);
|
|
27
21
|
}
|
|
22
|
+
loadEnv();
|
|
28
23
|
const configPath = findConfig();
|
|
29
24
|
const configModule = await import(pathToFileURL(configPath).toString());
|
|
30
25
|
const config = await (configModule.default ?? configModule);
|
|
26
|
+
/**
|
|
27
|
+
* stdout is only for MCP messages. The spec says the server must not write
|
|
28
|
+
* logs there and may write them to stderr instead.
|
|
29
|
+
*
|
|
30
|
+
* The 2.0 client library recovers from stray stdout logs, but that behavior is not
|
|
31
|
+
* guaranteed. Move Payload logs to stderr so Payload does not add invalid data
|
|
32
|
+
* to stdout. Keep options from configurable loggers. Replace pre-built loggers
|
|
33
|
+
* because their output cannot be redirected.
|
|
34
|
+
*
|
|
35
|
+
* @see https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#stdio
|
|
36
|
+
*/ const loggerConfig = config;
|
|
37
|
+
if (loggerConfig.logger && typeof loggerConfig.logger === 'object' && 'options' in loggerConfig.logger) {
|
|
38
|
+
loggerConfig.logger.destination = process.stderr;
|
|
39
|
+
} else {
|
|
40
|
+
loggerConfig.logger = {
|
|
41
|
+
destination: process.stderr,
|
|
42
|
+
options: {}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
31
45
|
const payload = await getPayload({
|
|
32
|
-
config
|
|
46
|
+
config,
|
|
47
|
+
cron: false,
|
|
48
|
+
disableOnInit: true
|
|
33
49
|
});
|
|
34
|
-
|
|
35
|
-
* If the user added `mcpPlugin({...})` to their `plugins` array, read the
|
|
36
|
-
* sanitized config they registered. Otherwise fall back to the defaults. That way,
|
|
37
|
-
* the mcp works on any project that has `@payloadcms/plugin-mcp` installed,
|
|
38
|
-
* even if the plugin is not added to the plugins array.
|
|
39
|
-
*/ let pluginConfig;
|
|
50
|
+
let pluginConfig;
|
|
40
51
|
try {
|
|
41
52
|
pluginConfig = getPluginConfig({
|
|
42
53
|
config: payload.config
|
|
43
54
|
});
|
|
44
55
|
} catch {
|
|
56
|
+
// The command also works when mcpPlugin() is not in the Payload config.
|
|
45
57
|
pluginConfig = sanitizeMCPConfig({
|
|
46
58
|
config: payload.config,
|
|
47
59
|
pluginConfig: {}
|
|
48
60
|
});
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
const fallbackPlugin = (config)=>config;
|
|
62
|
+
Object.assign(fallbackPlugin, {
|
|
63
|
+
slug: '@payloadcms/plugin-mcp',
|
|
64
|
+
sanitizedOptions: pluginConfig
|
|
65
|
+
});
|
|
66
|
+
payload.config.plugins ??= [];
|
|
67
|
+
payload.config.plugins.push(fallbackPlugin);
|
|
54
68
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
69
|
+
const overrideAccessEnv = process.env.PAYLOAD_MCP_OVERRIDE_ACCESS;
|
|
70
|
+
let overrideAccess = false;
|
|
71
|
+
if (overrideAccessEnv === 'true') {
|
|
72
|
+
overrideAccess = true;
|
|
73
|
+
} else if (overrideAccessEnv && overrideAccessEnv !== 'false') {
|
|
74
|
+
throw new Error('PAYLOAD_MCP_OVERRIDE_ACCESS must be "true" or "false".');
|
|
75
|
+
}
|
|
76
|
+
if (overrideAccess && process.env.NODE_ENV !== 'development') {
|
|
77
|
+
throw new Error('PAYLOAD_MCP_OVERRIDE_ACCESS is only available in development.');
|
|
78
|
+
}
|
|
79
|
+
const headers = new Headers();
|
|
80
|
+
if (process.env.PAYLOAD_MCP_AUTHORIZATION) {
|
|
81
|
+
headers.set('Authorization', process.env.PAYLOAD_MCP_AUTHORIZATION);
|
|
82
|
+
}
|
|
83
|
+
const req = await createLocalReq({
|
|
84
|
+
req: {
|
|
85
|
+
headers
|
|
86
|
+
}
|
|
87
|
+
}, payload);
|
|
61
88
|
req.payloadAPI = 'MCP';
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
pluginConfig,
|
|
89
|
+
const authorizedMCP = await getAuthorizedMCP({
|
|
90
|
+
overrideAccess,
|
|
65
91
|
req
|
|
66
92
|
});
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
const stdioServer = serveStdio(()=>buildMcpServer({
|
|
94
|
+
authorizedMCP,
|
|
95
|
+
pluginConfig,
|
|
96
|
+
req
|
|
97
|
+
}), {
|
|
98
|
+
onerror: (err)=>{
|
|
99
|
+
// MCP messages use stdout, so write SDK errors to stderr.
|
|
100
|
+
console.error('[payload-mcp] error serving MCP over stdio:', err);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// Close the MCP server and Payload when the client disconnects or the process stops.
|
|
104
|
+
let isShuttingDown = false;
|
|
105
|
+
const shutdown = async ()=>{
|
|
106
|
+
if (isShuttingDown) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
isShuttingDown = true;
|
|
72
110
|
try {
|
|
73
|
-
await
|
|
111
|
+
await stdioServer.close();
|
|
74
112
|
} catch (err) {
|
|
75
113
|
console.error('[payload-mcp] error closing server:', err);
|
|
76
114
|
}
|
|
@@ -79,11 +117,11 @@ import { resolveProjectRoot } from './utils/resolveProjectRoot.js';
|
|
|
79
117
|
} catch (err) {
|
|
80
118
|
console.error('[payload-mcp] error destroying payload:', err);
|
|
81
119
|
}
|
|
82
|
-
process.exit(
|
|
120
|
+
process.exit(0);
|
|
83
121
|
};
|
|
84
|
-
process.
|
|
85
|
-
process.
|
|
86
|
-
process.stdin.
|
|
122
|
+
process.once('SIGINT', ()=>void shutdown());
|
|
123
|
+
process.once('SIGTERM', ()=>void shutdown());
|
|
124
|
+
process.stdin.once('close', ()=>void shutdown());
|
|
87
125
|
};
|
|
88
126
|
|
|
89
127
|
//# sourceMappingURL=stdio.js.map
|
package/dist/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/stdio.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/stdio.ts"],"sourcesContent":["import type { Config, Plugin, SanitizedConfig } from 'payload'\n\n/* eslint-disable no-console */\nimport { serveStdio } from '@modelcontextprotocol/server/stdio'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { createLocalReq, getPayload } from 'payload'\nimport { findConfig, loadEnv } from 'payload/node'\n\nimport type { SanitizedMCPPluginConfig } from './types.js'\n\nimport { getAuthorizedMCP } from './endpoint/access.js'\nimport { buildMcpServer } from './mcp/buildMcpServer.js'\nimport { sanitizeMCPConfig } from './mcp/sanitizeMCPConfig.js'\nimport { getPluginConfig } from './utils/getPluginConfig.js'\nimport { resolveProjectRoot } from './utils/resolveProjectRoot.js'\n\n/**\n * Starts Payload's MCP server over stdin and stdout.\n *\n * Set `PAYLOAD_MCP_AUTHORIZATION` to authenticate. In development,\n * `PAYLOAD_MCP_OVERRIDE_ACCESS=true` skips access checks.\n */\nexport const runMcpStdio = async (): Promise<void> => {\n // MCP clients may start this command from another folder. Move to the Payload\n // project so findConfig() can find the config.\n const projectRoot = resolveProjectRoot(fileURLToPath(import.meta.url))\n if (projectRoot) {\n process.chdir(projectRoot)\n }\n\n loadEnv()\n const configPath = findConfig()\n const configModule = await import(pathToFileURL(configPath).toString())\n const config = (await (configModule.default ?? configModule)) as SanitizedConfig\n\n /**\n * stdout is only for MCP messages. The spec says the server must not write\n * logs there and may write them to stderr instead.\n *\n * The 2.0 client library recovers from stray stdout logs, but that behavior is not\n * guaranteed. Move Payload logs to stderr so Payload does not add invalid data\n * to stdout. Keep options from configurable loggers. Replace pre-built loggers\n * because their output cannot be redirected.\n *\n * @see https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#stdio\n */\n const loggerConfig: { logger?: Config['logger'] } = config\n if (\n loggerConfig.logger &&\n typeof loggerConfig.logger === 'object' &&\n 'options' in loggerConfig.logger\n ) {\n loggerConfig.logger.destination = process.stderr\n } else {\n loggerConfig.logger = { destination: process.stderr, options: {} }\n }\n\n const payload = await getPayload({ config, cron: false, disableOnInit: true })\n\n let pluginConfig: SanitizedMCPPluginConfig\n try {\n pluginConfig = getPluginConfig({ config: payload.config })\n } catch {\n // The command also works when mcpPlugin() is not in the Payload config.\n pluginConfig = sanitizeMCPConfig({ config: payload.config, pluginConfig: {} })\n\n const fallbackPlugin: Plugin = (config) => config\n Object.assign(fallbackPlugin, {\n slug: '@payloadcms/plugin-mcp',\n sanitizedOptions: pluginConfig,\n })\n payload.config.plugins ??= []\n payload.config.plugins.push(fallbackPlugin)\n }\n\n const overrideAccessEnv = process.env.PAYLOAD_MCP_OVERRIDE_ACCESS\n let overrideAccess = false\n\n if (overrideAccessEnv === 'true') {\n overrideAccess = true\n } else if (overrideAccessEnv && overrideAccessEnv !== 'false') {\n throw new Error('PAYLOAD_MCP_OVERRIDE_ACCESS must be \"true\" or \"false\".')\n }\n\n if (overrideAccess && process.env.NODE_ENV !== 'development') {\n throw new Error('PAYLOAD_MCP_OVERRIDE_ACCESS is only available in development.')\n }\n\n const headers = new Headers()\n if (process.env.PAYLOAD_MCP_AUTHORIZATION) {\n headers.set('Authorization', process.env.PAYLOAD_MCP_AUTHORIZATION)\n }\n\n const req = await createLocalReq({ req: { headers } }, payload)\n req.payloadAPI = 'MCP' as const\n const authorizedMCP = await getAuthorizedMCP({ overrideAccess, req })\n\n const stdioServer = serveStdio(() => buildMcpServer({ authorizedMCP, pluginConfig, req }), {\n onerror: (err) => {\n // MCP messages use stdout, so write SDK errors to stderr.\n console.error('[payload-mcp] error serving MCP over stdio:', err)\n },\n })\n\n // Close the MCP server and Payload when the client disconnects or the process stops.\n let isShuttingDown = false\n const shutdown = async () => {\n if (isShuttingDown) {\n return\n }\n isShuttingDown = true\n\n try {\n await stdioServer.close()\n } catch (err) {\n console.error('[payload-mcp] error closing server:', err)\n }\n\n try {\n await payload.destroy()\n } catch (err) {\n console.error('[payload-mcp] error destroying payload:', err)\n }\n\n process.exit(0)\n }\n\n process.once('SIGINT', () => void shutdown())\n process.once('SIGTERM', () => void shutdown())\n process.stdin.once('close', () => void shutdown())\n}\n"],"names":["serveStdio","fileURLToPath","pathToFileURL","createLocalReq","getPayload","findConfig","loadEnv","getAuthorizedMCP","buildMcpServer","sanitizeMCPConfig","getPluginConfig","resolveProjectRoot","runMcpStdio","projectRoot","url","process","chdir","configPath","configModule","toString","config","default","loggerConfig","logger","destination","stderr","options","payload","cron","disableOnInit","pluginConfig","fallbackPlugin","Object","assign","slug","sanitizedOptions","plugins","push","overrideAccessEnv","env","PAYLOAD_MCP_OVERRIDE_ACCESS","overrideAccess","Error","NODE_ENV","headers","Headers","PAYLOAD_MCP_AUTHORIZATION","set","req","payloadAPI","authorizedMCP","stdioServer","onerror","err","console","error","isShuttingDown","shutdown","close","destroy","exit","once","stdin"],"mappings":"AAEA,6BAA6B,GAC7B,SAASA,UAAU,QAAQ,qCAAoC;AAC/D,SAASC,aAAa,EAAEC,aAAa,QAAQ,WAAU;AACvD,SAASC,cAAc,EAAEC,UAAU,QAAQ,UAAS;AACpD,SAASC,UAAU,EAAEC,OAAO,QAAQ,eAAc;AAIlD,SAASC,gBAAgB,QAAQ,uBAAsB;AACvD,SAASC,cAAc,QAAQ,0BAAyB;AACxD,SAASC,iBAAiB,QAAQ,6BAA4B;AAC9D,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,kBAAkB,QAAQ,gCAA+B;AAElE;;;;;CAKC,GACD,OA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IAAII,MAAM;IAClB;IAEA,IAAID,kBAAkB1B,QAAQwB,GAAG,CAACI,QAAQ,KAAK,eAAe;QAC5D,MAAM,IAAID,MAAM;IAClB;IAEA,MAAME,UAAU,IAAIC;IACpB,IAAI9B,QAAQwB,GAAG,CAACO,yBAAyB,EAAE;QACzCF,QAAQG,GAAG,CAAC,iBAAiBhC,QAAQwB,GAAG,CAACO,yBAAyB;IACpE;IAEA,MAAME,MAAM,MAAM7C,eAAe;QAAE6C,KAAK;YAAEJ;QAAQ;IAAE,GAAGjB;IACvDqB,IAAIC,UAAU,GAAG;IACjB,MAAMC,gBAAgB,MAAM3C,iBAAiB;QAAEkC;QAAgBO;IAAI;IAEnE,MAAMG,cAAcnD,WAAW,IAAMQ,eAAe;YAAE0C;YAAepB;YAAckB;QAAI,IAAI;QACzFI,SAAS,CAACC;YACR,0DAA0D;YAC1DC,QAAQC,KAAK,CAAC,+CAA+CF;QAC/D;IACF;IAEA,qFAAqF;IACrF,IAAIG,iBAAiB;IACrB,MAAMC,WAAW;QACf,IAAID,gBAAgB;YAClB;QACF;QACAA,iBAAiB;QAEjB,IAAI;YACF,MAAML,YAAYO,KAAK;QACzB,EAAE,OAAOL,KAAK;YACZC,QAAQC,KAAK,CAAC,uCAAuCF;QACvD;QAEA,IAAI;YACF,MAAM1B,QAAQgC,OAAO;QACvB,EAAE,OAAON,KAAK;YACZC,QAAQC,KAAK,CAAC,2CAA2CF;QAC3D;QAEAtC,QAAQ6C,IAAI,CAAC;IACf;IAEA7C,QAAQ8C,IAAI,CAAC,UAAU,IAAM,KAAKJ;IAClC1C,QAAQ8C,IAAI,CAAC,WAAW,IAAM,KAAKJ;IACnC1C,QAAQ+C,KAAK,CAACD,IAAI,CAAC,SAAS,IAAM,KAAKJ;AACzC,EAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
import type { CallToolResult, ContentBlock, JsonSchemaType, McpServer, ResourceTemplate, ServerContext, StandardSchemaWithJSON } from '@modelcontextprotocol/server';
|
|
2
|
-
import type { AuthCollectionSlug,
|
|
1
|
+
import type { CallToolResult, ContentBlock, JsonSchemaType, McpServer, ResourceTemplate, ServerContext, StandardSchemaWithJSON, ToolAnnotations } from '@modelcontextprotocol/server';
|
|
2
|
+
import type { AuthCollectionSlug, CollectionSlug, GlobalSlug, MaybePromise, PayloadRequest, SanitizedPermissions } from 'payload';
|
|
3
|
+
import type { GetAuthorizedMCPArgs } from './endpoint/access.js';
|
|
3
4
|
import type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName } from './mcp/builtinTools.js';
|
|
4
5
|
export type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName };
|
|
5
|
-
/** Re-exported from `@modelcontextprotocol/server` —
|
|
6
|
-
export type { JsonSchemaType, StandardSchemaWithJSON };
|
|
6
|
+
/** Re-exported from `@modelcontextprotocol/server` — common MCP types used in plugin config. */
|
|
7
|
+
export type { JsonSchemaType, StandardSchemaWithJSON, ToolAnnotations };
|
|
7
8
|
/**
|
|
8
9
|
* What a tool's `input` (or a prompt's `argsSchema`) can be — either a raw
|
|
9
|
-
* JSON Schema literal, or a Standard Schema instance (Zod, Valibot, …).
|
|
10
|
+
* JSON Schema 2020-12 literal, or a Standard Schema instance (Zod, Valibot, …).
|
|
11
|
+
* Raw schemas may omit `$schema`; when present it must declare the 2020-12 dialect.
|
|
10
12
|
*/
|
|
11
13
|
export type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON;
|
|
12
|
-
/**
|
|
13
|
-
* Serializable mirror of `SanitizedMCPPluginConfig` for client components —
|
|
14
|
-
* the full sanitized config carries functions (tool handlers, etc.) that can't
|
|
15
|
-
* cross the server→client boundary. Built by `sanitizeClientPluginConfig` and
|
|
16
|
-
* passed to the `AccessField` component via `clientProps`.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export type ClientMCPPluginConfig = {
|
|
21
|
-
items: Array<{
|
|
22
|
-
collectionSlug?: string;
|
|
23
|
-
description: string;
|
|
24
|
-
globalSlug?: string;
|
|
25
|
-
key: string;
|
|
26
|
-
label: string;
|
|
27
|
-
type: 'collectionTool' | 'globalTool' | 'prompt' | 'resource' | 'tool';
|
|
28
|
-
}>;
|
|
29
|
-
};
|
|
30
14
|
export type MCPToolResponse = {
|
|
31
15
|
content: ContentBlock[];
|
|
32
16
|
/**
|
|
@@ -37,11 +21,27 @@ export type MCPToolResponse = {
|
|
|
37
21
|
doc?: Record<string, unknown>;
|
|
38
22
|
} & Pick<CallToolResult, '_meta' | 'isError' | 'structuredContent'>;
|
|
39
23
|
export type MCPResponseOverride = (response: MCPToolResponse, doc: Record<string, unknown>, req: PayloadRequest) => MCPToolResponse;
|
|
24
|
+
export type MCPAfterToolCallHook = (args: {
|
|
25
|
+
input: unknown;
|
|
26
|
+
req: PayloadRequest;
|
|
27
|
+
response: MCPToolResponse;
|
|
28
|
+
toolName: string;
|
|
29
|
+
}) => MaybePromise<MCPToolResponse>;
|
|
40
30
|
/**
|
|
41
31
|
* The handler's `input` type. A specific Standard Schema (Zod, Valibot, …) gets
|
|
42
32
|
* its inferred output; anything else falls back to `Record<string, unknown>`.
|
|
43
33
|
*/
|
|
44
34
|
export type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON ? StandardSchemaWithJSON extends TSchema ? Record<string, unknown> : StandardSchemaWithJSON.InferOutput<TSchema> : Record<string, unknown>;
|
|
35
|
+
export type MCPAccessArgs = {
|
|
36
|
+
permissions?: SanitizedPermissions;
|
|
37
|
+
req: PayloadRequest;
|
|
38
|
+
};
|
|
39
|
+
export type CollectionMCPAccessArgs = {
|
|
40
|
+
collectionSlug: CollectionSlug;
|
|
41
|
+
} & MCPAccessArgs;
|
|
42
|
+
export type GlobalMCPAccessArgs = {
|
|
43
|
+
globalSlug: GlobalSlug;
|
|
44
|
+
} & MCPAccessArgs;
|
|
45
45
|
export type ToolHandlerArgs<TSchema = undefined> = {
|
|
46
46
|
authorizedMCP: AuthorizedMCP;
|
|
47
47
|
input: TypedInput<TSchema>;
|
|
@@ -55,6 +55,13 @@ export type GlobalToolHandlerArgs<TSchema = undefined> = {
|
|
|
55
55
|
globalSlug: GlobalSlug;
|
|
56
56
|
} & ToolHandlerArgs<TSchema>;
|
|
57
57
|
export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
58
|
+
/**
|
|
59
|
+
* Runs while authorizing each MCP request, before the tool is advertised or called. Return
|
|
60
|
+
* `false` to make the tool unavailable for that request. This is skipped when `overrideAccess`
|
|
61
|
+
* is enabled.
|
|
62
|
+
*/
|
|
63
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
64
|
+
annotations?: ToolAnnotations;
|
|
58
65
|
description: string;
|
|
59
66
|
handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
60
67
|
input?: TSchema;
|
|
@@ -63,29 +70,51 @@ export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema |
|
|
|
63
70
|
*/
|
|
64
71
|
overrideResponse?: MCPResponseOverride;
|
|
65
72
|
};
|
|
66
|
-
/**
|
|
67
|
-
* `TSchema` is the schema itself (Standard Schema, raw JSON Schema, or undefined).
|
|
68
|
-
* The function-form variant of `input` carries a concrete `{ collectionSchema: JsonSchemaType }`
|
|
69
|
-
* parameter type so callers can write `({ collectionSchema }) => …` without annotating it.
|
|
70
|
-
*/
|
|
71
73
|
export type CollectionTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
74
|
+
/**
|
|
75
|
+
* Runs while authorizing each MCP request for this collection. Return `false` to reject calls
|
|
76
|
+
* to this tool for the collection. The shared tool is not advertised when no collections allow
|
|
77
|
+
* it, but can remain advertised when it is available for another collection. This is skipped
|
|
78
|
+
* when `overrideAccess` is enabled.
|
|
79
|
+
*/
|
|
80
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>;
|
|
72
81
|
handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
73
|
-
input?:
|
|
74
|
-
|
|
75
|
-
}) => TSchema) | TSchema;
|
|
76
|
-
} & Pick<Tool, 'description' | 'overrideResponse'>;
|
|
82
|
+
input?: TSchema;
|
|
83
|
+
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>;
|
|
77
84
|
export type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
85
|
+
/**
|
|
86
|
+
* Runs while authorizing each MCP request for this global. Return `false` to reject calls to
|
|
87
|
+
* this tool for the global. The shared tool is not advertised when no globals allow it, but
|
|
88
|
+
* can remain advertised when it is available for another global. This is skipped when
|
|
89
|
+
* `overrideAccess` is enabled.
|
|
90
|
+
*/
|
|
91
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>;
|
|
78
92
|
handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
|
|
79
|
-
input?:
|
|
80
|
-
|
|
81
|
-
}) => TSchema) | TSchema;
|
|
82
|
-
} & Pick<Tool, 'description' | 'overrideResponse'>;
|
|
93
|
+
input?: TSchema;
|
|
94
|
+
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>;
|
|
83
95
|
/**
|
|
84
96
|
* Configures (or disables) a built-in tool without replacing it.
|
|
85
97
|
* `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a
|
|
86
98
|
* required handler) from being silently accepted at a built-in key slot.
|
|
87
99
|
*/
|
|
88
|
-
export type
|
|
100
|
+
export type MCPBuiltInCollectionToolOverride = {
|
|
101
|
+
/**
|
|
102
|
+
* Replaces the built-in tool's access check. Return `false` to make the tool unavailable for
|
|
103
|
+
* this collection. This is skipped when `overrideAccess` is enabled.
|
|
104
|
+
*/
|
|
105
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>;
|
|
106
|
+
annotations?: ToolAnnotations;
|
|
107
|
+
description?: string;
|
|
108
|
+
handler?: never;
|
|
109
|
+
overrideResponse?: MCPResponseOverride;
|
|
110
|
+
};
|
|
111
|
+
export type MCPBuiltInGlobalToolOverride = {
|
|
112
|
+
/**
|
|
113
|
+
* Replaces the built-in tool's access check. Return `false` to make the tool unavailable for
|
|
114
|
+
* this global. This is skipped when `overrideAccess` is enabled.
|
|
115
|
+
*/
|
|
116
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>;
|
|
117
|
+
annotations?: ToolAnnotations;
|
|
89
118
|
description?: string;
|
|
90
119
|
handler?: never;
|
|
91
120
|
overrideResponse?: MCPResponseOverride;
|
|
@@ -97,19 +126,19 @@ export type MCPBuiltInToolOverride = {
|
|
|
97
126
|
*/
|
|
98
127
|
export type MCPTopLevelToolEntry = Tool;
|
|
99
128
|
export type MCPCollectionToolsMap = {
|
|
100
|
-
[customToolName: string]: boolean | CollectionTool |
|
|
129
|
+
[customToolName: string]: boolean | CollectionTool | MCPBuiltInCollectionToolOverride | undefined;
|
|
101
130
|
} & {
|
|
102
|
-
[K in MCPCollectionBuiltinName]?: false |
|
|
131
|
+
[K in MCPCollectionBuiltinName]?: false | MCPBuiltInCollectionToolOverride;
|
|
103
132
|
};
|
|
104
133
|
export type MCPAuthCollectionToolsMap = {
|
|
105
|
-
[K in MCPCollectionAuthToolName]?:
|
|
134
|
+
[K in MCPCollectionAuthToolName]?: MCPBuiltInCollectionToolOverride | true;
|
|
106
135
|
} & MCPCollectionToolsMap;
|
|
107
136
|
/** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */
|
|
108
137
|
export type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends AuthCollectionSlug ? MCPAuthCollectionToolsMap : MCPCollectionToolsMap;
|
|
109
138
|
export type MCPGlobalToolsMap = {
|
|
110
|
-
[customToolName: string]: boolean | GlobalTool |
|
|
139
|
+
[customToolName: string]: boolean | GlobalTool | MCPBuiltInGlobalToolOverride | undefined;
|
|
111
140
|
} & {
|
|
112
|
-
[K in MCPGlobalBuiltinName]?: false |
|
|
141
|
+
[K in MCPGlobalBuiltinName]?: false | MCPBuiltInGlobalToolOverride;
|
|
113
142
|
};
|
|
114
143
|
export type MCPTopLevelToolsMap = Record<string, Tool>;
|
|
115
144
|
export type PromptHandlerArgs<TSchema = undefined> = {
|
|
@@ -118,6 +147,12 @@ export type PromptHandlerArgs<TSchema = undefined> = {
|
|
|
118
147
|
serverContext: ServerContext;
|
|
119
148
|
};
|
|
120
149
|
export type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {
|
|
150
|
+
/**
|
|
151
|
+
* Runs while authorizing each MCP request, before the prompt is advertised or used. Return
|
|
152
|
+
* `false` to make the prompt unavailable for that request. This is skipped when
|
|
153
|
+
* `overrideAccess` is enabled.
|
|
154
|
+
*/
|
|
155
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
121
156
|
argsSchema: TSchema;
|
|
122
157
|
description: string;
|
|
123
158
|
handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{
|
|
@@ -139,6 +174,12 @@ export type ResourceHandlerArgs = {
|
|
|
139
174
|
uri: URL;
|
|
140
175
|
};
|
|
141
176
|
export type Resource = {
|
|
177
|
+
/**
|
|
178
|
+
* Runs while authorizing each MCP request, before the resource is advertised or read. Return
|
|
179
|
+
* `false` to make the resource unavailable for that request. This is skipped when
|
|
180
|
+
* `overrideAccess` is enabled.
|
|
181
|
+
*/
|
|
182
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>;
|
|
142
183
|
description: string;
|
|
143
184
|
handler: (args: ResourceHandlerArgs) => MaybePromise<{
|
|
144
185
|
contents: Array<{
|
|
@@ -172,100 +213,64 @@ export type MCPPluginConfig = {
|
|
|
172
213
|
collections?: {
|
|
173
214
|
[Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>;
|
|
174
215
|
};
|
|
175
|
-
/** Skip MCP registration.
|
|
216
|
+
/** Skip MCP endpoint registration. */
|
|
176
217
|
disabled?: boolean;
|
|
177
218
|
globals?: {
|
|
178
219
|
[Slug in GlobalSlug]?: MCPPluginGlobalConfig;
|
|
179
220
|
};
|
|
221
|
+
hooks?: {
|
|
222
|
+
/** Transform a tool response after its handler returns */
|
|
223
|
+
afterToolCall?: MCPAfterToolCallHook[];
|
|
224
|
+
};
|
|
180
225
|
mcp?: {
|
|
181
226
|
serverOptions?: MCPServerOptions;
|
|
182
227
|
verboseLogs?: boolean;
|
|
183
228
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Replace the default MCP authorization resolver.
|
|
231
|
+
*
|
|
232
|
+
* This hook replaces the default authentication flow. It must set `req.user` to the
|
|
233
|
+
* authenticated Payload user, or to `null` for an anonymous caller, before returning.
|
|
234
|
+
*/
|
|
235
|
+
overrideGetAuthorizedMCP?: (args: {
|
|
191
236
|
pluginConfig: SanitizedMCPPluginConfig;
|
|
192
|
-
|
|
193
|
-
}) => MaybePromise<AuthorizedMCP>;
|
|
237
|
+
} & GetAuthorizedMCPArgs) => MaybePromise<AuthorizedMCP>;
|
|
194
238
|
prompts?: Record<string, Prompt>;
|
|
195
239
|
resources?: Record<string, Resource>;
|
|
196
240
|
/** Cross-cutting tools (not scoped to any collection or global). */
|
|
197
241
|
tools?: MCPTopLevelToolsMap;
|
|
198
|
-
userCollection?: CollectionSlug;
|
|
199
242
|
};
|
|
200
243
|
export type SanitizedMCPPluginConfig = {
|
|
201
244
|
items: MCPItem[];
|
|
202
|
-
|
|
203
|
-
} & Pick<MCPPluginConfig, 'disabled' | 'mcp' | 'overrideApiKeyCollection' | 'overrideAuth'>;
|
|
245
|
+
} & Pick<MCPPluginConfig, 'disabled' | 'hooks' | 'mcp' | 'overrideGetAuthorizedMCP'>;
|
|
204
246
|
export type MCPServerOptions = {
|
|
205
247
|
options?: ConstructorParameters<typeof McpServer>[1];
|
|
206
248
|
serverInfo?: Partial<ConstructorParameters<typeof McpServer>[0]>;
|
|
207
249
|
};
|
|
208
250
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* defaults (built-in CRUD is on, opt-in tools are off).
|
|
212
|
-
*/
|
|
213
|
-
export type MCPAPIKeysDocAccessTree = {
|
|
214
|
-
collections?: {
|
|
215
|
-
[CollectionSlug: CollectionSlug]: {
|
|
216
|
-
[ToolKey: string]: boolean;
|
|
217
|
-
};
|
|
218
|
-
};
|
|
219
|
-
globals?: {
|
|
220
|
-
[GlobalSlug: GlobalSlug]: {
|
|
221
|
-
[ToolKey: string]: boolean;
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
prompts?: {
|
|
225
|
-
[PromptKey: string]: boolean;
|
|
226
|
-
};
|
|
227
|
-
resources?: {
|
|
228
|
-
[ResourceKey: string]: boolean;
|
|
229
|
-
};
|
|
230
|
-
tools?: {
|
|
231
|
-
[ToolKey: string]: boolean;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* Stored on `payload-mcp-api-keys` docs
|
|
236
|
-
*/
|
|
237
|
-
export type MCPAPIKeysDoc = {
|
|
238
|
-
access: MCPAPIKeysDocAccessTree;
|
|
239
|
-
id: DefaultDocumentIDType;
|
|
240
|
-
overrideAccess?: boolean;
|
|
241
|
-
user: null | TypedUser;
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* One MCP primitive — tool, prompt, or resource — paired with the metadata both
|
|
245
|
-
* the endpoint and the API key collection need. Built by `sanitizeMCPConfig`,
|
|
246
|
-
* filtered by `getAuthorizedMCP`, registered by the MCP endpoint.
|
|
251
|
+
* One MCP primitive plus the metadata needed for config-driven filtering and
|
|
252
|
+
* registration.
|
|
247
253
|
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* registration time.
|
|
252
|
-
* - `label`: human-readable admin-UI display text for the checkbox.
|
|
253
|
-
* - `tool` / `prompt` / `resource`: the live primitive (its own
|
|
254
|
-
* `description` is what both MCP clients and the admin UI surface).
|
|
254
|
+
* - `configKey`: the config identifier, e.g. `find` or `echo`.
|
|
255
|
+
* - `mcpName`: the MCP wire name, e.g. `findDocuments` or `echo`.
|
|
256
|
+
* - `label`: human-readable display text.
|
|
255
257
|
*/
|
|
256
258
|
export type MCPItemBase = {
|
|
257
|
-
|
|
259
|
+
configKey: string;
|
|
258
260
|
label: string;
|
|
261
|
+
mcpName: string;
|
|
259
262
|
};
|
|
260
|
-
export type
|
|
263
|
+
export type CollectionMCPItem = {
|
|
261
264
|
collectionSlug: CollectionSlug;
|
|
262
265
|
tool: CollectionTool;
|
|
263
266
|
type: 'collectionTool';
|
|
264
|
-
} & MCPItemBase
|
|
267
|
+
} & MCPItemBase;
|
|
268
|
+
export type GlobalMCPItem = {
|
|
265
269
|
globalSlug: GlobalSlug;
|
|
266
270
|
tool: GlobalTool;
|
|
267
271
|
type: 'globalTool';
|
|
268
|
-
} & MCPItemBase
|
|
272
|
+
} & MCPItemBase;
|
|
273
|
+
export type MCPItem = ({
|
|
269
274
|
prompt: Prompt;
|
|
270
275
|
type: 'prompt';
|
|
271
276
|
} & MCPItemBase) | ({
|
|
@@ -274,16 +279,13 @@ export type MCPItem = ({
|
|
|
274
279
|
} & MCPItemBase) | ({
|
|
275
280
|
tool: Tool;
|
|
276
281
|
type: 'tool';
|
|
277
|
-
} & MCPItemBase);
|
|
282
|
+
} & MCPItemBase) | CollectionMCPItem | GlobalMCPItem;
|
|
278
283
|
/**
|
|
279
|
-
* The
|
|
280
|
-
*
|
|
281
|
-
* receive this via `args.authorizedMCP` so they can spread
|
|
282
|
-
* `localAPIDefaults(authorizedMCP)` into every local API call.
|
|
284
|
+
* The MCP items and access mode authorized for this request. The authenticated user is available
|
|
285
|
+
* as `req.user`.
|
|
283
286
|
*/
|
|
284
287
|
export type AuthorizedMCP = {
|
|
285
288
|
items: MCPItem[];
|
|
286
289
|
overrideAccess: boolean;
|
|
287
|
-
user: null | TypedUser;
|
|
288
290
|
};
|
|
289
291
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,sBAAsB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,YAAY,EACZ,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAE9B,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,CAAA;AAEzF,gGAAgG;AAChG,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,eAAe,EAAE,CAAA;AAEvE;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,sBAAsB,CAAA;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,SAAS,GAAG,mBAAmB,CAAC,CAAA;AAEnE,MAAM,MAA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AA;IACtB,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,YAAY,CAAA;CACnB,GAAG,WAAW,CAAA;AAEf,MAAM,MAAM,OAAO,GACf,CAAC;IACC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;CACf,GAAG,WAAW,CAAC,GAChB,CAAC;IACC,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;CACjB,GAAG,WAAW,CAAC,GAChB,CAAC;IACC,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,WAAW,CAAC,GAChB,iBAAiB,GACjB,aAAa,CAAA;AAEjB;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,cAAc,EAAE,OAAO,CAAA;CACxB,CAAA"}
|
package/dist/types.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
* receive this via `args.authorizedMCP` so they can spread
|
|
5
|
-
* `localAPIDefaults(authorizedMCP)` into every local API call.
|
|
2
|
+
* The MCP items and access mode authorized for this request. The authenticated user is available
|
|
3
|
+
* as `req.user`.
|
|
6
4
|
*/ export { };
|
|
7
5
|
|
|
8
6
|
//# sourceMappingURL=types.js.map
|