@payloadcms/plugin-mcp 3.87.0 → 3.88.0

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.
Files changed (50) hide show
  1. package/dist/collections/createApiKeysCollection.d.ts.map +1 -1
  2. package/dist/collections/createApiKeysCollection.js +25 -0
  3. package/dist/collections/createApiKeysCollection.js.map +1 -1
  4. package/dist/endpoints/mcp.d.ts +1 -1
  5. package/dist/endpoints/mcp.d.ts.map +1 -1
  6. package/dist/endpoints/mcp.js +14 -61
  7. package/dist/endpoints/mcp.js.map +1 -1
  8. package/dist/endpoints/resolveAccessSettings.d.ts +10 -0
  9. package/dist/endpoints/resolveAccessSettings.d.ts.map +1 -0
  10. package/dist/endpoints/resolveAccessSettings.js +44 -0
  11. package/dist/endpoints/resolveAccessSettings.js.map +1 -0
  12. package/dist/endpoints/withRestoredWebGlobals.d.ts +5 -0
  13. package/dist/endpoints/withRestoredWebGlobals.d.ts.map +1 -0
  14. package/dist/endpoints/withRestoredWebGlobals.js +23 -0
  15. package/dist/endpoints/withRestoredWebGlobals.js.map +1 -0
  16. package/dist/mcp/getMcpHandler.d.ts +1 -1
  17. package/dist/mcp/getMcpHandler.d.ts.map +1 -1
  18. package/dist/mcp/getMcpHandler.js +23 -23
  19. package/dist/mcp/getMcpHandler.js.map +1 -1
  20. package/dist/mcp/tools/auth/login.d.ts.map +1 -1
  21. package/dist/mcp/tools/auth/login.js +4 -5
  22. package/dist/mcp/tools/auth/login.js.map +1 -1
  23. package/dist/mcp/tools/global/find.d.ts.map +1 -1
  24. package/dist/mcp/tools/global/find.js +2 -0
  25. package/dist/mcp/tools/global/find.js.map +1 -1
  26. package/dist/mcp/tools/global/update.d.ts.map +1 -1
  27. package/dist/mcp/tools/global/update.js +2 -0
  28. package/dist/mcp/tools/global/update.js.map +1 -1
  29. package/dist/mcp/tools/job/run.d.ts.map +1 -1
  30. package/dist/mcp/tools/job/run.js +2 -0
  31. package/dist/mcp/tools/job/run.js.map +1 -1
  32. package/dist/mcp/tools/resource/update.d.ts.map +1 -1
  33. package/dist/mcp/tools/resource/update.js +3 -17
  34. package/dist/mcp/tools/resource/update.js.map +1 -1
  35. package/dist/mcp/tools/schemas.d.ts +0 -12
  36. package/dist/mcp/tools/schemas.d.ts.map +1 -1
  37. package/dist/mcp/tools/schemas.js +1 -5
  38. package/dist/mcp/tools/schemas.js.map +1 -1
  39. package/package.json +4 -4
  40. package/src/collections/createApiKeysCollection.ts +27 -1
  41. package/src/endpoints/mcp.ts +12 -77
  42. package/src/endpoints/resolveAccessSettings.ts +74 -0
  43. package/src/endpoints/withRestoredWebGlobals.ts +19 -0
  44. package/src/mcp/getMcpHandler.ts +32 -31
  45. package/src/mcp/tools/auth/login.ts +4 -12
  46. package/src/mcp/tools/global/find.ts +2 -0
  47. package/src/mcp/tools/global/update.ts +2 -0
  48. package/src/mcp/tools/job/run.ts +2 -0
  49. package/src/mcp/tools/resource/update.ts +0 -16
  50. package/src/mcp/tools/schemas.ts +0 -16
@@ -89,10 +89,8 @@ export declare const toolSchemas: {
89
89
  depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
90
90
  draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
91
91
  fallbackLocale: z.ZodOptional<z.ZodString>;
92
- filePath: z.ZodOptional<z.ZodString>;
93
92
  locale: z.ZodOptional<z.ZodString>;
94
93
  overrideLock: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
95
- overwriteExistingFiles: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
96
94
  select: z.ZodOptional<z.ZodString>;
97
95
  where: z.ZodOptional<z.ZodString>;
98
96
  }, "strip", z.ZodTypeAny, {
@@ -100,13 +98,11 @@ export declare const toolSchemas: {
100
98
  draft: boolean;
101
99
  data: string;
102
100
  overrideLock: boolean;
103
- overwriteExistingFiles: boolean;
104
101
  locale?: string | undefined;
105
102
  select?: string | undefined;
106
103
  where?: string | undefined;
107
104
  id?: string | number | undefined;
108
105
  fallbackLocale?: string | undefined;
109
- filePath?: string | undefined;
110
106
  }, {
111
107
  data: string;
112
108
  depth?: number | undefined;
@@ -116,9 +112,7 @@ export declare const toolSchemas: {
116
112
  where?: string | undefined;
117
113
  id?: string | number | undefined;
118
114
  fallbackLocale?: string | undefined;
119
- filePath?: string | undefined;
120
115
  overrideLock?: boolean | undefined;
121
- overwriteExistingFiles?: boolean | undefined;
122
116
  }>;
123
117
  };
124
118
  deleteResource: {
@@ -298,23 +292,17 @@ export declare const toolSchemas: {
298
292
  collection: z.ZodString;
299
293
  depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
300
294
  email: z.ZodString;
301
- overrideAccess: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
302
295
  password: z.ZodString;
303
- showHiddenFields: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
304
296
  }, "strip", z.ZodTypeAny, {
305
297
  collection: string;
306
298
  depth: number;
307
299
  email: string;
308
300
  password: string;
309
- overrideAccess: boolean;
310
- showHiddenFields: boolean;
311
301
  }, {
312
302
  collection: string;
313
303
  email: string;
314
304
  password: string;
315
305
  depth?: number | undefined;
316
- overrideAccess?: boolean | undefined;
317
- showHiddenFields?: boolean | undefined;
318
306
  }>;
319
307
  };
320
308
  verify: {
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqgBvB,CAAA"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqfvB,CAAA"}
@@ -49,10 +49,8 @@ export const toolSchemas = {
49
49
  depth: z.number().int().min(0).max(10).optional().default(0).describe('Depth of population for relationships'),
50
50
  draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),
51
51
  fallbackLocale: z.string().optional().describe('Optional: fallback locale code to use when requested locale is not available'),
52
- filePath: z.string().optional().describe('Optional: absolute file path for file uploads'),
53
52
  locale: z.string().optional().describe('Optional: locale code to update the document in (e.g., "en", "es"). Defaults to the default locale'),
54
53
  overrideLock: z.boolean().optional().default(true).describe('Whether to override document locks'),
55
- overwriteExistingFiles: z.boolean().optional().default(false).describe('Whether to overwrite existing files'),
56
54
  select: z.string().optional().describe("Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\"title\": true}'"),
57
55
  where: z.string().optional().describe('Optional: JSON string for where clause to update multiple documents')
58
56
  })
