@payloadcms/plugin-mcp 3.63.0 → 3.64.0-internal.23abf20

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 (42) hide show
  1. package/dist/collections/createApiKeysCollection.d.ts +2 -2
  2. package/dist/collections/createApiKeysCollection.d.ts.map +1 -1
  3. package/dist/collections/createApiKeysCollection.js +67 -6
  4. package/dist/collections/createApiKeysCollection.js.map +1 -1
  5. package/dist/endpoints/mcp.d.ts.map +1 -1
  6. package/dist/endpoints/mcp.js +2 -2
  7. package/dist/endpoints/mcp.js.map +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/mcp/getMcpHandler.d.ts +2 -2
  12. package/dist/mcp/getMcpHandler.d.ts.map +1 -1
  13. package/dist/mcp/getMcpHandler.js +61 -49
  14. package/dist/mcp/getMcpHandler.js.map +1 -1
  15. package/dist/mcp/tools/resource/create.d.ts.map +1 -1
  16. package/dist/mcp/tools/resource/create.js +2 -1
  17. package/dist/mcp/tools/resource/create.js.map +1 -1
  18. package/dist/mcp/tools/resource/delete.d.ts.map +1 -1
  19. package/dist/mcp/tools/resource/delete.js +2 -1
  20. package/dist/mcp/tools/resource/delete.js.map +1 -1
  21. package/dist/mcp/tools/resource/find.d.ts.map +1 -1
  22. package/dist/mcp/tools/resource/find.js +3 -1
  23. package/dist/mcp/tools/resource/find.js.map +1 -1
  24. package/dist/mcp/tools/resource/update.d.ts.map +1 -1
  25. package/dist/mcp/tools/resource/update.js +4 -2
  26. package/dist/mcp/tools/resource/update.js.map +1 -1
  27. package/dist/mcp/tools/schemas.js +13 -13
  28. package/dist/mcp/tools/schemas.js.map +1 -1
  29. package/dist/types.d.ts +9 -3
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/types.js.map +1 -1
  32. package/package.json +3 -3
  33. package/src/collections/createApiKeysCollection.ts +80 -3
  34. package/src/endpoints/mcp.ts +3 -3
  35. package/src/index.ts +6 -1
  36. package/src/mcp/getMcpHandler.ts +79 -59
  37. package/src/mcp/tools/resource/create.ts +2 -1
  38. package/src/mcp/tools/resource/delete.ts +2 -1
  39. package/src/mcp/tools/resource/find.ts +3 -1
  40. package/src/mcp/tools/resource/update.ts +4 -2
  41. package/src/mcp/tools/schemas.ts +13 -13
  42. package/src/types.ts +10 -4
@@ -4,7 +4,7 @@ import { createMcpHandler } from '@vercel/mcp-adapter'
4
4
  import { join } from 'path'
5
5
  import { APIError, configToJSONSchema, type PayloadRequest, type TypedUser } from 'payload'
6
6
 
7
- import type { PluginMCPServerConfig, ToolSettings } from '../types.js'
7
+ import type { MCPAccessSettings, PluginMCPServerConfig } from '../types.js'
8
8
 
9
9
  import { toCamelCase } from '../utils/camelCase.js'
10
10
  import { registerTool } from './registerTool.js'
@@ -34,14 +34,14 @@ import { updateJobTool } from './tools/job/update.js'
34
34
 
