@payloadcms/plugin-mcp 3.78.0-canary.4 → 3.78.0-canary.5

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/dist/index.d.ts CHANGED
@@ -10,7 +10,6 @@ export type { MCPAccessSettings };
10
10
  * The MCP Plugin for Payload. This plugin allows you to add MCP capabilities to your Payload project.
11
11
  *
12
12
  * @param pluginOptions - The options for the MCP plugin.
13
- * @experimental This plugin is experimental and may change in the future.
14
13
  */
15
14
  export declare const mcpPlugin: (pluginOptions: PluginMCPServerConfig) => (config: Config) => Config;
16
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAK1E,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAiB,cAAc;QAC7B,UAAU,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;KACjD;CACF;AAID,YAAY,EAAE,iBAAiB,EAAE,CAAA;AACjC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,kBACJ,qBAAqB,cAC5B,MAAM,KAAG,MAmFjB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAK1E,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAiB,cAAc;QAC7B,UAAU,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;KACjD;CACF;AAID,YAAY,EAAE,iBAAiB,EAAE,CAAA;AACjC;;;;GAIG;AACH,eAAO,MAAM,SAAS,kBACJ,qBAAqB,cAC5B,MAAM,KAAG,MAmFjB,CAAA"}
package/dist/index.js CHANGED
@@ -5,7 +5,6 @@ import { defaults } from './defaults.js';
5
5
  * The MCP Plugin for Payload. This plugin allows you to add MCP capabilities to your Payload project.
6
6
  *
7
7
  * @param pluginOptions - The options for the MCP plugin.
