@payloadcms/plugin-mcp 3.87.1 → 3.89.0-internal.4b0e9b6

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 +3 -3
  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
@@ -4,14 +4,7 @@ import type { PayloadRequest } from 'payload'
4
4
  import { toolSchemas } from '../schemas.js'
5
5
 
6
6
  export const loginTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {
7
- const tool = async (
8
- collection: string,
9
- email: string,
10
- password: string,
11
- depth: number = 0,
12
- overrideAccess: boolean = false,
13
- showHiddenFields: boolean = false,
14
- ) => {
7
+ const tool = async (collection: string, email: string, password: string, depth: number = 0) => {
15
8
  const payload = req.payload
16
9
 
17
10
  if (verboseLogs) {
@@ -28,8 +21,7 @@ export const loginTool = (server: McpServer, req: PayloadRequest, verboseLogs: b
28
21
  password,
29
22
  },
30
23
  depth,
31
- overrideAccess,
32
- showHiddenFields,
24
+ overrideAccess: false,
33
25
  })
34
26
 
35
27
  if (verboseLogs) {
@@ -65,8 +57,8 @@ export const loginTool = (server: McpServer, req: PayloadRequest, verboseLogs: b
65
57
  description: toolSchemas.login.description,
66
58
  inputSchema: toolSchemas.login.parameters.shape,
67
59
  },
68
- async ({ collection, depth, email, overrideAccess, password, showHiddenFields }) => {
69
- return await tool(collection, email, password, depth, overrideAccess, showHiddenFields)
60
+ async ({ collection, depth, email, password }) => {
61
+ return await tool(collection, email, password, depth)
70
62
  },
71
63
  )
72
64
  }
@@ -37,6 +37,8 @@ export const findGlobalTool = (
37
37
  const findOptions: Parameters<typeof payload.findGlobal>[0] = {
38
38
  slug: globalSlug,
39
39
  depth,
40
+ overrideAccess: false,
41
+ req,
40
42
  user,
41
43
  }
42
44
 
@@ -94,6 +94,8 @@ export const updateGlobalTool = (
94
94
  data: parsedData,
95
95
  depth,
96
96
  draft,
97
+ overrideAccess: false,
98
+ req,
97
99
  user,
98
100
  }
99
101
 
@@ -23,6 +23,8 @@ export const runJob = async (
23
23
  // Actually run the job using Payload's job queue
24
24
  const jobQueueOptions: Record<string, unknown> = {
25
25
  input,
26
+ overrideAccess: false,
27
+ req,
26
28
  task: jobSlug,
27
29
  }
28
30
 
@@ -30,8 +30,6 @@ export const updateResourceTool = (
30
30
  draft: boolean = false,
31
31
  depth: number = 0,
32
32
  overrideLock: boolean = true,
33
- filePath?: string,
34
- overwriteExistingFiles: boolean = false,
35
33
  locale?: string,
36
34
  fallbackLocale?: string,
37
35
  select?: string,
@@ -152,8 +150,6 @@ export const updateResourceTool = (
152
150
  overrideLock,
153
151
  req,
154
152
  user,
155
- ...(filePath && { filePath }),
156
- ...(overwriteExistingFiles && { overwriteExistingFiles }),
157
153
  ...(locale && { locale }),
158
154
  ...(fallbackLocale && { fallbackLocale }),
159
155
  ...(selectClause && { select: selectClause }),
@@ -203,8 +199,6 @@ ${JSON.stringify(result)}
203
199
  req,
204
200
  user,
205
201
  where: whereClause,
206
- ...(filePath && { filePath }),
207
- ...(overwriteExistingFiles && { overwriteExistingFiles }),
208
202
  ...(locale && { locale }),
209
203
  ...(fallbackLocale && { fallbackLocale }),
210
204
  ...(selectClause && { select: selectClause }),
@@ -313,7 +307,6 @@ ${JSON.stringify(errors)}
313
307
  .string()
314
308
  .optional()
315
309
  .describe('Optional: fallback locale code to use when requested locale is not available'),
316
- filePath: z.string().optional().describe('File path for file uploads'),
317
310
  locale: z
318
311
  .string()
319
312
  .optional()
@@ -325,11 +318,6 @@ ${JSON.stringify(errors)}
325
318
  .optional()
326
319
  .default(true)
327
320
  .describe('Whether to override document locks'),
328
- overwriteExistingFiles: z
329
- .boolean()
330
- .optional()
331
- .default(false)
332
- .describe('Whether to overwrite existing files'),
333
321
  select: z
334
322
  .string()
335
323
  .optional()
@@ -354,10 +342,8 @@ ${JSON.stringify(errors)}
354
342
  depth,
355
343
  draft,
356
344
  fallbackLocale,
357
- filePath,
358
345
  locale,
359
346
  overrideLock,
360
- overwriteExistingFiles,
361
347
  select,
362
348
  where,
363
349
  ...fieldData
@@ -371,8 +357,6 @@ ${JSON.stringify(errors)}
371
357
  draft as boolean,
372
358
  depth as number,
373
359
  overrideLock as boolean,
374
- filePath as string | undefined,
375
- overwriteExistingFiles as boolean,
376
360
  locale as string | undefined,
377
361
  fallbackLocale as string | undefined,
378
362
  select as string | undefined,
@@ -155,7 +155,6 @@ export const toolSchemas = {
155
155
  .string()
156
156
  .optional()
157
157
  .describe('Optional: fallback locale code to use when requested locale is not available'),
158
- filePath: z.string().optional().describe('Optional: absolute file path for file uploads'),
159
158
  locale: z
160
159
  .string()
161
160
  .optional()
@@ -167,11 +166,6 @@ export const toolSchemas = {
167
166
  .optional()
168
167
  .default(true)
169
168
  .describe('Whether to override document locks'),
170
- overwriteExistingFiles: z
171
- .boolean()
172
- .optional()
173
- .default(false)
174
- .describe('Whether to overwrite existing files'),
175
169
  select: z
176
170
  .string()
177
171
  .optional()
@@ -396,17 +390,7 @@ export const toolSchemas = {
396
390
  .default(0)
397
391
  .describe('Depth of population for relationships'),
398
392
  email: z.string().email().describe('The user email address'),
399
- overrideAccess: z
400
- .boolean()
401
- .optional()
402
- .default(false)
403
- .describe('Whether to override access controls'),
404
393
  password: z.string().describe('The user password'),
405
- showHiddenFields: z
406
- .boolean()
407
- .optional()
408
- .default(false)
409
- .describe('Whether to show hidden fields in the response'),
410
394
  }),
411
395
  },
412
396