35
35
  export const getMCPHandler = (
36
36
  pluginOptions: PluginMCPServerConfig,
37
- toolSettings: ToolSettings,
37
+ mcpAccessSettings: MCPAccessSettings,
38
38
  req: PayloadRequest,
39
39
  ) => {
40
40
  const { payload } = req
41
41
  const configSchema = configToJSONSchema(payload.config)
42
42
 
43
43
  // User
44
- const user = toolSettings.user as TypedUser
44
+ const user = mcpAccessSettings.user as TypedUser
45
45
 
46
46
  // MCP Server and Handler Options
47
47
  const MCPOptions = pluginOptions.mcp || {}
@@ -105,7 +105,7 @@ export const getMCPHandler = (
105
105
  try {
106
106
  const schema = configSchema.definitions?.[enabledCollectionSlug] as JSONSchema4
107
107
 
108
- const toolCapabilities = toolSettings?.[
108
+ const toolCapabilities = mcpAccessSettings?.[
109
109
  `${toCamelCase(enabledCollectionSlug)}`
110
110
  ] as Record<string, unknown>
111
111
  const allowCreate: boolean | undefined = toolCapabilities['create'] as boolean
@@ -194,7 +194,7 @@ export const getMCPHandler = (
194
194
  // Custom tools
195
195
  customMCPTools.forEach((tool) => {
196
196
  const camelCasedToolName = toCamelCase(tool.name)
197
- const isToolEnabled = toolSettings.custom?.[camelCasedToolName] ?? true
197
+ const isToolEnabled = mcpAccessSettings['payload-mcp-tool']?.[camelCasedToolName] ?? true
198
198
 
199
199
  registerTool(
200
200
  isToolEnabled,
@@ -207,47 +207,63 @@ export const getMCPHandler = (
207
207
 
208
208
  // Custom prompts
209
209
  customMCPPrompts.forEach((prompt) => {
210
- server.registerPrompt(
211
- prompt.name,
212
- {
213
- argsSchema: prompt.argsSchema,
214
- description: prompt.description,
215
- title: prompt.title,
216
- },
217
- prompt.handler,
218
- )
219
- if (useVerboseLogs) {
220
- payload.logger.info(`[payload-mcp] ✅ Prompt: ${prompt.title} Registered.`)
210
+ const camelCasedPromptName = toCamelCase(prompt.name)
211
+ const isPromptEnabled =
212
+ mcpAccessSettings['payload-mcp-prompt']?.[camelCasedPromptName] ?? true
213
+
214
+ if (isPromptEnabled) {
215
+ server.registerPrompt(
216
+ prompt.name,
217
+ {
218
+ argsSchema: prompt.argsSchema,
219
+ description: prompt.description,
220
+ title: prompt.title,
221
+ },
222
+ prompt.handler,
223
+ )
224
+ if (useVerboseLogs) {
225
+ payload.logger.info(`[payload-mcp] ✅ Prompt: ${prompt.title} Registered.`)
226
+ }
227
+ } else if (useVerboseLogs) {
228
+ payload.logger.info(`[payload-mcp] ⏭️ Prompt: ${prompt.title} Skipped.`)
221
229
  }
222
230
  })
223
231
 
224
232
  // Custom resources
225
233
  customMCPResources.forEach((resource) => {
226
- server.registerResource(
227
- resource.name,
228
- // @ts-expect-error - Overload type is not working however -- ResourceTemplate OR String is a valid type
229
- resource.uri,
230
- {
231
- description: resource.description,
232
- mimeType: resource.mimeType,
233
- title: resource.title,
234
- },
235
- resource.handler,
236
- )
234
+ const camelCasedResourceName = toCamelCase(resource.name)
235
+ const isResourceEnabled =
236
+ mcpAccessSettings['payload-mcp-resource']?.[camelCasedResourceName] ?? true
237
+
238
+ if (isResourceEnabled) {
239
+ server.registerResource(
240
+ resource.name,
241
+ // @ts-expect-error - Overload type is not working however -- ResourceTemplate OR String is a valid type
242
+ resource.uri,
243
+ {
244
+ description: resource.description,
245
+ mimeType: resource.mimeType,
246
+ title: resource.title,
247
+ },
248
+ resource.handler,
249
+ )
237
250
 
238
- if (useVerboseLogs) {
239
- payload.logger.info(`[payload-mcp] ✅ Resource: ${resource.title} Registered.`)
251
+ if (useVerboseLogs) {
252
+ payload.logger.info(`[payload-mcp] ✅ Resource: ${resource.title} Registered.`)
253
+ }
254
+ } else if (useVerboseLogs) {
255
+ payload.logger.info(`[payload-mcp] ⏭️ Resource: ${resource.title} Skipped.`)
240
256
  }
241
257
  })
242
258
 
243
259
  // Experimental - Collection Schema Modfication Tools
244
260
  if (
245
- toolSettings.collections?.create &&
261
+ mcpAccessSettings.collections?.create &&
246
262
  experimentalTools.collections?.enabled &&
247
263
  isDevelopment
248
264
  ) {
249
265
  registerTool(
250
- toolSettings.collections.create,
266
+ mcpAccessSettings.collections.create,
251
267
  'Create Collection',
252
268
  () =>
253
269
  createCollectionTool(server, req, useVerboseLogs, collectionsDirPath, configFilePath),
@@ -256,12 +272,12 @@ export const getMCPHandler = (
256
272
  )
257
273
  }
258
274
  if (
259
- toolSettings.collections?.delete &&
275
+ mcpAccessSettings.collections?.delete &&
260
276
  experimentalTools.collections?.enabled &&
261
277
  isDevelopment
262
278
  ) {
263
279
  registerTool(
264
- toolSettings.collections.delete,
280
+ mcpAccessSettings.collections.delete,
265
281
  'Delete Collection',
266
282
  () =>
267
283
  deleteCollectionTool(server, req, useVerboseLogs, collectionsDirPath, configFilePath),
@@ -271,12 +287,12 @@ export const getMCPHandler = (
271
287
  }
272
288
 
273
289
  if (
274
- toolSettings.collections?.find &&
290
+ mcpAccessSettings.collections?.find &&
275
291
  experimentalTools.collections?.enabled &&
276
292
  isDevelopment
277
293
  ) {
278
294
  registerTool(
279
- toolSettings.collections.find,
295
+ mcpAccessSettings.collections.find,
280
296
  'Find Collection',
281
297
  () => findCollectionTool(server, req, useVerboseLogs, collectionsDirPath),
282
298
  payload,
@@ -285,12 +301,12 @@ export const getMCPHandler = (
285
301
  }
286
302
 
287
303
  if (
288
- toolSettings.collections?.update &&
304
+ mcpAccessSettings.collections?.update &&
289
305
  experimentalTools.collections?.enabled &&
290
306
  isDevelopment
291
307
  ) {
292
308
  registerTool(
293
- toolSettings.collections.update,
309
+ mcpAccessSettings.collections.update,
294
310
  'Update Collection',
295
311
  () =>
296
312
  updateCollectionTool(server, req, useVerboseLogs, collectionsDirPath, configFilePath),
@@ -300,9 +316,9 @@ export const getMCPHandler = (
300
316
  }
301
317
 
302
318
  // Experimental - Payload Config Modification Tools
303
- if (toolSettings.config?.find && experimentalTools.config?.enabled && isDevelopment) {
319
+ if (mcpAccessSettings.config?.find && experimentalTools.config?.enabled && isDevelopment) {
304
320
  registerTool(
305
- toolSettings.config.find,
321
+ mcpAccessSettings.config.find,
306
322
  'Find Config',
307
323
  () => findConfigTool(server, req, useVerboseLogs, configFilePath),
308
324
  payload,
@@ -310,9 +326,13 @@ export const getMCPHandler = (
310
326
  )
311
327
  }
312
328
 
313
- if (toolSettings.config?.update && experimentalTools.config?.enabled && isDevelopment) {
329
+ if (
330
+ mcpAccessSettings.config?.update &&
331
+ experimentalTools.config?.enabled &&
332
+ isDevelopment
333
+ ) {
314
334
  registerTool(
315
- toolSettings.config.update,
335
+ mcpAccessSettings.config.update,
316
336
  'Update Config',
317
337
  () => updateConfigTool(server, req, useVerboseLogs, configFilePath),
318
338
  payload,
@@ -321,9 +341,9 @@ export const getMCPHandler = (
321
341
  }
322
342
 
323
343
  // Experimental - Job Modification Tools
324
- if (toolSettings.jobs?.create && experimentalTools.jobs?.enabled && isDevelopment) {
344
+ if (mcpAccessSettings.jobs?.create && experimentalTools.jobs?.enabled && isDevelopment) {
325
345
  registerTool(
326
- toolSettings.jobs.create,
346
+ mcpAccessSettings.jobs.create,
327
347
  'Create Job',
328
348
  () => createJobTool(server, req, useVerboseLogs, jobsDirPath),
329
349
  payload,
@@ -331,9 +351,9 @@ export const getMCPHandler = (
331
351
  )
332
352
  }
333
353
 
334
- if (toolSettings.jobs?.update && experimentalTools.jobs?.enabled && isDevelopment) {
354
+ if (mcpAccessSettings.jobs?.update && experimentalTools.jobs?.enabled && isDevelopment) {
335
355
  registerTool(
336
- toolSettings.jobs.update,
356
+ mcpAccessSettings.jobs.update,
337
357
  'Update Job',
338
358
  () => updateJobTool(server, req, useVerboseLogs, jobsDirPath),
339
359
  payload,
@@ -341,9 +361,9 @@ export const getMCPHandler = (
341
361
  )
342
362
  }
343
363
 
344
- if (toolSettings.jobs?.run && experimentalTools.jobs?.enabled && isDevelopment) {
364
+ if (mcpAccessSettings.jobs?.run && experimentalTools.jobs?.enabled && isDevelopment) {
345
365
  registerTool(
346
- toolSettings.jobs.run,
366
+ mcpAccessSettings.jobs.run,
347
367
  'Run Job',
348
368
  () => runJobTool(server, req, useVerboseLogs),
349
369
  payload,
@@ -352,9 +372,9 @@ export const getMCPHandler = (
352
372
  }
353
373
 
354
374
  // Experimental - Auth Modification Tools
355
- if (toolSettings.auth?.auth && experimentalTools.auth?.enabled && isDevelopment) {
375
+ if (mcpAccessSettings.auth?.auth && experimentalTools.auth?.enabled && isDevelopment) {
356
376
  registerTool(
357
- toolSettings.auth.auth,
377
+ mcpAccessSettings.auth.auth,
358
378
  'Auth',
359
379
  () => authTool(server, req, useVerboseLogs),
360
380
  payload,
@@ -362,9 +382,9 @@ export const getMCPHandler = (
362
382
  )
363
383
  }
364
384
 
365
- if (toolSettings.auth?.login && experimentalTools.auth?.enabled && isDevelopment) {
385
+ if (mcpAccessSettings.auth?.login && experimentalTools.auth?.enabled && isDevelopment) {
366
386
  registerTool(
367
- toolSettings.auth.login,
387
+ mcpAccessSettings.auth.login,
368
388
  'Login',
369
389
  () => loginTool(server, req, useVerboseLogs),
370
390
  payload,
@@ -372,9 +392,9 @@ export const getMCPHandler = (
372
392
  )
373
393
  }
374
394
 
375
- if (toolSettings.auth?.verify && experimentalTools.auth?.enabled && isDevelopment) {
395
+ if (mcpAccessSettings.auth?.verify && experimentalTools.auth?.enabled && isDevelopment) {
376
396
  registerTool(
377
- toolSettings.auth.verify,
397
+ mcpAccessSettings.auth.verify,
378
398
  'Verify',
379
399
  () => verifyTool(server, req, useVerboseLogs),
380
400
  payload,
@@ -382,9 +402,9 @@ export const getMCPHandler = (
382
402
  )
383
403
  }
384
404
 
385
- if (toolSettings.auth?.resetPassword && experimentalTools.auth?.enabled) {
405
+ if (mcpAccessSettings.auth?.resetPassword && experimentalTools.auth?.enabled) {
386
406
  registerTool(
387
- toolSettings.auth.resetPassword,
407
+ mcpAccessSettings.auth.resetPassword,
388
408
  'Reset Password',
389
409
  () => resetPasswordTool(server, req, useVerboseLogs),
390
410
  payload,
@@ -392,9 +412,9 @@ export const getMCPHandler = (
392
412
  )
393
413
  }
394
414
 
395
- if (toolSettings.auth?.forgotPassword && experimentalTools.auth?.enabled) {
415
+ if (mcpAccessSettings.auth?.forgotPassword && experimentalTools.auth?.enabled) {
396
416
  registerTool(
397
- toolSettings.auth.forgotPassword,
417
+ mcpAccessSettings.auth.forgotPassword,
398
418
  'Forgot Password',
399
419
  () => forgotPasswordTool(server, req, useVerboseLogs),
400
420
  payload,
@@ -402,9 +422,9 @@ export const getMCPHandler = (
402
422
  )
403
423
  }
404
424
 
405
- if (toolSettings.auth?.unlock && experimentalTools.auth?.enabled) {
425
+ if (mcpAccessSettings.auth?.unlock && experimentalTools.auth?.enabled) {
406
426
  registerTool(
407
- toolSettings.auth.unlock,
427
+ mcpAccessSettings.auth.unlock,
408
428
  'Unlock',
409
429
  () => unlockTool(server, req, useVerboseLogs),
410
430
  payload,
@@ -52,6 +52,7 @@ export const createResourceTool = (
52
52
  collection: collectionSlug,
53
53
  // TODO: Move the override to a `beforeChange` hook and extend the payloadAPI context req to include MCP request info.
54
54
  data: collections?.[collectionSlug]?.override?.(parsedData, req) || parsedData,
55
+ overrideAccess: false,
55
56
  user,
56
57
  })
57
58
 
@@ -110,7 +111,7 @@ ${JSON.stringify(result, null, 2)}
110
111
 
111
112
  server.tool(
112
113
  `create${collectionSlug.charAt(0).toUpperCase() + toCamelCase(collectionSlug).slice(1)}`,
113
- `${toolSchemas.createResource.description.trim()}\n\n${collections?.[collectionSlug]?.description || ''}`,
114
+ `${collections?.[collectionSlug]?.description || toolSchemas.createResource.description.trim()}`,
114
115
  convertedFields.shape,
115
116
  async (params: Record<string, unknown>) => {
116
117
  const data = JSON.stringify(params)
@@ -77,6 +77,7 @@ export const deleteResourceTool = (
77
77
  const deleteOptions: Record<string, unknown> = {
78
78
  collection: collectionSlug,
79
79
  depth,
80
+ overrideAccess: false,
80
81
  user,
81
82
  }
82
83
 
@@ -200,7 +201,7 @@ ${JSON.stringify(errors, null, 2)}
200
201
  if (collections?.[collectionSlug]?.enabled) {
201
202
  server.tool(
202
203
  `delete${collectionSlug.charAt(0).toUpperCase() + toCamelCase(collectionSlug).slice(1)}`,
203
- `${toolSchemas.deleteResource.description.trim()}\n\n${collections?.[collectionSlug]?.description || ''}`,
204
+ `${collections?.[collectionSlug]?.description || toolSchemas.deleteResource.description.trim()}`,
204
205
  toolSchemas.deleteResource.parameters.shape,
205
206
  async ({ id, depth, where }) => {
206
207
  return await tool(id, where, depth)
@@ -64,6 +64,7 @@ export const findResourceTool = (
64
64
  const doc = await payload.findByID({
65
65
  id,
66
66
  collection: collectionSlug,
67
+ overrideAccess: false,
67
68
  user,
68
69
  })
69
70
 
@@ -114,6 +115,7 @@ ${JSON.stringify(doc, null, 2)}`,
114
115
  const findOptions: Parameters<typeof payload.find>[0] = {
115
116
  collection: collectionSlug,
116
117
  limit,
118
+ overrideAccess: false,
117
119
  page,
118
120
  user,
119
121
  }
@@ -184,7 +186,7 @@ Page: ${result.page} of ${result.totalPages}
184
186
  if (collections?.[collectionSlug]?.enabled) {
185
187
  server.tool(
186
188
  `find${collectionSlug.charAt(0).toUpperCase() + toCamelCase(collectionSlug).slice(1)}`,
187
- `${toolSchemas.findResources.description.trim()}\n\n${collections?.[collectionSlug]?.description || ''}`,
189
+ `${collections?.[collectionSlug]?.description || toolSchemas.findResources.description.trim()}`,
188
190
  toolSchemas.findResources.parameters.shape,
189
191
  async ({ id, limit, page, sort, where }) => {
190
192
  return await tool(id, limit, page, sort, where)
@@ -114,6 +114,7 @@ export const updateResourceTool = (
114
114
  data: parsedData,
115
115
  depth,
116
116
  draft,
117
+ overrideAccess: false,
117
118
  overrideLock,
118
119
  user,
119
120
  ...(filePath && { filePath }),
@@ -159,8 +160,9 @@ ${JSON.stringify(result, null, 2)}
159
160
  data: parsedData,
160
161
  depth,
161
162
  draft,
162
- overrideAccess: true,
163
+ overrideAccess: false,
163
164
  overrideLock,
165
+ user,
164
166
  where: whereClause,
165
167
  ...(filePath && { filePath }),
166
168
  ...(overwriteExistingFiles && { overwriteExistingFiles }),
@@ -283,7 +285,7 @@ ${JSON.stringify(errors, null, 2)}
283
285
 
284
286
  server.tool(
285
287
  `update${collectionSlug.charAt(0).toUpperCase() + toCamelCase(collectionSlug).slice(1)}`,
286
- `${toolSchemas.updateResource.description.trim()}\n\n${collections?.[collectionSlug]?.description || ''}`,
288
+ `${collections?.[collectionSlug]?.description || toolSchemas.updateResource.description.trim()}`,
287
289
  updateResourceSchema.shape,
288
290
  async (params: Record<string, unknown>) => {
289
291
  const {
@@ -2,7 +2,7 @@ import { z } from 'zod'
2
2
 
3
3
  export const toolSchemas = {
4
4
  findResources: {
5
- description: 'Find documents in a Payload collection using Find or FindByID.',
5
+ description: 'Find documents in a collection by ID or where clause using Find or FindByID.',
6
6
  parameters: z.object({
7
7
  id: z
8
8
  .string()
@@ -39,7 +39,7 @@ export const toolSchemas = {
39
39
  },
40
40
 
41
41
  createResource: {
42
- description: 'Create a document in a Payload collection.',
42
+ description: 'Create a document in a collection.',
43
43
  parameters: z.object({
44
44
  data: z.string().describe('JSON string containing the data for the new document'),
45
45
  draft: z
@@ -51,7 +51,7 @@ export const toolSchemas = {
51
51
  },
52
52
 
53
53
  updateResource: {
54
- description: 'Update documents in a Payload collection by ID or where clause.',
54
+ description: 'Update documents in a collection by ID or where clause.',
55
55
  parameters: z.object({
56
56
  id: z.string().optional().describe('Optional: specific document ID to update'),
57
57
  data: z.string().describe('JSON string containing the data to update'),
@@ -83,7 +83,7 @@ export const toolSchemas = {
83
83
  },
84
84
 
85
85
  deleteResource: {
86
- description: 'Delete documents in a Payload collection by ID or where clause.',
86
+ description: 'Delete documents in a collection by ID or where clause.',
87
87
  parameters: z.object({
88
88
  id: z.string().optional().describe('Optional: specific document ID to delete'),
89
89
  depth: z
@@ -103,7 +103,7 @@ export const toolSchemas = {
103
103
 
104
104
  // Experimental Below This Line
105
105
  createCollection: {
106
- description: 'Creates a new Payload collection with specified fields and configuration.',
106
+ description: 'Creates a new collection with specified fields and configuration.',
107
107
  parameters: z.object({
108
108
  collectionDescription: z
109
109
  .string()
@@ -119,7 +119,7 @@ export const toolSchemas = {
119
119
  },
120
120
 
121
121
  findCollections: {
122
- description: 'Finds and lists Payload collections with optional content and document counts.',
122
+ description: 'Finds and lists collections with optional content and document counts.',
123
123
  parameters: z.object({
124
124
  collectionName: z
125
125
  .string()
@@ -140,7 +140,7 @@ export const toolSchemas = {
140
140
 
141
141
  updateCollection: {
142
142
  description:
143
- 'Updates an existing Payload collection with new fields, modifications, or configuration changes.',
143
+ 'Updates an existing collection with new fields, modifications, or configuration changes.',
144
144
  parameters: z.object({
145
145
  collectionName: z.string().describe('The name of the collection to update'),
146
146
  configUpdates: z.any().optional().describe('Configuration updates (for update_config type)'),
@@ -164,7 +164,7 @@ export const toolSchemas = {
164
164
  },
165
165
 
166
166
  deleteCollection: {
167
- description: 'Deletes a Payload collection and optionally updates the configuration.',
167
+ description: 'Deletes a collection and optionally updates the configuration.',
168
168
  parameters: z.object({
169
169
  collectionName: z.string().describe('The name of the collection to delete'),
170
170
  confirmDeletion: z.boolean().describe('Confirmation flag to prevent accidental deletion'),
@@ -177,7 +177,7 @@ export const toolSchemas = {
177
177
  },
178
178
 
179
179
  findConfig: {
180
- description: 'Reads and displays the current Payload configuration file.',
180
+ description: 'Reads and displays the current configuration file.',
181
181
  parameters: z.object({
182
182
  includeMetadata: z
183
183
  .boolean()
@@ -188,7 +188,7 @@ export const toolSchemas = {
188
188
  },
189
189
 
190
190
  updateConfig: {
191
- description: 'Updates the Payload configuration file with various modifications.',
191
+ description: 'Updates the configuration file with various modifications.',
192
192
  parameters: z.object({
193
193
  adminConfig: z
194
194
  .any()
@@ -302,7 +302,7 @@ export const toolSchemas = {
302
302
  },
303
303
 
304
304
  createJob: {
305
- description: 'Creates a new Payload job (task or workflow) with specified configuration.',
305
+ description: 'Creates a new job (task or workflow) with specified configuration.',
306
306
  parameters: z.object({
307
307
  description: z.string().describe('Description of what the job does'),
308
308
  inputSchema: z.record(z.any()).optional().default({}).describe('Input schema for the job'),
@@ -329,7 +329,7 @@ export const toolSchemas = {
329
329
  },
330
330
 
331
331
  updateJob: {
332
- description: 'Updates an existing Payload job with new configuration, schema, or handler code.',
332
+ description: 'Updates an existing job with new configuration, schema, or handler code.',
333
333
  parameters: z.object({
334
334
  configUpdate: z.record(z.any()).optional().describe('New configuration for the job'),
335
335
  handlerCode: z
@@ -347,7 +347,7 @@ export const toolSchemas = {
347
347
  },
348
348
 
349
349
  runJob: {
350
- description: 'Runs a Payload job with specified input data and queue options.',
350
+ description: 'Runs a job with specified input data and queue options.',
351
351
  parameters: z.object({
352
352
  delay: z
353
353
  .number()
package/src/types.ts CHANGED
@@ -14,7 +14,7 @@ export type PluginMCPServerConfig = {
14
14
  /**
15
15
  * Set the description of the collection. This is used by MCP clients to determine when to use the collecton as a resource.
16
16
  */
17
- description: string
17
+ description?: string
18
18
  /**
19
19
  * Set the enabled capabilities of the collection. Admins can then allow or disallow the use of the capability by MCP clients.
20
20
  */
@@ -26,7 +26,6 @@ export type PluginMCPServerConfig = {
26
26
  update?: boolean
27
27
  }
28
28
  | boolean
29
-
30
29
  /**
31
30
  * Override the data generated by the MCP client. This allows you to modify the data that is sent to the MCP client. This is useful for adding additional data to the response, data normalization, or verifying data.
32
31
  */
@@ -217,6 +216,11 @@ export type PluginMCPServerConfig = {
217
216
  }[]
218
217
  }
219
218
  overrideApiKeyCollection?: (collection: CollectionConfig) => CollectionConfig
219
+
220
+ /**
221
+ * Set the users collection that API keys should be associated with.
222
+ */
223
+ userCollection?: CollectionConfig | string
220
224
  }
221
225
 
222
226
  /**
@@ -267,7 +271,7 @@ export type MCPServerOptions = {
267
271
  }
268
272
  }
269
273
 
270
- export type ToolSettings = {
274
+ export type MCPAccessSettings = {
271
275
  auth?: {
272
276
  auth?: boolean
273
277
  forgotPassword?: boolean
@@ -286,12 +290,14 @@ export type ToolSettings = {
286
290
  find?: boolean
287
291
  update?: boolean
288
292
  }
289
- custom?: Record<string, boolean>
290
293
  jobs?: {
291
294
  create?: boolean
292
295
  run?: boolean
293
296
  update?: boolean
294
297
  }
298
+ 'payload-mcp-prompt'?: Record<string, boolean>
299
+ 'payload-mcp-resource'?: Record<string, boolean>
300
+ 'payload-mcp-tool'?: Record<string, boolean>
295
301
  } & Record<string, unknown>
296
302
 
297
303
  export type FieldDefinition = {