@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.
- package/dist/collections/createApiKeysCollection.d.ts.map +1 -1
- package/dist/collections/createApiKeysCollection.js +25 -0
- package/dist/collections/createApiKeysCollection.js.map +1 -1
- package/dist/endpoints/mcp.d.ts +1 -1
- package/dist/endpoints/mcp.d.ts.map +1 -1
- package/dist/endpoints/mcp.js +14 -61
- package/dist/endpoints/mcp.js.map +1 -1
- package/dist/endpoints/resolveAccessSettings.d.ts +10 -0
- package/dist/endpoints/resolveAccessSettings.d.ts.map +1 -0
- package/dist/endpoints/resolveAccessSettings.js +44 -0
- package/dist/endpoints/resolveAccessSettings.js.map +1 -0
- package/dist/endpoints/withRestoredWebGlobals.d.ts +5 -0
- package/dist/endpoints/withRestoredWebGlobals.d.ts.map +1 -0
- package/dist/endpoints/withRestoredWebGlobals.js +23 -0
- package/dist/endpoints/withRestoredWebGlobals.js.map +1 -0
- package/dist/mcp/getMcpHandler.d.ts +1 -1
- package/dist/mcp/getMcpHandler.d.ts.map +1 -1
- package/dist/mcp/getMcpHandler.js +23 -23
- package/dist/mcp/getMcpHandler.js.map +1 -1
- package/dist/mcp/tools/auth/login.d.ts.map +1 -1
- package/dist/mcp/tools/auth/login.js +4 -5
- package/dist/mcp/tools/auth/login.js.map +1 -1
- package/dist/mcp/tools/global/find.d.ts.map +1 -1
- package/dist/mcp/tools/global/find.js +2 -0
- package/dist/mcp/tools/global/find.js.map +1 -1
- package/dist/mcp/tools/global/update.d.ts.map +1 -1
- package/dist/mcp/tools/global/update.js +2 -0
- package/dist/mcp/tools/global/update.js.map +1 -1
- package/dist/mcp/tools/job/run.d.ts.map +1 -1
- package/dist/mcp/tools/job/run.js +2 -0
- package/dist/mcp/tools/job/run.js.map +1 -1
- package/dist/mcp/tools/resource/update.d.ts.map +1 -1
- package/dist/mcp/tools/resource/update.js +3 -17
- package/dist/mcp/tools/resource/update.js.map +1 -1
- package/dist/mcp/tools/schemas.d.ts +0 -12
- package/dist/mcp/tools/schemas.d.ts.map +1 -1
- package/dist/mcp/tools/schemas.js +1 -5
- package/dist/mcp/tools/schemas.js.map +1 -1
- package/package.json +4 -4
- package/src/collections/createApiKeysCollection.ts +27 -1
- package/src/endpoints/mcp.ts +12 -77
- package/src/endpoints/resolveAccessSettings.ts +74 -0
- package/src/endpoints/withRestoredWebGlobals.ts +19 -0
- package/src/mcp/getMcpHandler.ts +32 -31
- package/src/mcp/tools/auth/login.ts +4 -12
- package/src/mcp/tools/global/find.ts +2 -0
- package/src/mcp/tools/global/update.ts +2 -0
- package/src/mcp/tools/job/run.ts +2 -0
- package/src/mcp/tools/resource/update.ts +0 -16
- 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,
|
|
69
|
-
return await tool(collection, email, password, depth
|
|
60
|
+
async ({ collection, depth, email, password }) => {
|
|
61
|
+
return await tool(collection, email, password, depth)
|
|
70
62
|
},
|
|
71
63
|
)
|
|
72
64
|
}
|
package/src/mcp/tools/job/run.ts
CHANGED
|
@@ -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,
|
package/src/mcp/tools/schemas.ts
CHANGED
|
@@ -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
|
|