@@ -161,9 +159,7 @@ export const toolSchemas = {
161
159
  collection: z.string().describe('The collection containing the user (e.g., "users")'),
162
160
  depth: z.number().int().min(0).max(10).optional().default(0).describe('Depth of population for relationships'),
163
161
  email: z.string().email().describe('The user email address'),
164
- overrideAccess: z.boolean().optional().default(false).describe('Whether to override access controls'),
165
- password: z.string().describe('The user password'),
166
- showHiddenFields: z.boolean().optional().default(false).describe('Whether to show hidden fields in the response')
162
+ password: z.string().describe('The user password')
167
163
  })
168
164
  },
169
165
  verify: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/mcp/tools/schemas.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const toolSchemas = {\n findGlobal: {\n description: 'Find a Payload global singleton configuration.',\n parameters: z.object({\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n }),\n },\n\n findResources: {\n description: 'Find documents in a collection by ID or where clause using Find or FindByID.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe(\n 'Optional: specific document ID to retrieve. If not provided, returns all documents',\n ),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('How many levels deep to populate relationships (default: 0)'),\n draft: z\n .boolean()\n .optional()\n .describe(\n 'Optional: Whether the document should be queried from the versions table/collection or not.',\n ),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n limit: z\n .number()\n .int()\n .min(1, 'Limit must be at least 1')\n .max(100, 'Limit cannot exceed 100')\n .optional()\n .default(10)\n .describe('Maximum number of documents to return (default: 10, max: 100)'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n page: z\n .number()\n .int()\n .min(1, 'Page must be at least 1')\n .optional()\n .default(1)\n .describe('Page number for pagination (default: 1)'),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n sort: z\n .string()\n .optional()\n .describe('Field to sort by (e.g., \"createdAt\", \"-updatedAt\" for descending)'),\n where: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string for where clause filtering (e.g., \\'{\"title\": {\"contains\": \"test\"}}\\')',\n ),\n }),\n },\n\n createResource: {\n description: 'Create a document in a collection.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data for the new document'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('How many levels deep to populate relationships in response (default: 0)'),\n draft: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to create the document as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to create the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n }),\n },\n\n updateResource: {\n description: 'Update documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to update'),\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n filePath: z.string().optional().describe('Optional: absolute file path for file uploads'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n overrideLock: z\n .boolean()\n .optional()\n .default(true)\n .describe('Whether to override document locks'),\n overwriteExistingFiles: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to overwrite existing files'),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to update multiple documents'),\n }),\n },\n\n deleteResource: {\n description: 'Delete documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to delete'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships in response'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code for the operation (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to delete multiple documents'),\n }),\n },\n\n updateGlobal: {\n description: 'Update a Payload global singleton configuration.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update data in (e.g., \"en\", \"es\"). Use \"all\" to update all locales for localized fields',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"siteName\\\": true}'\",\n ),\n }),\n },\n\n // Experimental Below This Line\n createCollection: {\n description: 'Creates a new collection with specified fields and configuration.',\n parameters: z.object({\n collectionDescription: z\n .string()\n .optional()\n .describe('Optional description for the collection'),\n collectionName: z.string().describe('The name of the collection to create'),\n fields: z.array(z.any()).describe('Array of field definitions for the collection'),\n hasUpload: z\n .boolean()\n .optional()\n .describe('Whether the collection should have upload capabilities'),\n }),\n },\n\n findCollections: {\n description: 'Finds and lists collections with optional content and document counts.',\n parameters: z.object({\n collectionName: z\n .string()\n .optional()\n .describe('Optional: specific collection name to retrieve'),\n includeContent: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include collection file content'),\n includeCount: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include document counts for each collection'),\n }),\n },\n\n updateCollection: {\n description:\n 'Updates an existing collection with new fields, modifications, or configuration changes.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to update'),\n configUpdates: z.any().optional().describe('Configuration updates (for update_config type)'),\n fieldModifications: z\n .array(z.any())\n .optional()\n .describe('Field modifications (for modify_field type)'),\n fieldNamesToRemove: z\n .array(z.string())\n .optional()\n .describe('Field names to remove (for remove_field type)'),\n newContent: z\n .string()\n .optional()\n .describe('New content to replace entire collection (for replace_content type)'),\n newFields: z.array(z.any()).optional().describe('New fields to add (for add_field type)'),\n updateType: z\n .enum(['add_field', 'remove_field', 'modify_field', 'update_config', 'replace_content'])\n .describe('Type of update to perform'),\n }),\n },\n\n deleteCollection: {\n description: 'Deletes a collection and optionally updates the configuration.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to delete'),\n confirmDeletion: z.boolean().describe('Confirmation flag to prevent accidental deletion'),\n updateConfig: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to update payload.config.ts to remove collection reference'),\n }),\n },\n\n findConfig: {\n description: 'Reads and displays the current configuration file.',\n parameters: z.object({\n includeMetadata: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include file metadata (size, modified date, etc.)'),\n }),\n },\n\n updateConfig: {\n description: 'Updates the configuration file with various modifications.',\n parameters: z.object({\n adminConfig: z\n .any()\n .optional()\n .describe('Admin configuration updates (for update_admin type)'),\n collectionName: z\n .string()\n .optional()\n .describe('Collection name (required for add_collection and remove_collection)'),\n databaseConfig: z\n .any()\n .optional()\n .describe('Database configuration updates (for update_database type)'),\n newContent: z\n .string()\n .optional()\n .describe('New configuration content (for replace_content type)'),\n pluginUpdates: z\n .any()\n .optional()\n .describe('Plugin configuration updates (for update_plugins type)'),\n updateType: z\n .enum([\n 'add_collection',\n 'remove_collection',\n 'update_admin',\n 'update_database',\n 'update_plugins',\n 'replace_content',\n ])\n .describe('Type of configuration update to perform'),\n }),\n },\n\n auth: {\n description: 'Checks authentication status for the current user.',\n parameters: z.object({\n headers: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string containing custom headers to send with the authentication request',\n ),\n }),\n },\n\n login: {\n description: 'Authenticates a user with email and password.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n email: z.string().email().describe('The user email address'),\n overrideAccess: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to override access controls'),\n password: z.string().describe('The user password'),\n showHiddenFields: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to show hidden fields in the response'),\n }),\n },\n\n verify: {\n description: 'Verifies a user email with a verification token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n token: z.string().describe('The verification token sent to the user email'),\n }),\n },\n\n resetPassword: {\n description: 'Resets a user password with a reset token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n password: z.string().describe('The new password for the user'),\n token: z.string().describe('The password reset token sent to the user email'),\n }),\n },\n\n forgotPassword: {\n description: 'Sends a password reset email to a user.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n disableEmail: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to disable sending the email (for testing)'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n unlock: {\n description: 'Unlocks a user account that has been locked due to failed login attempts.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n createJob: {\n description: 'Creates a new job (task or workflow) with specified configuration.',\n parameters: z.object({\n description: z.string().describe('Description of what the job does'),\n inputSchema: z.record(z.any()).optional().default({}).describe('Input schema for the job'),\n jobData: z\n .record(z.any())\n .optional()\n .default({})\n .describe('Additional job configuration data'),\n jobName: z\n .string()\n .min(1, 'Job name cannot be empty')\n .regex(/^[a-z][\\w-]*$/i, 'Job name must be alphanumeric and can contain underscores/dashes')\n .describe('The name of the job to create'),\n jobSlug: z\n .string()\n .min(1, 'Job slug cannot be empty')\n .regex(/^[a-z][a-z0-9-]*$/, 'Job slug must be kebab-case')\n .describe('The slug for the job (kebab-case format)'),\n jobType: z\n .enum(['task', 'workflow'])\n .describe('Whether to create a task (individual unit) or workflow (orchestrates tasks)'),\n outputSchema: z.record(z.any()).optional().default({}).describe('Output schema for the job'),\n }),\n },\n\n updateJob: {\n description: 'Updates an existing job with new configuration, schema, or handler code.',\n parameters: z.object({\n configUpdate: z.record(z.any()).optional().describe('New configuration for the job'),\n handlerCode: z\n .string()\n .optional()\n .describe('New handler code to replace the existing handler'),\n inputSchema: z.record(z.any()).optional().describe('New input schema for the job'),\n jobSlug: z.string().describe('The slug of the job to update'),\n outputSchema: z.record(z.any()).optional().describe('New output schema for the job'),\n taskSequence: z.array(z.any()).optional().describe('New task sequence for workflows'),\n updateType: z\n .enum(['modify_schema', 'update_tasks', 'change_config', 'replace_handler'])\n .describe('Type of update to perform on the job'),\n }),\n },\n\n runJob: {\n description: 'Runs a job with specified input data and queue options.',\n parameters: z.object({\n delay: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Delay in milliseconds before job execution'),\n input: z.record(z.any()).describe('Input data for the job execution'),\n jobSlug: z.string().describe('The slug of the job to run'),\n priority: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe('Job priority (1-10, higher is more important)'),\n queue: z\n .string()\n .optional()\n .describe('Queue name to use for job execution (default: \"default\")'),\n }),\n },\n}\n"],"names":["z","toolSchemas","findGlobal","description","parameters","object","depth","number","int","min","max","optional","default","describe","fallbackLocale","string","locale","select","findResources","id","union","draft","boolean","limit","page","sort","where","createResource","data","updateResource","filePath","overrideLock","overwriteExistingFiles","deleteResource","updateGlobal","createCollection","collectionDescription","collectionName","fields","array","any","hasUpload","findCollections","includeContent","includeCount","updateCollection","configUpdates","fieldModifications","fieldNamesToRemove","newContent","newFields","updateType","enum","deleteCollection","confirmDeletion","updateConfig","findConfig","includeMetadata","adminConfig","databaseConfig","pluginUpdates","auth","headers","login","collection","email","overrideAccess","password","showHiddenFields","verify","token","resetPassword","forgotPassword","disableEmail","unlock","createJob","inputSchema","record","jobData","jobName","regex","jobSlug","jobType","outputSchema","updateJob","configUpdate","handlerCode","taskSequence","runJob","delay","input","priority","queue"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAK;AAEvB,OAAO,MAAMC,cAAc;IACzBC,YAAY;QACVC,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBC,OAAON,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRC,OAAO,CAAC,GACRC,QAAQ,CAAC;YACZC,gBAAgBd,EACbe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,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J,EAAEK,MAAM,CAAC;YACnBoF,OAAOzF,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJE,QAAQ,GACRE,QAAQ,CAAC;YACZ6E,OAAO1F,EAAE6E,MAAM,CAAC7E,EAAEwC,GAAG,IAAI3B,QAAQ,CAAC;YAClCoE,SAASjF,EAAEe,MAAM,GAAGF,QAAQ,CAAC;YAC7B8E,UAAU3F,EACPO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRE,QAAQ,CAAC;YACZ+E,OAAO5F,EACJe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;QACd;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/mcp/tools/schemas.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const toolSchemas = {\n findGlobal: {\n description: 'Find a Payload global singleton configuration.',\n parameters: z.object({\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n }),\n },\n\n findResources: {\n description: 'Find documents in a collection by ID or where clause using Find or FindByID.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe(\n 'Optional: specific document ID to retrieve. If not provided, returns all documents',\n ),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('How many levels deep to populate relationships (default: 0)'),\n draft: z\n .boolean()\n .optional()\n .describe(\n 'Optional: Whether the document should be queried from the versions table/collection or not.',\n ),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n limit: z\n .number()\n .int()\n .min(1, 'Limit must be at least 1')\n .max(100, 'Limit cannot exceed 100')\n .optional()\n .default(10)\n .describe('Maximum number of documents to return (default: 10, max: 100)'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n page: z\n .number()\n .int()\n .min(1, 'Page must be at least 1')\n .optional()\n .default(1)\n .describe('Page number for pagination (default: 1)'),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n sort: z\n .string()\n .optional()\n .describe('Field to sort by (e.g., \"createdAt\", \"-updatedAt\" for descending)'),\n where: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string for where clause filtering (e.g., \\'{\"title\": {\"contains\": \"test\"}}\\')',\n ),\n }),\n },\n\n createResource: {\n description: 'Create a document in a collection.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data for the new document'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('How many levels deep to populate relationships in response (default: 0)'),\n draft: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to create the document as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to create the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n }),\n },\n\n updateResource: {\n description: 'Update documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to update'),\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n overrideLock: z\n .boolean()\n .optional()\n .default(true)\n .describe('Whether to override document locks'),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to update multiple documents'),\n }),\n },\n\n deleteResource: {\n description: 'Delete documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to delete'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships in response'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code for the operation (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to delete multiple documents'),\n }),\n },\n\n updateGlobal: {\n description: 'Update a Payload global singleton configuration.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update data in (e.g., \"en\", \"es\"). Use \"all\" to update all locales for localized fields',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"siteName\\\": true}'\",\n ),\n }),\n },\n\n // Experimental Below This Line\n createCollection: {\n description: 'Creates a new collection with specified fields and configuration.',\n parameters: z.object({\n collectionDescription: z\n .string()\n .optional()\n .describe('Optional description for the collection'),\n collectionName: z.string().describe('The name of the collection to create'),\n fields: z.array(z.any()).describe('Array of field definitions for the collection'),\n hasUpload: z\n .boolean()\n .optional()\n .describe('Whether the collection should have upload capabilities'),\n }),\n },\n\n findCollections: {\n description: 'Finds and lists collections with optional content and document counts.',\n parameters: z.object({\n collectionName: z\n .string()\n .optional()\n .describe('Optional: specific collection name to retrieve'),\n includeContent: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include collection file content'),\n includeCount: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include document counts for each collection'),\n }),\n },\n\n updateCollection: {\n description:\n 'Updates an existing collection with new fields, modifications, or configuration changes.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to update'),\n configUpdates: z.any().optional().describe('Configuration updates (for update_config type)'),\n fieldModifications: z\n .array(z.any())\n .optional()\n .describe('Field modifications (for modify_field type)'),\n fieldNamesToRemove: z\n .array(z.string())\n .optional()\n .describe('Field names to remove (for remove_field type)'),\n newContent: z\n .string()\n .optional()\n .describe('New content to replace entire collection (for replace_content type)'),\n newFields: z.array(z.any()).optional().describe('New fields to add (for add_field type)'),\n updateType: z\n .enum(['add_field', 'remove_field', 'modify_field', 'update_config', 'replace_content'])\n .describe('Type of update to perform'),\n }),\n },\n\n deleteCollection: {\n description: 'Deletes a collection and optionally updates the configuration.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to delete'),\n confirmDeletion: z.boolean().describe('Confirmation flag to prevent accidental deletion'),\n updateConfig: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to update payload.config.ts to remove collection reference'),\n }),\n },\n\n findConfig: {\n description: 'Reads and displays the current configuration file.',\n parameters: z.object({\n includeMetadata: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include file metadata (size, modified date, etc.)'),\n }),\n },\n\n updateConfig: {\n description: 'Updates the configuration file with various modifications.',\n parameters: z.object({\n adminConfig: z\n .any()\n .optional()\n .describe('Admin configuration updates (for update_admin type)'),\n collectionName: z\n .string()\n .optional()\n .describe('Collection name (required for add_collection and remove_collection)'),\n databaseConfig: z\n .any()\n .optional()\n .describe('Database configuration updates (for update_database type)'),\n newContent: z\n .string()\n .optional()\n .describe('New configuration content (for replace_content type)'),\n pluginUpdates: z\n .any()\n .optional()\n .describe('Plugin configuration updates (for update_plugins type)'),\n updateType: z\n .enum([\n 'add_collection',\n 'remove_collection',\n 'update_admin',\n 'update_database',\n 'update_plugins',\n 'replace_content',\n ])\n .describe('Type of configuration update to perform'),\n }),\n },\n\n auth: {\n description: 'Checks authentication status for the current user.',\n parameters: z.object({\n headers: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string containing custom headers to send with the authentication request',\n ),\n }),\n },\n\n login: {\n description: 'Authenticates a user with email and password.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n email: z.string().email().describe('The user email address'),\n password: z.string().describe('The user password'),\n }),\n },\n\n verify: {\n description: 'Verifies a user email with a verification token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n token: z.string().describe('The verification token sent to the user email'),\n }),\n },\n\n resetPassword: {\n description: 'Resets a user password with a reset token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n password: z.string().describe('The new password for the user'),\n token: z.string().describe('The password reset token sent to the user email'),\n }),\n },\n\n forgotPassword: {\n description: 'Sends a password reset email to a user.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n disableEmail: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to disable sending the email (for testing)'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n unlock: {\n description: 'Unlocks a user account that has been locked due to failed login attempts.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n createJob: {\n description: 'Creates a new job (task or workflow) with specified configuration.',\n parameters: z.object({\n description: z.string().describe('Description of what the job does'),\n inputSchema: z.record(z.any()).optional().default({}).describe('Input schema for the job'),\n jobData: z\n .record(z.any())\n .optional()\n .default({})\n .describe('Additional job configuration data'),\n jobName: z\n .string()\n .min(1, 'Job name cannot be empty')\n .regex(/^[a-z][\\w-]*$/i, 'Job name must be alphanumeric and can contain underscores/dashes')\n .describe('The name of the job to create'),\n jobSlug: z\n .string()\n .min(1, 'Job slug cannot be empty')\n .regex(/^[a-z][a-z0-9-]*$/, 'Job slug must be kebab-case')\n .describe('The slug for the job (kebab-case format)'),\n jobType: z\n .enum(['task', 'workflow'])\n .describe('Whether to create a task (individual unit) or workflow (orchestrates tasks)'),\n outputSchema: z.record(z.any()).optional().default({}).describe('Output schema for the job'),\n }),\n },\n\n updateJob: {\n description: 'Updates an existing job with new configuration, schema, or handler code.',\n parameters: z.object({\n configUpdate: z.record(z.any()).optional().describe('New configuration for the job'),\n handlerCode: z\n .string()\n .optional()\n .describe('New handler code to replace the existing handler'),\n inputSchema: z.record(z.any()).optional().describe('New input schema for the job'),\n jobSlug: z.string().describe('The slug of the job to update'),\n outputSchema: z.record(z.any()).optional().describe('New output schema for the job'),\n taskSequence: z.array(z.any()).optional().describe('New task sequence for workflows'),\n updateType: z\n .enum(['modify_schema', 'update_tasks', 'change_config', 'replace_handler'])\n .describe('Type of update to perform on the job'),\n }),\n },\n\n runJob: {\n description: 'Runs a job with specified input data and queue options.',\n parameters: z.object({\n delay: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Delay in milliseconds before job execution'),\n input: z.record(z.any()).describe('Input data for the job execution'),\n jobSlug: z.string().describe('The slug of the job to run'),\n priority: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe('Job priority (1-10, higher is more important)'),\n queue: z\n .string()\n .optional()\n .describe('Queue name to use for job execution (default: \"default\")'),\n }),\n },\n}\n"],"names":["z","toolSchemas","findGlobal","description","parameters","object","depth","number","int","min","max","optional","default","describe","fallbackLocale","string","locale","select","findResources","id","union","draft","boolean","limit","page","sort","where","createResource","data","updateResource","overrideLock","deleteResource","updateGlobal","createCollection","collectionDescription","collectionName","fields","array","any","hasUpload","findCollections","includeContent","includeCount","updateCollection","configUpdates","fieldModifications","fieldNamesToRemove","newContent","newFields","updateType","enum","deleteCollection","confirmDeletion","updateConfig","findConfig","includeMetadata","adminConfig","databaseConfig","pluginUpdates","auth","headers","login","collection","email","password","verify","token","resetPassword","forgotPassword","disableEmail","unlock","createJob","inputSchema","record","jobData","jobName","regex","jobSlug","jobType","outputSchema","updateJob","configUpdate","handlerCode","taskSequence","runJob","delay","input","priority","queue"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAK;AAEvB,OAAO,MAAMC,cAAc;IACzBC,YAAY;QACVC,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBC,OAAON,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRC,OAAO,CAAC,GACRC,QAAQ,CAAC;YACZC,gBAAgBd,EACbe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;YACZG,QAAQhB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;YAEJI,QAAQjB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;QAEN;IACF;IAEAK,eAAe;QACbf,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBc,IAAInB,EACDoB,KAAK,CAAC;gBAACpB,EAAEe,MAAM;gBAAIf,EAAEO,MAAM;aAAG,EAC9BI,QAAQ,GACRE,QAAQ,CACP;YAEJP,OAAON,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRC,OAAO,CAAC,GACRC,QAAQ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ACRE,QAAQ,CAAC;YACZ2D,aAAaxE,EAAEyE,MAAM,CAACzE,EAAEsC,GAAG,IAAI3B,QAAQ,GAAGE,QAAQ,CAAC;YACnDgE,SAAS7E,EAAEe,MAAM,GAAGF,QAAQ,CAAC;YAC7BkE,cAAc/E,EAAEyE,MAAM,CAACzE,EAAEsC,GAAG,IAAI3B,QAAQ,GAAGE,QAAQ,CAAC;YACpDsE,cAAcnF,EAAEqC,KAAK,CAACrC,EAAEsC,GAAG,IAAI3B,QAAQ,GAAGE,QAAQ,CAAC;YACnDoC,YAAYjD,EACTkD,IAAI,CAAC;gBAAC;gBAAiB;gBAAgB;gBAAiB;aAAkB,EAC1ErC,QAAQ,CAAC;QACd;IACF;IAEAuE,QAAQ;QACNjF,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBgF,OAAOrF,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJE,QAAQ,GACRE,QAAQ,CAAC;YACZyE,OAAOtF,EAAEyE,MAAM,CAACzE,EAAEsC,GAAG,IAAIzB,QAAQ,CAAC;YAClCgE,SAAS7E,EAAEe,MAAM,GAAGF,QAAQ,CAAC;YAC7B0E,UAAUvF,EACPO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRE,QAAQ,CAAC;YACZ2E,OAAOxF,EACJe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;QACd;IACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-mcp",
3
- "version": "3.87.0",
3
+ "version": "3.88.0",
4
4
  "description": "MCP (Model Context Protocol) capabilities with Payload",
5
5
  "keywords": [
6
6
  "plugin",
@@ -37,7 +37,7 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@modelcontextprotocol/sdk": "1.27.1",
40
+ "@modelcontextprotocol/sdk": "1.30.0",
41
41
  "@types/json-schema": "7.0.15",
42
42
  "json-schema-to-zod": "2.6.1",
43
43
  "mcp-handler": "^1.0.7",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@payloadcms/eslint-config": "3.28.0",
48
- "payload": "3.87.0"
48
+ "payload": "3.88.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "payload": "3.87.0"
51
+ "payload": "3.88.0"
52
52
  },
53
53
  "homepage:": "https://payloadcms.com",
54
54
  "scripts": {
@@ -1,4 +1,4 @@
1
- import type { CollectionConfig, CollectionSlug } from 'payload'
1
+ import type { CollectionConfig, CollectionSlug, PayloadRequest, Where } from 'payload'
2
2
 
3
3
  import type { MCPPluginConfig } from '../types.js'
4
4
 
@@ -55,8 +55,24 @@ export const createAPIKeysCollection = (
55
55
 
56
56
  const userCollection = pluginOptions.userCollection
57
57
 
58
+ const isAuthenticated = ({ req }: { req: PayloadRequest }): boolean =>
59
+ Boolean(req.user && req.user.collection === userCollection)
60
+
61
+ const restrictToOwnKeys = ({ req }: { req: PayloadRequest }): boolean | Where =>
62
+ req.user && req.user.collection === userCollection ? { user: { equals: req.user.id } } : false
63
+
58
64
  return {
59
65
  slug: 'payload-mcp-api-keys',
66
+ access: {
67
+ // Fail-safe default: any authenticated user may manage only their OWN keys.
68
+ // Cross-user key issuance is disabled by default (see the `user` field below)
69
+ // and must be granted explicitly via `overrideApiKeyCollection`.
70
+ create: isAuthenticated,
71
+ delete: restrictToOwnKeys,
72
+ read: restrictToOwnKeys,
73
+ unlock: restrictToOwnKeys,
74
+ update: restrictToOwnKeys,
75
+ },
60
76
  admin: {
61
77
  description:
62
78
  'API keys control which collections, resources, tools, and prompts MCP clients can access',
@@ -71,9 +87,19 @@ export const createAPIKeysCollection = (
71
87
  {
72
88
  name: 'user',
73
89
  type: 'relationship',
90
+ access: {
91
+ // Bind new keys to the creating user and prevent re-binding on update.
92
+ // A key acts as its associated user, so allowing arbitrary assignment lets
93
+ // any key manager impersonate anyone. Grant these via `overrideApiKeyCollection`
94
+ // to let trusted administrators issue keys on behalf of other users.
95
+ create: () => false,
96
+ update: () => false,
97
+ },
74
98
  admin: {
75
99
  description: 'The user that the API key is associated with.',
76
100
  },
101
+ defaultValue: ({ req }: { req: PayloadRequest }) =>
102
+ req.user && req.user.collection === userCollection ? req.user.id : undefined,
77
103
  relationTo: userCollection as CollectionSlug,
78
104
  required: true,
79
105
  },
@@ -1,91 +1,26 @@
1
- import crypto from 'crypto'
2
- import { type PayloadHandler, type TypedUser, UnauthorizedError, type Where } from 'payload'
1
+ import type { PayloadHandler } from 'payload'
3
2
 
4
- import type { MCPAccessSettings, MCPPluginConfig } from '../types.js'
3
+ import type { MCPPluginConfig } from '../types.js'
5
4
 
6
5
  import { createRequestFromPayloadRequest } from '../mcp/createRequest.js'
7
- import { getMCPHandler } from '../mcp/getMcpHandler.js'
6
+ import { getMcpHandler } from '../mcp/getMcpHandler.js'
7
+ import { resolveAccessSettings } from './resolveAccessSettings.js'
8
+ import { withRestoredWebGlobals } from './withRestoredWebGlobals.js'
8
9
 
9
10
  export const initializeMCPHandler = (pluginOptions: MCPPluginConfig) => {
10
11
  const mcpHandler: PayloadHandler = async (req) => {
11
- const { payload } = req
12
- const MCPOptions = pluginOptions.mcp || {}
13
- const MCPHandlerOptions = MCPOptions.handlerOptions || {}
14
- const useVerboseLogs = MCPHandlerOptions.verboseLogs ?? false
12
+ const useVerboseLogs = pluginOptions.mcp?.handlerOptions?.verboseLogs ?? false
15
13
 
16
14
  req.payloadAPI = 'MCP' as const
17
15
 
18
- const getDefaultMcpAccessSettings = async (overrideApiKey?: null | string) => {
19
- const apiKey =
20
- (overrideApiKey ?? req.headers.get('Authorization')?.startsWith('Bearer '))
21
- ? req.headers.get('Authorization')?.replace('Bearer ', '').trim()
22
- : null
16
+ const mcpAccessSettings = await resolveAccessSettings({ pluginOptions, req, useVerboseLogs })
17
+ req.user = mcpAccessSettings.user
23
18
 
24
- if (apiKey === null) {
25
- throw new UnauthorizedError()
26
- }
27
-
28
- const sha256APIKeyIndex = crypto
29
- .createHmac('sha256', payload.secret)
30
- .update(apiKey || '')
31
- .digest('hex')
32
-
33
- const where: Where = {
34
- apiKeyIndex: {
35
- equals: sha256APIKeyIndex,
36
- },
37
- }
38
-
39
- const { docs } = await payload.find({
40
- collection: 'payload-mcp-api-keys',
41
- depth: 1,
42
- limit: 1,
43
- pagination: false,
44
- where,
45
- })
46
-
47
- if (docs.length === 0) {
48
- throw new UnauthorizedError()
49
- }
50
-
51
- if (useVerboseLogs) {
52
- payload.logger.info('[payload-mcp] API Key is valid')
53
- }
54
-
55
- const user = docs[0]?.user as TypedUser
56
- user.collection = pluginOptions.userCollection as string
57
- user._strategy = 'mcp-api-key' as const
58
-
59
- return docs[0] as unknown as MCPAccessSettings
60
- }
61
-
62
- const mcpAccessSettings = pluginOptions.overrideAuth
63
- ? await pluginOptions.overrideAuth(req, getDefaultMcpAccessSettings)
64
- : await getDefaultMcpAccessSettings()
65
-
66
- // @modelcontextprotocol/sdk's StreamableHTTPServerTransport uses @hono/node-server's
67
- // getRequestListener, which replaces global.Request and global.Response with Hono
68
- // custom classes. Unfortunately, we cannot pass overrideGlobalObjects: false because the option is
69
- // consumed inside the SDK transport and is not exposed to callers.
70
- // Save originals here and restore after the handler resolves so that Next.js
71
- // instanceof Response checks on subsequent route handlers keep working.
72
- const globals = globalThis as Record<string, unknown>
73
- const originalResponse = globals['Response']
74
- const originalRequest = globals['Request']
75
-
76
- const handler = getMCPHandler(pluginOptions, mcpAccessSettings, req)
77
- const request = createRequestFromPayloadRequest(req)
78
-
79
- try {
19
+ return await withRestoredWebGlobals(async () => {
20
+ const handler = getMcpHandler(pluginOptions, mcpAccessSettings, req)
21
+ const request = createRequestFromPayloadRequest(req)
80
22
  return await handler(request)
81
- } finally {
82
- if (globals['Response'] !== originalResponse) {
83
- Object.defineProperty(globalThis, 'Response', { value: originalResponse })
84
- }
85
- if (globals['Request'] !== originalRequest) {
86
- Object.defineProperty(globalThis, 'Request', { value: originalRequest })
87
- }
88
- }
23
+ })
89
24
  }
90
25
  return mcpHandler
91
26
  }
@@ -0,0 +1,74 @@
1
+ import crypto from 'crypto'
2
+ import { type PayloadRequest, type TypedUser, UnauthorizedError, type Where } from 'payload'
3
+
4
+ import type { MCPAccessSettings, MCPPluginConfig } from '../types.js'
5
+
6
+ type ResolveAccessSettingsArgs = {
7
+ pluginOptions: MCPPluginConfig
8
+ req: PayloadRequest
9
+ useVerboseLogs: boolean
10
+ }
11
+
12
+ const createDefaultAccessSettingsResolver = ({
13
+ pluginOptions,
14
+ req,
15
+ useVerboseLogs,
16
+ }: ResolveAccessSettingsArgs) => {
17
+ return async (overrideApiKey?: null | string): Promise<MCPAccessSettings> => {
18
+ const authorization = req.headers.get('Authorization')
19
+ const apiKey =
20
+ overrideApiKey ??
21
+ (authorization?.startsWith('Bearer ') ? authorization.replace('Bearer ', '').trim() : null)
22
+
23
+ if (apiKey === null) {
24
+ throw new UnauthorizedError()
25
+ }
26
+
27
+ const sha256APIKeyIndex = crypto
28
+ .createHmac('sha256', req.payload.secret)
29
+ .update(apiKey || '')
30
+ .digest('hex')
31
+ const where: Where = {
32
+ apiKeyIndex: {
33
+ equals: sha256APIKeyIndex,
34
+ },
35
+ }
36
+ const { docs } = await req.payload.find({
37
+ collection: 'payload-mcp-api-keys',
38
+ depth: 1,
39
+ limit: 1,
40
+ pagination: false,
41
+ where,
42
+ })
43
+ const apiKeyDoc = docs[0]
44
+
45
+ if (!apiKeyDoc) {
46
+ throw new UnauthorizedError()
47
+ }
48
+
49
+ if (useVerboseLogs) {
50
+ req.payload.logger.info('[payload-mcp] API Key is valid')
51
+ }
52
+
53
+ const user = apiKeyDoc.user as TypedUser
54
+
55
+ if (!user || typeof user !== 'object' || !('id' in user)) {
56
+ throw new UnauthorizedError()
57
+ }
58
+
59
+ user.collection = pluginOptions.userCollection as string
60
+ user._strategy = 'mcp-api-key' as const
61
+
62
+ return apiKeyDoc as unknown as MCPAccessSettings
63
+ }
64
+ }
65
+
66
+ export const resolveAccessSettings = async (
67
+ args: ResolveAccessSettingsArgs,
68
+ ): Promise<MCPAccessSettings> => {
69
+ const getDefaultMcpAccessSettings = createDefaultAccessSettingsResolver(args)
70
+
71
+ return args.pluginOptions.overrideAuth
72
+ ? await args.pluginOptions.overrideAuth(args.req, getDefaultMcpAccessSettings)
73
+ : await getDefaultMcpAccessSettings()
74
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Restores globals replaced by @hono/node-server while handling an MCP request.
3
+ */
4
+ export const withRestoredWebGlobals = async <T>(handler: () => Promise<T>): Promise<T> => {
5
+ const globals = globalThis as Record<string, unknown>
6
+ const originalRequest = globals['Request']
7
+ const originalResponse = globals['Response']
8
+
9
+ try {
10
+ return await handler()
11
+ } finally {
12
+ if (globals['Response'] !== originalResponse) {
13
+ Object.defineProperty(globalThis, 'Response', { value: originalResponse })
14
+ }
15
+ if (globals['Request'] !== originalRequest) {
16
+ Object.defineProperty(globalThis, 'Request', { value: originalRequest })
17
+ }
18
+ }
19
+ }
@@ -2,7 +2,7 @@ import type { JSONSchema4 } from 'json-schema'
2
2
 
3
3
  import { createMcpHandler } from 'mcp-handler'
4
4
  import { join } from 'path'
5
- import { APIError, configToJSONSchema, type PayloadRequest, type TypedUser } from 'payload'
5
+ import { APIError, configToJSONSchema, type PayloadRequest } from 'payload'
6
6
 
7
7
  import type { MCPAccessSettings, MCPPluginConfig } from '../types.js'
8
8
 
@@ -43,7 +43,7 @@ import { createJobTool } from './tools/job/create.js'
43
43
  import { runJobTool } from './tools/job/run.js'
44
44
  import { updateJobTool } from './tools/job/update.js'
45
45
 
46
- export const getMCPHandler = (
46
+ export const getMcpHandler = (
47
47
  pluginOptions: MCPPluginConfig,
48
48
  mcpAccessSettings: MCPAccessSettings,
49
49
  req: PayloadRequest,
@@ -78,32 +78,25 @@ export const getMCPHandler = (
78
78
  const user = mcpAccessSettings.user
79
79
 
80
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
81
+ const mcpOptions = pluginOptions.mcp || {}
82
+ const customTools = mcpOptions.tools || []
83
+ const customPrompts = mcpOptions.prompts || []
84
+ const customResources = mcpOptions.resources || []
85
+ const mcpHandlerOptions = mcpOptions.handlerOptions || {}
86
+ const serverOptions = mcpOptions.serverOptions || {}
87
+ const useVerboseLogs = mcpHandlerOptions.verboseLogs ?? false
88
88
 
89
89
  // Experimental MCP Tool Requirements
90
90
  const isDevelopment = process.env.NODE_ENV === 'development'
91
91
  const experimentalTools: NonNullable<MCPPluginConfig['experimental']>['tools'] =
92
- pluginOptions?.experimental?.tools || {}
92
+ pluginOptions.experimental?.tools || {}
93
93
  const collectionsPluginConfig = pluginOptions.collections || {}
94
94
  const globalsPluginConfig = pluginOptions.globals || {}
95
95
  const collectionsDirPath =
96
- experimentalTools && experimentalTools.collections?.collectionsDirPath
97
- ? experimentalTools.collections.collectionsDirPath
98
- : join(process.cwd(), 'src/collections')
96
+ experimentalTools.collections?.collectionsDirPath || join(process.cwd(), 'src/collections')
99
97
  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')
98
+ experimentalTools.config?.configFilePath || join(process.cwd(), 'src/payload.config.ts')
99
+ const jobsDirPath = experimentalTools.jobs?.jobsDirPath || join(process.cwd(), 'src/jobs')
107
100
 
108
101
  try {
109
102
  return createMcpHandler(
@@ -274,7 +267,7 @@ export const getMCPHandler = (
274
267
  })
275
268
 
276
269
  // Custom tools
277
- customMCPTools.forEach((tool) => {
270
+ customTools.forEach((tool) => {
278
271
  const camelCasedToolName = toCamelCase(tool.name)
279
272
  const isToolEnabled = mcpAccessSettings['payload-mcp-tool']?.[camelCasedToolName] ?? false
280
273
 
@@ -296,7 +289,7 @@ export const getMCPHandler = (
296
289
  })
297
290
 
298
291
  // Custom prompts
299
- customMCPPrompts.forEach((prompt) => {
292
+ customPrompts.forEach((prompt) => {
300
293
  const camelCasedPromptName = toCamelCase(prompt.name)
301
294
  const isPromptEnabled =
302
295
  mcpAccessSettings['payload-mcp-prompt']?.[camelCasedPromptName] ?? false
@@ -320,7 +313,7 @@ export const getMCPHandler = (
320
313
  })
321
314
 
322
315
  // Custom resources
323
- customMCPResources.forEach((resource) => {
316
+ customResources.forEach((resource) => {
324
317
  const camelCasedResourceName = toCamelCase(resource.name)
325
318
  const isResourceEnabled =
326
319
  mcpAccessSettings['payload-mcp-resource']?.[camelCasedResourceName] ?? false
@@ -492,7 +485,11 @@ export const getMCPHandler = (
492
485
  )
493
486
  }
494
487
 
495
- if (mcpAccessSettings.auth?.resetPassword && experimentalTools.auth?.enabled) {
488
+ if (
489
+ mcpAccessSettings.auth?.resetPassword &&
490
+ experimentalTools.auth?.enabled &&
491
+ isDevelopment
492
+ ) {
496
493
  registerTool(
497
494
  mcpAccessSettings.auth.resetPassword,
498
495
  'Reset Password',
@@ -502,7 +499,11 @@ export const getMCPHandler = (
502
499
  )
503
500
  }
504
501
 
505
- if (mcpAccessSettings.auth?.forgotPassword && experimentalTools.auth?.enabled) {
502
+ if (
503
+ mcpAccessSettings.auth?.forgotPassword &&
504
+ experimentalTools.auth?.enabled &&
505
+ isDevelopment
506
+ ) {
506
507
  registerTool(
507
508
  mcpAccessSettings.auth.forgotPassword,
508
509
  'Forgot Password',
@@ -512,7 +513,7 @@ export const getMCPHandler = (
512
513
  )
513
514
  }
514
515
 
515
- if (mcpAccessSettings.auth?.unlock && experimentalTools.auth?.enabled) {
516
+ if (mcpAccessSettings.auth?.unlock && experimentalTools.auth?.enabled && isDevelopment) {
516
517
  registerTool(
517
518
  mcpAccessSettings.auth.unlock,
518
519
  'Unlock',
@@ -531,11 +532,11 @@ export const getMCPHandler = (
531
532
  serverInfo: serverOptions.serverInfo,
532
533
  },
533
534
  {
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,
535
+ basePath: mcpHandlerOptions.basePath || payload.config.routes?.api || '/api',
536
+ disableSse: mcpHandlerOptions.disableSse ?? true,
537
+ maxDuration: mcpHandlerOptions.maxDuration || 60,
538
+ onEvent: mcpHandlerOptions.onEvent,
539
+ redisUrl: mcpHandlerOptions.redisUrl,
539
540
  verboseLogs: useVerboseLogs,
540
541
  },
541
542
  )