8
- * @experimental This plugin is experimental and may change in the future.
9
8
  */ export const mcpPlugin = (pluginOptions)=>(config)=>{
10
9
  if (!config.collections) {
11
10
  config.collections = [];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload'\n\nimport type { MCPAccessSettings, PluginMCPServerConfig } from './types.js'\n\nimport { createAPIKeysCollection } from './collections/createApiKeysCollection.js'\nimport { initializeMCPHandler } from './endpoints/mcp.js'\n\ndeclare module 'payload' {\n export interface PayloadRequest {\n payloadAPI: 'GraphQL' | 'local' | 'MCP' | 'REST'\n }\n}\n\nimport { defaults } from './defaults.js'\n\nexport type { MCPAccessSettings }\n/**\n * The MCP Plugin for Payload. This plugin allows you to add MCP capabilities to your Payload project.\n *\n * @param pluginOptions - The options for the MCP plugin.\n * @experimental This plugin is experimental and may change in the future.\n */\nexport const mcpPlugin =\n (pluginOptions: PluginMCPServerConfig) =>\n (config: Config): Config => {\n if (!config.collections) {\n config.collections = []\n }\n\n // Collections\n const collections = pluginOptions.collections || {}\n // Globals\n const globals = pluginOptions.globals || {}\n // Extract custom tools for the global config\n const customTools =\n pluginOptions.mcp?.tools?.map((tool) => ({\n name: tool.name,\n description: tool.description,\n })) || []\n\n // User Collection\n pluginOptions.userCollection =\n pluginOptions.userCollection ?? config?.admin?.user ?? defaults.userCollection\n\n const experimentalTools = pluginOptions?.experimental?.tools || {}\n\n /**\n * API Keys\n * --------\n * High resolution control over MCP capabilities is crucial when using Payload with LLMs.\n *\n * This API Keys collection has ways for admins to create API keys and allow or disallow the MCP capabilities.\n * This is useful when Admins want to allow or disallow the use of the MCP capabilities in real time.\n * For example:\n * - If a collection has all of its capabilities enabled, admins can allow or disallow the create, update, delete, and find capabilities on that collection.\n * - If a collection only has the find capability enabled, admins can only allow or disallow the find capability on that collection.\n * - If a global has all of its capabilities enabled, admins can allow or disallow the find and update capabilities on that global.\n * - If a custom tool has gone haywire, admins can disallow that tool.\n *\n */\n const apiKeyCollection = createAPIKeysCollection(\n collections,\n globals,\n customTools,\n experimentalTools,\n pluginOptions,\n )\n if (pluginOptions.overrideApiKeyCollection) {\n config.collections.push(pluginOptions.overrideApiKeyCollection(apiKeyCollection))\n } else {\n config.collections.push(apiKeyCollection)\n }\n\n /**\n * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.\n * If your plugin heavily modifies the database schema, you may want to remove this property.\n */\n if (pluginOptions.disabled) {\n return config\n }\n\n if (!config.endpoints) {\n config.endpoints = []\n }\n\n /**\n * This is the primary MCP Server Endpoint.\n * Payload will automatically add the /api prefix to the path, so the full path is `/api/mcp`\n * NOTE: This is only transport method until we add full support for SSE which will be another endpoint at `/api/sse`\n */\n config.endpoints.push({\n handler: initializeMCPHandler(pluginOptions),\n method: 'post',\n path: '/mcp',\n })\n\n /**\n * The GET response is always: {\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32000,\"message\":\"Method not allowed.\"},\"id\":null} -- even with an API key\n * This is expected behavior and MCP clients should always use the POST endpoint.\n */\n config.endpoints.push({\n handler: initializeMCPHandler(pluginOptions),\n method: 'get',\n path: '/mcp',\n })\n\n return config\n }\n"],"names":["createAPIKeysCollection","initializeMCPHandler","defaults","mcpPlugin","pluginOptions","config","collections","globals","customTools","mcp","tools","map","tool","name","description","userCollection","admin","user","experimentalTools","experimental","apiKeyCollection","overrideApiKeyCollection","push","disabled","endpoints","handler","method","path"],"mappings":"AAIA,SAASA,uBAAuB,QAAQ,2CAA0C;AAClF,SAASC,oBAAoB,QAAQ,qBAAoB;AAQzD,SAASC,QAAQ,QAAQ,gB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src/index.ts"],"sourcesContent":["import type { Config } from 'payload'\n\nimport type { MCPAccessSettings, PluginMCPServerConfig } from './types.js'\n\nimport { createAPIKeysCollection } from './collections/createApiKeysCollection.js'\nimport { initializeMCPHandler } from './endpoints/mcp.js'\n\ndeclare module 'payload' {\n export interface PayloadRequest {\n payloadAPI: 'GraphQL' | 'local' | 'MCP' | 'REST'\n }\n}\n\nimport { defaults } from './defaults.js'\n\nexport type { MCPAccessSettings }\n/**\n * The MCP Plugin for Payload. This plugin allows you to add MCP capabilities to your Payload project.\n *\n * @param pluginOptions - The options for the MCP plugin.\n */\nexport const mcpPlugin =\n (pluginOptions: PluginMCPServerConfig) =>\n (config: Config): Config => {\n if (!config.collections) {\n config.collections = []\n }\n\n // Collections\n const collections = pluginOptions.collections || {}\n // Globals\n const globals = pluginOptions.globals || {}\n // Extract custom tools for the global config\n const customTools =\n pluginOptions.mcp?.tools?.map((tool) => ({\n name: tool.name,\n description: tool.description,\n })) || []\n\n // User Collection\n pluginOptions.userCollection =\n pluginOptions.userCollection ?? config?.admin?.user ?? defaults.userCollection\n\n const experimentalTools = pluginOptions?.experimental?.tools || {}\n\n /**\n * API Keys\n * --------\n * High resolution control over MCP capabilities is crucial when using Payload with LLMs.\n *\n * This API Keys collection has ways for admins to create API keys and allow or disallow the MCP capabilities.\n * This is useful when Admins want to allow or disallow the use of the MCP capabilities in real time.\n * For example:\n * - If a collection has all of its capabilities enabled, admins can allow or disallow the create, update, delete, and find capabilities on that collection.\n * - If a collection only has the find capability enabled, admins can only allow or disallow the find capability on that collection.\n * - If a global has all of its capabilities enabled, admins can allow or disallow the find and update capabilities on that global.\n * - If a custom tool has gone haywire, admins can disallow that tool.\n *\n */\n const apiKeyCollection = createAPIKeysCollection(\n collections,\n globals,\n customTools,\n experimentalTools,\n pluginOptions,\n )\n if (pluginOptions.overrideApiKeyCollection) {\n config.collections.push(pluginOptions.overrideApiKeyCollection(apiKeyCollection))\n } else {\n config.collections.push(apiKeyCollection)\n }\n\n /**\n * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.\n * If your plugin heavily modifies the database schema, you may want to remove this property.\n */\n if (pluginOptions.disabled) {\n return config\n }\n\n if (!config.endpoints) {\n config.endpoints = []\n }\n\n /**\n * This is the primary MCP Server Endpoint.\n * Payload will automatically add the /api prefix to the path, so the full path is `/api/mcp`\n * NOTE: This is only transport method until we add full support for SSE which will be another endpoint at `/api/sse`\n */\n config.endpoints.push({\n handler: initializeMCPHandler(pluginOptions),\n method: 'post',\n path: '/mcp',\n })\n\n /**\n * The GET response is always: {\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32000,\"message\":\"Method not allowed.\"},\"id\":null} -- even with an API key\n * This is expected behavior and MCP clients should always use the POST endpoint.\n */\n config.endpoints.push({\n handler: initializeMCPHandler(pluginOptions),\n method: 'get',\n path: '/mcp',\n })\n\n return config\n }\n"],"names":["createAPIKeysCollection","initializeMCPHandler","defaults","mcpPlugin","pluginOptions","config","collections","globals","customTools","mcp","tools","map","tool","name","description","userCollection","admin","user","experimentalTools","experimental","apiKeyCollection","overrideApiKeyCollection","push","disabled","endpoints","handler","method","path"],"mappings":"AAIA,SAASA,uBAAuB,QAAQ,2CAA0C;AAClF,SAASC,oBAAoB,QAAQ,qBAAoB;AAQzD,SAASC,QAAQ,QAAQ,gBAAe;AAGxC;;;;CAIC,GACD,OAAO,MAAMC,YACX,CAACC,gBACD,CAACC;QACC,IAAI,CAACA,OAAOC,WAAW,EAAE;YACvBD,OAAOC,WAAW,GAAG,EAAE;QACzB;QAEA,cAAc;QACd,MAAMA,cAAcF,cAAcE,WAAW,IAAI,CAAC;QAClD,UAAU;QACV,MAAMC,UAAUH,cAAcG,OAAO,IAAI,CAAC;QAC1C,6CAA6C;QAC7C,MAAMC,cACJJ,cAAcK,GAAG,EAAEC,OAAOC,IAAI,CAACC,OAAU,CAAA;gBACvCC,MAAMD,KAAKC,IAAI;gBACfC,aAAaF,KAAKE,WAAW;YAC/B,CAAA,MAAO,EAAE;QAEX,kBAAkB;QAClBV,cAAcW,cAAc,GAC1BX,cAAcW,cAAc,IAAIV,QAAQW,OAAOC,QAAQf,SAASa,cAAc;QAEhF,MAAMG,oBAAoBd,eAAee,cAAcT,SAAS,CAAC;QAEjE;;;;;;;;;;;;;KAaC,GACD,MAAMU,mBAAmBpB,wBACvBM,aACAC,SACAC,aACAU,mBACAd;QAEF,IAAIA,cAAciB,wBAAwB,EAAE;YAC1ChB,OAAOC,WAAW,CAACgB,IAAI,CAAClB,cAAciB,wBAAwB,CAACD;QACjE,OAAO;YACLf,OAAOC,WAAW,CAACgB,IAAI,CAACF;QAC1B;QAEA;;;KAGC,GACD,IAAIhB,cAAcmB,QAAQ,EAAE;YAC1B,OAAOlB;QACT;QAEA,IAAI,CAACA,OAAOmB,SAAS,EAAE;YACrBnB,OAAOmB,SAAS,GAAG,EAAE;QACvB;QAEA;;;;KAIC,GACDnB,OAAOmB,SAAS,CAACF,IAAI,CAAC;YACpBG,SAASxB,qBAAqBG;YAC9BsB,QAAQ;YACRC,MAAM;QACR;QAEA;;;KAGC,GACDtB,OAAOmB,SAAS,CAACF,IAAI,CAAC;YACpBG,SAASxB,qBAAqBG;YAC9BsB,QAAQ;YACRC,MAAM;QACR;QAEA,OAAOtB;IACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-mcp",
3
- "version": "3.78.0-canary.4",
3
+ "version": "3.78.0-canary.5",
4
4
  "description": "MCP (Model Context Protocol) capabilities with Payload",
5
5
  "keywords": [
6
6
  "plugin",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@payloadcms/eslint-config": "3.28.0",
48
- "payload": "3.78.0-canary.4"
48
+ "payload": "3.78.0-canary.5"
49
49
  },
50
50
  "peerDependencies": {
51
- "payload": "3.78.0-canary.4"
51
+ "payload": "3.78.0-canary.5"
52
52
  },
53
53
  "homepage:": "https://payloadcms.com",
54
54
  "scripts": {
package/src/index.ts CHANGED
@@ -18,7 +18,6 @@ export type { MCPAccessSettings }
18
18
  * The MCP Plugin for Payload. This plugin allows you to add MCP capabilities to your Payload project.
19
19
  *
20
20
  * @param pluginOptions - The options for the MCP plugin.
21
- * @experimental This plugin is experimental and may change in the future.
22
21
  */
23
22
  export const mcpPlugin =
24
23
  (pluginOptions: PluginMCPServerConfig) =>