@payloadcms/plugin-mcp 3.89.0 → 3.90.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.
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,eAAO,MAAM,QAAQ,WAAY,SAAS,OAAO,cAAc,eAAe,OAAO,SAiEpF,CAAA"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAM7C,eAAO,MAAM,QAAQ,WAAY,SAAS,OAAO,cAAc,eAAe,OAAO,SAiFpF,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { createLocalReq } from 'payload';
1
2
  import { toolSchemas } from '../schemas.js';
2
3
  export const authTool = (server, req, verboseLogs)=>{
3
4
  const tool = async (headers)=>{
@@ -19,9 +20,30 @@ export const authTool = (server, req, verboseLogs)=>{
19
20
  payload.logger.warn(`[payload-mcp] Invalid headers JSON: ${headers}, using empty headers`);
20
21
  }
21
22
  }
23
+ const authReq = await createLocalReq({
24
+ req: {
25
+ headers: authHeaders
26
+ }
27
+ }, payload);
22
28
  const result = await payload.auth({
23
- headers: authHeaders
29
+ headers: authHeaders,
30
+ req: authReq
24
31
  });
32
+ if (result.user) {
33
+ const authenticatedUser = result.user;
34
+ const user = await payload.findByID({
35
+ id: authenticatedUser.id,
36
+ collection: authenticatedUser.collection,
37
+ overrideAccess: false,
38
+ req: authReq
39
+ });
40
+ result.user = {
41
+ ...user,
42
+ _sid: authenticatedUser._sid,
43
+ _strategy: authenticatedUser._strategy,
44
+ collection: authenticatedUser.collection
45
+ };
46
+ }
25
47
  if (verboseLogs) {
26
48
  payload.logger.info('[payload-mcp] Authentication check completed successfully');
27
49
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/mcp/tools/auth/auth.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const authTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {\n const tool = async (headers?: string) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info('[payload-mcp] Checking authentication status')\n }\n\n try {\n // Parse custom headers if provided, otherwise use empty headers\n let authHeaders = new Headers()\n\n if (headers) {\n try {\n const parsedHeaders = JSON.parse(headers)\n authHeaders = new Headers(parsedHeaders)\n if (verboseLogs) {\n payload.logger.info(`[payload-mcp] Using custom headers: ${headers}`)\n }\n } catch (_ignore) {\n payload.logger.warn(`[payload-mcp] Invalid headers JSON: ${headers}, using empty headers`)\n }\n }\n\n const result = await payload.auth({\n headers: authHeaders,\n })\n\n if (verboseLogs) {\n payload.logger.info('[payload-mcp] Authentication check completed successfully')\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `# Authentication Status\\n\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(`[payload-mcp] Error checking authentication: ${errorMessage}`)\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error checking authentication**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'auth',\n {\n description: toolSchemas.auth.description,\n inputSchema: toolSchemas.auth.parameters.shape,\n },\n async ({ headers }) => {\n return await tool(headers)\n },\n )\n}\n"],"names":["toolSchemas","authTool","server","req","verboseLogs","tool","headers","payload","logger","info","authHeaders","Headers","parsedHeaders","JSON","parse","_ignore","warn","result","auth","content","type","text","stringify","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,WAAW,CAACC,QAAmBC,KAAqBC;IAC/D,MAAMC,OAAO,OAAOC;QAClB,MAAMC,UAAUJ,IAAII,OAAO;QAE3B,IAAIH,aAAa;YACfG,QAAQC,MAAM,CAACC,IAAI,CAAC;QACtB;QAEA,IAAI;YACF,gEAAgE;YAChE,IAAIC,cAAc,IAAIC;YAEtB,IAAIL,SAAS;gBACX,IAAI;oBACF,MAAMM,gBAAgBC,KAAKC,KAAK,CAACR;oBACjCI,cAAc,IAAIC,QAAQC;oBAC1B,IAAIR,aAAa;wBACfG,QAAQC,MAAM,CAACC,IAAI,CAAC,CAAC,oCAAoC,EAAEH,SAAS;oBACtE;gBACF,EAAE,OAAOS,SAAS;oBAChBR,QAAQC,MAAM,CAACQ,IAAI,CAAC,CAAC,oCAAoC,EAAEV,QAAQ,qBAAqB,CAAC;gBAC3F;YACF;YAEA,MAAMW,SAAS,MAAMV,QAAQW,IAAI,CAAC;gBAChCZ,SAASI;YACX;YAEA,IAAIN,aAAa;gBACfG,QAAQC,MAAM,CAACC,IAAI,CAAC;YACtB;YAEA,OAAO;gBACLU,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,uCAAuC,EAAER,KAAKS,SAAS,CAACL,QAAQ,QAAQ,CAAC;oBAClF;iBACD;YACH;QACF,EAAE,OAAOM,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9DnB,QAAQC,MAAM,CAACe,KAAK,CAAC,CAAC,6CAA6C,EAAEC,cAAc;YAEnF,OAAO;gBACLL,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,qCAAqC,EAAEG,cAAc;oBAC9D;iBACD;YACH;QACF;IACF;IAEAtB,OAAOyB,YAAY,CACjB,QACA;QACEC,aAAa5B,YAAYkB,IAAI,CAACU,WAAW;QACzCC,aAAa7B,YAAYkB,IAAI,CAACY,UAAU,CAACC,KAAK;IAChD,GACA,OAAO,EAAEzB,OAAO,EAAE;QAChB,OAAO,MAAMD,KAAKC;IACpB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/mcp/tools/auth/auth.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { createLocalReq } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const authTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {\n const tool = async (headers?: string) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info('[payload-mcp] Checking authentication status')\n }\n\n try {\n // Parse custom headers if provided, otherwise use empty headers\n let authHeaders = new Headers()\n\n if (headers) {\n try {\n const parsedHeaders = JSON.parse(headers)\n authHeaders = new Headers(parsedHeaders)\n if (verboseLogs) {\n payload.logger.info(`[payload-mcp] Using custom headers: ${headers}`)\n }\n } catch (_ignore) {\n payload.logger.warn(`[payload-mcp] Invalid headers JSON: ${headers}, using empty headers`)\n }\n }\n\n const authReq = await createLocalReq({ req: { headers: authHeaders } }, payload)\n const result = await payload.auth({ headers: authHeaders, req: authReq })\n\n if (result.user) {\n const authenticatedUser = result.user\n const user = await payload.findByID({\n id: authenticatedUser.id,\n collection: authenticatedUser.collection,\n overrideAccess: false,\n req: authReq,\n })\n\n result.user = {\n ...user,\n _sid: authenticatedUser._sid,\n _strategy: authenticatedUser._strategy,\n collection: authenticatedUser.collection,\n }\n }\n\n if (verboseLogs) {\n payload.logger.info('[payload-mcp] Authentication check completed successfully')\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `# Authentication Status\\n\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(`[payload-mcp] Error checking authentication: ${errorMessage}`)\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error checking authentication**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'auth',\n {\n description: toolSchemas.auth.description,\n inputSchema: toolSchemas.auth.parameters.shape,\n },\n async ({ headers }) => {\n return await tool(headers)\n },\n )\n}\n"],"names":["createLocalReq","toolSchemas","authTool","server","req","verboseLogs","tool","headers","payload","logger","info","authHeaders","Headers","parsedHeaders","JSON","parse","_ignore","warn","authReq","result","auth","user","authenticatedUser","findByID","id","collection","overrideAccess","_sid","_strategy","content","type","text","stringify","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,cAAc,QAAQ,UAAS;AAExC,SAASC,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,WAAW,CAACC,QAAmBC,KAAqBC;IAC/D,MAAMC,OAAO,OAAOC;QAClB,MAAMC,UAAUJ,IAAII,OAAO;QAE3B,IAAIH,aAAa;YACfG,QAAQC,MAAM,CAACC,IAAI,CAAC;QACtB;QAEA,IAAI;YACF,gEAAgE;YAChE,IAAIC,cAAc,IAAIC;YAEtB,IAAIL,SAAS;gBACX,IAAI;oBACF,MAAMM,gBAAgBC,KAAKC,KAAK,CAACR;oBACjCI,cAAc,IAAIC,QAAQC;oBAC1B,IAAIR,aAAa;wBACfG,QAAQC,MAAM,CAACC,IAAI,CAAC,CAAC,oCAAoC,EAAEH,SAAS;oBACtE;gBACF,EAAE,OAAOS,SAAS;oBAChBR,QAAQC,MAAM,CAACQ,IAAI,CAAC,CAAC,oCAAoC,EAAEV,QAAQ,qBAAqB,CAAC;gBAC3F;YACF;YAEA,MAAMW,UAAU,MAAMlB,eAAe;gBAAEI,KAAK;oBAAEG,SAASI;gBAAY;YAAE,GAAGH;YACxE,MAAMW,SAAS,MAAMX,QAAQY,IAAI,CAAC;gBAAEb,SAASI;gBAAaP,KAAKc;YAAQ;YAEvE,IAAIC,OAAOE,IAAI,EAAE;gBACf,MAAMC,oBAAoBH,OAAOE,IAAI;gBACrC,MAAMA,OAAO,MAAMb,QAAQe,QAAQ,CAAC;oBAClCC,IAAIF,kBAAkBE,EAAE;oBACxBC,YAAYH,kBAAkBG,UAAU;oBACxCC,gBAAgB;oBAChBtB,KAAKc;gBACP;gBAEAC,OAAOE,IAAI,GAAG;oBACZ,GAAGA,IAAI;oBACPM,MAAML,kBAAkBK,IAAI;oBAC5BC,WAAWN,kBAAkBM,SAAS;oBACtCH,YAAYH,kBAAkBG,UAAU;gBAC1C;YACF;YAEA,IAAIpB,aAAa;gBACfG,QAAQC,MAAM,CAACC,IAAI,CAAC;YACtB;YAEA,OAAO;gBACLmB,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,uCAAuC,EAAEjB,KAAKkB,SAAS,CAACb,QAAQ,QAAQ,CAAC;oBAClF;iBACD;YACH;QACF,EAAE,OAAOc,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9D5B,QAAQC,MAAM,CAACwB,KAAK,CAAC,CAAC,6CAA6C,EAAEC,cAAc;YAEnF,OAAO;gBACLL,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,qCAAqC,EAAEG,cAAc;oBAC9D;iBACD;YACH;QACF;IACF;IAEA/B,OAAOkC,YAAY,CACjB,QACA;QACEC,aAAarC,YAAYmB,IAAI,CAACkB,WAAW;QACzCC,aAAatC,YAAYmB,IAAI,CAACoB,UAAU,CAACC,KAAK;IAChD,GACA,OAAO,EAAElC,OAAO,EAAE;QAChB,OAAO,MAAMD,KAAKC;IACpB;AAEJ,EAAC"}
@@ -0,0 +1,83 @@
1
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
+ const mocks = vi.hoisted(()=>({
3
+ createLocalReq: vi.fn()
4
+ }));
5
+ vi.mock('payload', ()=>({
6
+ createLocalReq: mocks.createLocalReq
7
+ }));
8
+ import { authTool } from './auth.js';
9
+ describe('authTool', ()=>{
10
+ beforeEach(()=>{
11
+ vi.clearAllMocks();
12
+ });
13
+ it('should omit user fields without read access from authentication status', async ()=>{
14
+ const internalNotes = 'private authentication notes';
15
+ const authenticatedUser = {
16
+ _sid: 'session-id',
17
+ _strategy: 'local-jwt',
18
+ collection: 'users',
19
+ id: 'user-id',
20
+ internalNotes
21
+ };
22
+ const payload = {
23
+ auth: vi.fn(async ({ req })=>{
24
+ req.user = authenticatedUser;
25
+ return {
26
+ user: authenticatedUser
27
+ };
28
+ }),
29
+ findByID: vi.fn(async ({ overrideAccess })=>overrideAccess ? authenticatedUser : {
30
+ email: 'user@example.com',
31
+ id: authenticatedUser.id
32
+ }),
33
+ logger: {
34
+ error: vi.fn(),
35
+ info: vi.fn(),
36
+ warn: vi.fn()
37
+ }
38
+ };
39
+ const authReq = {
40
+ payload
41
+ };
42
+ const req = {
43
+ payload
44
+ };
45
+ let handler;
46
+ const server = {
47
+ registerTool: (_name, _definition, registeredHandler)=>{
48
+ handler = registeredHandler;
49
+ }
50
+ };
51
+ mocks.createLocalReq.mockResolvedValue(authReq);
52
+ authTool(server, req, false);
53
+ if (!handler) {
54
+ throw new Error('Auth tool was not registered');
55
+ }
56
+ const result = await handler({
57
+ headers: JSON.stringify({
58
+ Authorization: 'JWT token'
59
+ })
60
+ });
61
+ const json = result.content[0].text.match(/```json\n([\s\S]*?)\n```/)?.[1];
62
+ expect(json).toBeDefined();
63
+ const authenticationStatus = JSON.parse(json);
64
+ expect(authReq.user).toBe(authenticatedUser);
65
+ expect(payload.findByID).toHaveBeenCalledWith({
66
+ id: authenticatedUser.id,
67
+ collection: authenticatedUser.collection,
68
+ overrideAccess: false,
69
+ req: authReq
70
+ });
71
+ expect(authenticationStatus.user).toMatchObject({
72
+ _sid: authenticatedUser._sid,
73
+ _strategy: authenticatedUser._strategy,
74
+ collection: authenticatedUser.collection,
75
+ email: 'user@example.com',
76
+ id: authenticatedUser.id
77
+ });
78
+ expect(authenticationStatus.user).not.toHaveProperty('internalNotes');
79
+ expect(JSON.stringify(authenticationStatus)).not.toContain(internalNotes);
80
+ });
81
+ });
82
+
83
+ //# sourceMappingURL=auth.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/mcp/tools/auth/auth.spec.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { Payload, PayloadRequest } from 'payload'\n\nimport { beforeEach, describe, expect, it, vi } from 'vitest'\n\nconst mocks = vi.hoisted(() => ({\n createLocalReq: vi.fn(),\n}))\n\nvi.mock('payload', () => ({\n createLocalReq: mocks.createLocalReq,\n}))\n\nimport { authTool } from './auth.js'\n\ntype AuthToolResult = {\n content: Array<{\n text: string\n type: 'text'\n }>\n}\n\ntype AuthToolHandler = (args: { headers?: string }) => Promise<AuthToolResult>\n\ndescribe('authTool', () => {\n beforeEach(() => {\n vi.clearAllMocks()\n })\n\n it('should omit user fields without read access from authentication status', async () => {\n const internalNotes = 'private authentication notes'\n const authenticatedUser = {\n _sid: 'session-id',\n _strategy: 'local-jwt',\n collection: 'users',\n id: 'user-id',\n internalNotes,\n }\n const payload = {\n auth: vi.fn(async ({ req }: { req: PayloadRequest }) => {\n req.user = authenticatedUser\n\n return { user: authenticatedUser }\n }),\n findByID: vi.fn(async ({ overrideAccess }: { overrideAccess: boolean }) =>\n overrideAccess\n ? authenticatedUser\n : { email: 'user@example.com', id: authenticatedUser.id },\n ),\n logger: {\n error: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n },\n } as unknown as Payload\n const authReq = { payload } as PayloadRequest\n const req = { payload } as PayloadRequest\n let handler: AuthToolHandler | undefined\n const server = {\n registerTool: (_name: string, _definition: unknown, registeredHandler: AuthToolHandler) => {\n handler = registeredHandler\n },\n } as unknown as McpServer\n\n mocks.createLocalReq.mockResolvedValue(authReq)\n authTool(server, req, false)\n\n if (!handler) {\n throw new Error('Auth tool was not registered')\n }\n\n const result = await handler({\n headers: JSON.stringify({ Authorization: 'JWT token' }),\n })\n const json = result.content[0]!.text.match(/```json\\n([\\s\\S]*?)\\n```/)?.[1]\n\n expect(json).toBeDefined()\n\n const authenticationStatus = JSON.parse(json!)\n\n expect(authReq.user).toBe(authenticatedUser)\n expect(payload.findByID).toHaveBeenCalledWith({\n id: authenticatedUser.id,\n collection: authenticatedUser.collection,\n overrideAccess: false,\n req: authReq,\n })\n expect(authenticationStatus.user).toMatchObject({\n _sid: authenticatedUser._sid,\n _strategy: authenticatedUser._strategy,\n collection: authenticatedUser.collection,\n email: 'user@example.com',\n id: authenticatedUser.id,\n })\n expect(authenticationStatus.user).not.toHaveProperty('internalNotes')\n expect(JSON.stringify(authenticationStatus)).not.toContain(internalNotes)\n })\n})\n"],"names":["beforeEach","describe","expect","it","vi","mocks","hoisted","createLocalReq","fn","mock","authTool","clearAllMocks","internalNotes","authenticatedUser","_sid","_strategy","collection","id","payload","auth","req","user","findByID","overrideAccess","email","logger","error","info","warn","authReq","handler","server","registerTool","_name","_definition","registeredHandler","mockResolvedValue","Error","result","headers","JSON","stringify","Authorization","json","content","text","match","toBeDefined","authenticationStatus","parse","toBe","toHaveBeenCalledWith","toMatchObject","not","toHaveProperty","toContain"],"mappings":"AAGA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,SAAQ;AAE7D,MAAMC,QAAQD,GAAGE,OAAO,CAAC,IAAO,CAAA;QAC9BC,gBAAgBH,GAAGI,EAAE;IACvB,CAAA;AAEAJ,GAAGK,IAAI,CAAC,WAAW,IAAO,CAAA;QACxBF,gBAAgBF,MAAME,cAAc;IACtC,CAAA;AAEA,SAASG,QAAQ,QAAQ,YAAW;AAWpCT,SAAS,YAAY;IACnBD,WAAW;QACTI,GAAGO,aAAa;IAClB;IAEAR,GAAG,0EAA0E;QAC3E,MAAMS,gBAAgB;QACtB,MAAMC,oBAAoB;YACxBC,MAAM;YACNC,WAAW;YACXC,YAAY;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C;YAC9CtC,MAAMD,kBAAkBC,IAAI;YAC5BC,WAAWF,kBAAkBE,SAAS;YACtCC,YAAYH,kBAAkBG,UAAU;YACxCQ,OAAO;YACPP,IAAIJ,kBAAkBI,EAAE;QAC1B;QACAf,OAAO8C,qBAAqB3B,IAAI,EAAEgC,GAAG,CAACC,cAAc,CAAC;QACrDpD,OAAOsC,KAAKC,SAAS,CAACO,uBAAuBK,GAAG,CAACE,SAAS,CAAC3C;IAC7D;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/auth/forgotPassword.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,eAAO,MAAM,kBAAkB,WACrB,SAAS,OACZ,cAAc,eACN,OAAO,SA6DrB,CAAA"}
1
+ {"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/auth/forgotPassword.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,eAAO,MAAM,kBAAkB,WACrB,SAAS,OACZ,cAAc,eACN,OAAO,SA+DrB,CAAA"}
@@ -1,17 +1,19 @@
1
1
  import { toolSchemas } from '../schemas.js';
2
2
  export const forgotPasswordTool = (server, req, verboseLogs)=>{
3
- const tool = async (collection, email, disableEmail = false)=>{
3
+ const tool = async (collection, email)=>{
4
4
  const payload = req.payload;
5
5
  if (verboseLogs) {
6
6
  payload.logger.info(`[payload-mcp] Sending password reset email for user: ${email} in collection: ${collection}`);
7
7
  }
8
8
  try {
9
- const result = await payload.forgotPassword({
9
+ await payload.forgotPassword({
10
10
  collection,
11
11
  data: {
12
12
  email
13
13
  },
14
- disableEmail
14
+ disableEmail: false,
15
+ overrideAccess: false,
16
+ req
15
17
  });
16
18
  if (verboseLogs) {
17
19
  payload.logger.info(`[payload-mcp] Password reset email sent successfully for user: ${email}`);
@@ -20,7 +22,7 @@ export const forgotPasswordTool = (server, req, verboseLogs)=>{
20
22
  content: [
21
23
  {
22
24
  type: 'text',
23
- text: `# Password Reset Email Sent\n\n**User:** ${email}\n**Collection:** ${collection}\n**Email Disabled:** ${disableEmail}\n\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``
25
+ text: 'If an account matches that email, password reset instructions have been sent.'
24
26
  }
25
27
  ]
26
28
  };
@@ -40,8 +42,8 @@ export const forgotPasswordTool = (server, req, verboseLogs)=>{
40
42
  server.registerTool('forgotPassword', {
41
43
  description: toolSchemas.forgotPassword.description,
42
44
  inputSchema: toolSchemas.forgotPassword.parameters.shape
43
- }, async ({ collection, disableEmail, email })=>{
44
- return await tool(collection, email, disableEmail);
45
+ }, async ({ collection, email })=>{
46
+ return await tool(collection, email);
45
47
  });
46
48
  };
47
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/mcp/tools/auth/forgotPassword.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const forgotPasswordTool = (\n server: McpServer,\n req: PayloadRequest,\n verboseLogs: boolean,\n) => {\n const tool = async (collection: string, email: string, disableEmail: boolean = false) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info(\n `[payload-mcp] Sending password reset email for user: ${email} in collection: ${collection}`,\n )\n }\n\n try {\n const result = await payload.forgotPassword({\n collection,\n data: {\n email,\n },\n disableEmail,\n })\n\n if (verboseLogs) {\n payload.logger.info(\n `[payload-mcp] Password reset email sent successfully for user: ${email}`,\n )\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `# Password Reset Email Sent\\n\\n**User:** ${email}\\n**Collection:** ${collection}\\n**Email Disabled:** ${disableEmail}\\n\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(\n `[payload-mcp] Error sending password reset email for user ${email}: ${errorMessage}`,\n )\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error sending password reset email for user \"${email}\"**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'forgotPassword',\n {\n description: toolSchemas.forgotPassword.description,\n inputSchema: toolSchemas.forgotPassword.parameters.shape,\n },\n async ({ collection, disableEmail, email }) => {\n return await tool(collection, email, disableEmail)\n },\n )\n}\n"],"names":["toolSchemas","forgotPasswordTool","server","req","verboseLogs","tool","collection","email","disableEmail","payload","logger","info","result","forgotPassword","data","content","type","text","JSON","stringify","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,qBAAqB,CAChCC,QACAC,KACAC;IAEA,MAAMC,OAAO,OAAOC,YAAoBC,OAAeC,eAAwB,KAAK;QAClF,MAAMC,UAAUN,IAAIM,OAAO;QAE3B,IAAIL,aAAa;YACfK,QAAQC,MAAM,CAACC,IAAI,CACjB,CAAC,qDAAqD,EAAEJ,MAAM,gBAAgB,EAAED,YAAY;QAEhG;QAEA,IAAI;YACF,MAAMM,SAAS,MAAMH,QAAQI,cAAc,CAAC;gBAC1CP;gBACAQ,MAAM;oBACJP;gBACF;gBACAC;YACF;YAEA,IAAIJ,aAAa;gBACfK,QAAQC,MAAM,CAACC,IAAI,CACjB,CAAC,+DAA+D,EAAEJ,OAAO;YAE7E;YAEA,OAAO;gBACLQ,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,yCAAyC,EAAEV,MAAM,kBAAkB,EAAED,WAAW,sBAAsB,EAAEE,aAAa,gBAAgB,EAAEU,KAAKC,SAAS,CAACP,QAAQ,QAAQ,CAAC;oBAChL;iBACD;YACH;QACF,EAAE,OAAOQ,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9Dd,QAAQC,MAAM,CAACU,KAAK,CAClB,CAAC,0DAA0D,EAAEb,MAAM,EAAE,EAAEc,cAAc;YAGvF,OAAO;gBACLN,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,iDAAiD,EAAEV,MAAM,KAAK,EAAEc,cAAc;oBACvF;iBACD;YACH;QACF;IACF;IAEAnB,OAAOsB,YAAY,CACjB,kBACA;QACEC,aAAazB,YAAYa,cAAc,CAACY,WAAW;QACnDC,aAAa1B,YAAYa,cAAc,CAACc,UAAU,CAACC,KAAK;IAC1D,GACA,OAAO,EAAEtB,UAAU,EAAEE,YAAY,EAAED,KAAK,EAAE;QACxC,OAAO,MAAMF,KAAKC,YAAYC,OAAOC;IACvC;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/mcp/tools/auth/forgotPassword.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const forgotPasswordTool = (\n server: McpServer,\n req: PayloadRequest,\n verboseLogs: boolean,\n) => {\n const tool = async (collection: string, email: string) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info(\n `[payload-mcp] Sending password reset email for user: ${email} in collection: ${collection}`,\n )\n }\n\n try {\n await payload.forgotPassword({\n collection,\n data: {\n email,\n },\n disableEmail: false,\n overrideAccess: false,\n req,\n })\n\n if (verboseLogs) {\n payload.logger.info(\n `[payload-mcp] Password reset email sent successfully for user: ${email}`,\n )\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: 'If an account matches that email, password reset instructions have been sent.',\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(\n `[payload-mcp] Error sending password reset email for user ${email}: ${errorMessage}`,\n )\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error sending password reset email for user \"${email}\"**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'forgotPassword',\n {\n description: toolSchemas.forgotPassword.description,\n inputSchema: toolSchemas.forgotPassword.parameters.shape,\n },\n async ({ collection, email }) => {\n return await tool(collection, email)\n },\n )\n}\n"],"names":["toolSchemas","forgotPasswordTool","server","req","verboseLogs","tool","collection","email","payload","logger","info","forgotPassword","data","disableEmail","overrideAccess","content","type","text","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,qBAAqB,CAChCC,QACAC,KACAC;IAEA,MAAMC,OAAO,OAAOC,YAAoBC;QACtC,MAAMC,UAAUL,IAAIK,OAAO;QAE3B,IAAIJ,aAAa;YACfI,QAAQC,MAAM,CAACC,IAAI,CACjB,CAAC,qDAAqD,EAAEH,MAAM,gBAAgB,EAAED,YAAY;QAEhG;QAEA,IAAI;YACF,MAAME,QAAQG,cAAc,CAAC;gBAC3BL;gBACAM,MAAM;oBACJL;gBACF;gBACAM,cAAc;gBACdC,gBAAgB;gBAChBX;YACF;YAEA,IAAIC,aAAa;gBACfI,QAAQC,MAAM,CAACC,IAAI,CACjB,CAAC,+DAA+D,EAAEH,OAAO;YAE7E;YAEA,OAAO;gBACLQ,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM;oBACR;iBACD;YACH;QACF,EAAE,OAAOC,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9Db,QAAQC,MAAM,CAACS,KAAK,CAClB,CAAC,0DAA0D,EAAEX,MAAM,EAAE,EAAEY,cAAc;YAGvF,OAAO;gBACLJ,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,iDAAiD,EAAEV,MAAM,KAAK,EAAEY,cAAc;oBACvF;iBACD;YACH;QACF;IACF;IAEAjB,OAAOoB,YAAY,CACjB,kBACA;QACEC,aAAavB,YAAYW,cAAc,CAACY,WAAW;QACnDC,aAAaxB,YAAYW,cAAc,CAACc,UAAU,CAACC,KAAK;IAC1D,GACA,OAAO,EAAEpB,UAAU,EAAEC,KAAK,EAAE;QAC1B,OAAO,MAAMF,KAAKC,YAAYC;IAChC;AAEJ,EAAC"}
@@ -12,7 +12,7 @@ export const resetPasswordTool = (server, req, verboseLogs)=>{
12
12
  password,
13
13
  token
14
14
  },
15
- overrideAccess: true
15
+ overrideAccess: false
16
16
  });
17
17
  if (verboseLogs) {
18
18
  payload.logger.info('[payload-mcp] Password reset completed successfully');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/mcp/tools/auth/resetPassword.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const resetPasswordTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {\n const tool = async (collection: string, token: string, password: string) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info(`[payload-mcp] Resetting password for user in collection: ${collection}`)\n }\n\n try {\n const result = await payload.resetPassword({\n collection,\n data: {\n password,\n token,\n },\n overrideAccess: true,\n })\n\n if (verboseLogs) {\n payload.logger.info('[payload-mcp] Password reset completed successfully')\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `# Password Reset Successful\\n\\n**Collection:** ${collection}\\n**Token:** ${token}\\n\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(`[payload-mcp] Error resetting password: ${errorMessage}`)\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error resetting password**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'resetPassword',\n {\n description: toolSchemas.resetPassword.description,\n inputSchema: toolSchemas.resetPassword.parameters.shape,\n },\n async ({ collection, password, token }) => {\n return await tool(collection, token, password)\n },\n )\n}\n"],"names":["toolSchemas","resetPasswordTool","server","req","verboseLogs","tool","collection","token","password","payload","logger","info","result","resetPassword","data","overrideAccess","content","type","text","JSON","stringify","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,oBAAoB,CAACC,QAAmBC,KAAqBC;IACxE,MAAMC,OAAO,OAAOC,YAAoBC,OAAeC;QACrD,MAAMC,UAAUN,IAAIM,OAAO;QAE3B,IAAIL,aAAa;YACfK,QAAQC,MAAM,CAACC,IAAI,CAAC,CAAC,yDAAyD,EAAEL,YAAY;QAC9F;QAEA,IAAI;YACF,MAAMM,SAAS,MAAMH,QAAQI,aAAa,CAAC;gBACzCP;gBACAQ,MAAM;oBACJN;oBACAD;gBACF;gBACAQ,gBAAgB;YAClB;YAEA,IAAIX,aAAa;gBACfK,QAAQC,MAAM,CAACC,IAAI,CAAC;YACtB;YAEA,OAAO;gBACLK,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,+CAA+C,EAAEZ,WAAW,aAAa,EAAEC,MAAM,gBAAgB,EAAEY,KAAKC,SAAS,CAACR,QAAQ,QAAQ,CAAC;oBAC5I;iBACD;YACH;QACF,EAAE,OAAOS,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9Df,QAAQC,MAAM,CAACW,KAAK,CAAC,CAAC,wCAAwC,EAAEC,cAAc;YAE9E,OAAO;gBACLN,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,gCAAgC,EAAEI,cAAc;oBACzD;iBACD;YACH;QACF;IACF;IAEApB,OAAOuB,YAAY,CACjB,iBACA;QACEC,aAAa1B,YAAYa,aAAa,CAACa,WAAW;QAClDC,aAAa3B,YAAYa,aAAa,CAACe,UAAU,CAACC,KAAK;IACzD,GACA,OAAO,EAAEvB,UAAU,EAAEE,QAAQ,EAAED,KAAK,EAAE;QACpC,OAAO,MAAMF,KAAKC,YAAYC,OAAOC;IACvC;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/mcp/tools/auth/resetPassword.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const resetPasswordTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {\n const tool = async (collection: string, token: string, password: string) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info(`[payload-mcp] Resetting password for user in collection: ${collection}`)\n }\n\n try {\n const result = await payload.resetPassword({\n collection,\n data: {\n password,\n token,\n },\n overrideAccess: false,\n })\n\n if (verboseLogs) {\n payload.logger.info('[payload-mcp] Password reset completed successfully')\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `# Password Reset Successful\\n\\n**Collection:** ${collection}\\n**Token:** ${token}\\n\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(`[payload-mcp] Error resetting password: ${errorMessage}`)\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error resetting password**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'resetPassword',\n {\n description: toolSchemas.resetPassword.description,\n inputSchema: toolSchemas.resetPassword.parameters.shape,\n },\n async ({ collection, password, token }) => {\n return await tool(collection, token, password)\n },\n )\n}\n"],"names":["toolSchemas","resetPasswordTool","server","req","verboseLogs","tool","collection","token","password","payload","logger","info","result","resetPassword","data","overrideAccess","content","type","text","JSON","stringify","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,oBAAoB,CAACC,QAAmBC,KAAqBC;IACxE,MAAMC,OAAO,OAAOC,YAAoBC,OAAeC;QACrD,MAAMC,UAAUN,IAAIM,OAAO;QAE3B,IAAIL,aAAa;YACfK,QAAQC,MAAM,CAACC,IAAI,CAAC,CAAC,yDAAyD,EAAEL,YAAY;QAC9F;QAEA,IAAI;YACF,MAAMM,SAAS,MAAMH,QAAQI,aAAa,CAAC;gBACzCP;gBACAQ,MAAM;oBACJN;oBACAD;gBACF;gBACAQ,gBAAgB;YAClB;YAEA,IAAIX,aAAa;gBACfK,QAAQC,MAAM,CAACC,IAAI,CAAC;YACtB;YAEA,OAAO;gBACLK,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,+CAA+C,EAAEZ,WAAW,aAAa,EAAEC,MAAM,gBAAgB,EAAEY,KAAKC,SAAS,CAACR,QAAQ,QAAQ,CAAC;oBAC5I;iBACD;YACH;QACF,EAAE,OAAOS,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9Df,QAAQC,MAAM,CAACW,KAAK,CAAC,CAAC,wCAAwC,EAAEC,cAAc;YAE9E,OAAO;gBACLN,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,gCAAgC,EAAEI,cAAc;oBACzD;iBACD;YACH;QACF;IACF;IAEApB,OAAOuB,YAAY,CACjB,iBACA;QACEC,aAAa1B,YAAYa,aAAa,CAACa,WAAW;QAClDC,aAAa3B,YAAYa,aAAa,CAACe,UAAU,CAACC,KAAK;IACzD,GACA,OAAO,EAAEvB,UAAU,EAAEE,QAAQ,EAAED,KAAK,EAAE;QACpC,OAAO,MAAMF,KAAKC,YAAYC,OAAOC;IACvC;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"unlock.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/auth/unlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,eAAO,MAAM,UAAU,WAAY,SAAS,OAAO,cAAc,eAAe,OAAO,SA0DtF,CAAA"}
1
+ {"version":3,"file":"unlock.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/auth/unlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,eAAO,MAAM,UAAU,WAAY,SAAS,OAAO,cAAc,eAAe,OAAO,SA2DtF,CAAA"}
@@ -11,7 +11,8 @@ export const unlockTool = (server, req, verboseLogs)=>{
11
11
  data: {
12
12
  email
13
13
  },
14
- overrideAccess: true
14
+ overrideAccess: false,
15
+ req
15
16
  });
16
17
  if (verboseLogs) {
17
18
  payload.logger.info(`[payload-mcp] User account unlocked successfully for user: ${email}`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/mcp/tools/auth/unlock.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const unlockTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {\n const tool = async (collection: string, email: string) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info(\n `[payload-mcp] Unlocking user account for user: ${email} in collection: ${collection}`,\n )\n }\n\n try {\n const result = await payload.unlock({\n collection,\n data: {\n email,\n },\n overrideAccess: true,\n })\n\n if (verboseLogs) {\n payload.logger.info(`[payload-mcp] User account unlocked successfully for user: ${email}`)\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `# User Account Unlocked\\n\\n**User:** ${email}\\n**Collection:** ${collection}\\n\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(\n `[payload-mcp] Error unlocking user account for user ${email}: ${errorMessage}`,\n )\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error unlocking user account for user \"${email}\"**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'unlock',\n {\n description: toolSchemas.unlock.description,\n inputSchema: toolSchemas.unlock.parameters.shape,\n },\n async ({ collection, email }) => {\n return await tool(collection, email)\n },\n )\n}\n"],"names":["toolSchemas","unlockTool","server","req","verboseLogs","tool","collection","email","payload","logger","info","result","unlock","data","overrideAccess","content","type","text","JSON","stringify","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,aAAa,CAACC,QAAmBC,KAAqBC;IACjE,MAAMC,OAAO,OAAOC,YAAoBC;QACtC,MAAMC,UAAUL,IAAIK,OAAO;QAE3B,IAAIJ,aAAa;YACfI,QAAQC,MAAM,CAACC,IAAI,CACjB,CAAC,+CAA+C,EAAEH,MAAM,gBAAgB,EAAED,YAAY;QAE1F;QAEA,IAAI;YACF,MAAMK,SAAS,MAAMH,QAAQI,MAAM,CAAC;gBAClCN;gBACAO,MAAM;oBACJN;gBACF;gBACAO,gBAAgB;YAClB;YAEA,IAAIV,aAAa;gBACfI,QAAQC,MAAM,CAACC,IAAI,CAAC,CAAC,2DAA2D,EAAEH,OAAO;YAC3F;YAEA,OAAO;gBACLQ,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,qCAAqC,EAAEV,MAAM,kBAAkB,EAAED,WAAW,gBAAgB,EAAEY,KAAKC,SAAS,CAACR,QAAQ,QAAQ,CAAC;oBACvI;iBACD;YACH;QACF,EAAE,OAAOS,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9Df,QAAQC,MAAM,CAACW,KAAK,CAClB,CAAC,oDAAoD,EAAEb,MAAM,EAAE,EAAEc,cAAc;YAGjF,OAAO;gBACLN,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,2CAA2C,EAAEV,MAAM,KAAK,EAAEc,cAAc;oBACjF;iBACD;YACH;QACF;IACF;IAEAnB,OAAOsB,YAAY,CACjB,UACA;QACEC,aAAazB,YAAYY,MAAM,CAACa,WAAW;QAC3CC,aAAa1B,YAAYY,MAAM,CAACe,UAAU,CAACC,KAAK;IAClD,GACA,OAAO,EAAEtB,UAAU,EAAEC,KAAK,EAAE;QAC1B,OAAO,MAAMF,KAAKC,YAAYC;IAChC;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/mcp/tools/auth/unlock.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { toolSchemas } from '../schemas.js'\n\nexport const unlockTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {\n const tool = async (collection: string, email: string) => {\n const payload = req.payload\n\n if (verboseLogs) {\n payload.logger.info(\n `[payload-mcp] Unlocking user account for user: ${email} in collection: ${collection}`,\n )\n }\n\n try {\n const result = await payload.unlock({\n collection,\n data: {\n email,\n },\n overrideAccess: false,\n req,\n })\n\n if (verboseLogs) {\n payload.logger.info(`[payload-mcp] User account unlocked successfully for user: ${email}`)\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `# User Account Unlocked\\n\\n**User:** ${email}\\n**Collection:** ${collection}\\n\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n payload.logger.error(\n `[payload-mcp] Error unlocking user account for user ${email}: ${errorMessage}`,\n )\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `❌ **Error unlocking user account for user \"${email}\"**: ${errorMessage}`,\n },\n ],\n }\n }\n }\n\n server.registerTool(\n 'unlock',\n {\n description: toolSchemas.unlock.description,\n inputSchema: toolSchemas.unlock.parameters.shape,\n },\n async ({ collection, email }) => {\n return await tool(collection, email)\n },\n )\n}\n"],"names":["toolSchemas","unlockTool","server","req","verboseLogs","tool","collection","email","payload","logger","info","result","unlock","data","overrideAccess","content","type","text","JSON","stringify","error","errorMessage","Error","message","registerTool","description","inputSchema","parameters","shape"],"mappings":"AAGA,SAASA,WAAW,QAAQ,gBAAe;AAE3C,OAAO,MAAMC,aAAa,CAACC,QAAmBC,KAAqBC;IACjE,MAAMC,OAAO,OAAOC,YAAoBC;QACtC,MAAMC,UAAUL,IAAIK,OAAO;QAE3B,IAAIJ,aAAa;YACfI,QAAQC,MAAM,CAACC,IAAI,CACjB,CAAC,+CAA+C,EAAEH,MAAM,gBAAgB,EAAED,YAAY;QAE1F;QAEA,IAAI;YACF,MAAMK,SAAS,MAAMH,QAAQI,MAAM,CAAC;gBAClCN;gBACAO,MAAM;oBACJN;gBACF;gBACAO,gBAAgB;gBAChBX;YACF;YAEA,IAAIC,aAAa;gBACfI,QAAQC,MAAM,CAACC,IAAI,CAAC,CAAC,2DAA2D,EAAEH,OAAO;YAC3F;YAEA,OAAO;gBACLQ,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,qCAAqC,EAAEV,MAAM,kBAAkB,EAAED,WAAW,gBAAgB,EAAEY,KAAKC,SAAS,CAACR,QAAQ,QAAQ,CAAC;oBACvI;iBACD;YACH;QACF,EAAE,OAAOS,OAAO;YACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;YAC9Df,QAAQC,MAAM,CAACW,KAAK,CAClB,CAAC,oDAAoD,EAAEb,MAAM,EAAE,EAAEc,cAAc;YAGjF,OAAO;gBACLN,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAM,CAAC,2CAA2C,EAAEV,MAAM,KAAK,EAAEc,cAAc;oBACjF;iBACD;YACH;QACF;IACF;IAEAnB,OAAOsB,YAAY,CACjB,UACA;QACEC,aAAazB,YAAYY,MAAM,CAACa,WAAW;QAC3CC,aAAa1B,YAAYY,MAAM,CAACe,UAAU,CAACC,KAAK;IAClD,GACA,OAAO,EAAEtB,UAAU,EAAEC,KAAK,EAAE;QAC1B,OAAO,MAAMF,KAAKC,YAAYC;IAChC;AAEJ,EAAC"}
@@ -338,16 +338,13 @@ export declare const toolSchemas: {
338
338
  description: string;
339
339
  parameters: z.ZodObject<{
340
340
  collection: z.ZodString;
341
- disableEmail: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
342
341
  email: z.ZodString;
343
342
  }, "strip", z.ZodTypeAny, {
344
343
  collection: string;
345
344
  email: string;
346
- disableEmail: boolean;
347
345
  }, {
348
346
  collection: string;
349
347
  email: string;
350
- disableEmail?: boolean | undefined;
351
348
  }>;
352
349
  };
353
350
  unlock: {
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqfvB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgfvB,CAAA"}
@@ -181,7 +181,6 @@ export const toolSchemas = {
181
181
  description: 'Sends a password reset email to a user.',
182
182
  parameters: z.object({
183
183
  collection: z.string().describe('The collection containing the user (e.g., "users")'),
184
- disableEmail: z.boolean().optional().default(false).describe('Whether to disable sending the email (for testing)'),
185
184
  email: z.string().email().describe('The user email address')
186
185
  })
187
186
  },
@@ -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 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,GAC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AAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRE,QAAQ,CAAC;YACZ2E,OAAOxF,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 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","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,CAAC;YACZQ,OAAOrB,EACJsB,OAAO,GACPX,QAAQ,GACRE,QAAQ,CACP;YAEJC,gBAAgBd,EACbe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;YACZU,OAAOvB,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GAAG,4BACPC,GAAG,CAAC,KAAK,2BACTC,QAAQ,GACRC,OAAO,CAAC,IACRC,QAAQ,CAAC;YACZG,QAAQhB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;YAEJW,MAAMxB,EACHO,MAAM,GACNC,GA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AsE,QAAQ;QACNhF,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnB+E,OAAOpF,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJE,QAAQ,GACRE,QAAQ,CAAC;YACZwE,OAAOrF,EAAEwE,MAAM,CAACxE,EAAEsC,GAAG,IAAIzB,QAAQ,CAAC;YAClC+D,SAAS5E,EAAEe,MAAM,GAAGF,QAAQ,CAAC;YAC7ByE,UAAUtF,EACPO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRE,QAAQ,CAAC;YACZ0E,OAAOvF,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.89.0",
3
+ "version": "3.90.0",
4
4
  "description": "MCP (Model Context Protocol) capabilities with Payload",
5
5
  "keywords": [
6
6
  "plugin",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@payloadcms/eslint-config": "3.28.0",
48
- "payload": "3.89.0"
48
+ "payload": "3.90.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "payload": "3.89.0"
51
+ "payload": "3.90.0"
52
52
  },
53
53
  "homepage:": "https://payloadcms.com",
54
54
  "scripts": {
@@ -0,0 +1,98 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
2
+ import type { Payload, PayloadRequest } from 'payload'
3
+
4
+ import { beforeEach, describe, expect, it, vi } from 'vitest'
5
+
6
+ const mocks = vi.hoisted(() => ({
7
+ createLocalReq: vi.fn(),
8
+ }))
9
+
10
+ vi.mock('payload', () => ({
11
+ createLocalReq: mocks.createLocalReq,
12
+ }))
13
+
14
+ import { authTool } from './auth.js'
15
+
16
+ type AuthToolResult = {
17
+ content: Array<{
18
+ text: string
19
+ type: 'text'
20
+ }>
21
+ }
22
+
23
+ type AuthToolHandler = (args: { headers?: string }) => Promise<AuthToolResult>
24
+
25
+ describe('authTool', () => {
26
+ beforeEach(() => {
27
+ vi.clearAllMocks()
28
+ })
29
+
30
+ it('should omit user fields without read access from authentication status', async () => {
31
+ const internalNotes = 'private authentication notes'
32
+ const authenticatedUser = {
33
+ _sid: 'session-id',
34
+ _strategy: 'local-jwt',
35
+ collection: 'users',
36
+ id: 'user-id',
37
+ internalNotes,
38
+ }
39
+ const payload = {
40
+ auth: vi.fn(async ({ req }: { req: PayloadRequest }) => {
41
+ req.user = authenticatedUser
42
+
43
+ return { user: authenticatedUser }
44
+ }),
45
+ findByID: vi.fn(async ({ overrideAccess }: { overrideAccess: boolean }) =>
46
+ overrideAccess
47
+ ? authenticatedUser
48
+ : { email: 'user@example.com', id: authenticatedUser.id },
49
+ ),
50
+ logger: {
51
+ error: vi.fn(),
52
+ info: vi.fn(),
53
+ warn: vi.fn(),
54
+ },
55
+ } as unknown as Payload
56
+ const authReq = { payload } as PayloadRequest
57
+ const req = { payload } as PayloadRequest
58
+ let handler: AuthToolHandler | undefined
59
+ const server = {
60
+ registerTool: (_name: string, _definition: unknown, registeredHandler: AuthToolHandler) => {
61
+ handler = registeredHandler
62
+ },
63
+ } as unknown as McpServer
64
+
65
+ mocks.createLocalReq.mockResolvedValue(authReq)
66
+ authTool(server, req, false)
67
+
68
+ if (!handler) {
69
+ throw new Error('Auth tool was not registered')
70
+ }
71
+
72
+ const result = await handler({
73
+ headers: JSON.stringify({ Authorization: 'JWT token' }),
74
+ })
75
+ const json = result.content[0]!.text.match(/```json\n([\s\S]*?)\n```/)?.[1]
76
+
77
+ expect(json).toBeDefined()
78
+
79
+ const authenticationStatus = JSON.parse(json!)
80
+
81
+ expect(authReq.user).toBe(authenticatedUser)
82
+ expect(payload.findByID).toHaveBeenCalledWith({
83
+ id: authenticatedUser.id,
84
+ collection: authenticatedUser.collection,
85
+ overrideAccess: false,
86
+ req: authReq,
87
+ })
88
+ expect(authenticationStatus.user).toMatchObject({
89
+ _sid: authenticatedUser._sid,
90
+ _strategy: authenticatedUser._strategy,
91
+ collection: authenticatedUser.collection,
92
+ email: 'user@example.com',
93
+ id: authenticatedUser.id,
94
+ })
95
+ expect(authenticationStatus.user).not.toHaveProperty('internalNotes')
96
+ expect(JSON.stringify(authenticationStatus)).not.toContain(internalNotes)
97
+ })
98
+ })
@@ -1,6 +1,8 @@
1
1
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
2
2
  import type { PayloadRequest } from 'payload'
3
3
 
4
+ import { createLocalReq } from 'payload'
5
+
4
6
  import { toolSchemas } from '../schemas.js'
5
7
 
6
8
  export const authTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {
@@ -27,9 +29,25 @@ export const authTool = (server: McpServer, req: PayloadRequest, verboseLogs: bo
27
29
  }
28
30
  }
29
31
 
30
- const result = await payload.auth({
31
- headers: authHeaders,
32
- })
32
+ const authReq = await createLocalReq({ req: { headers: authHeaders } }, payload)
33
+ const result = await payload.auth({ headers: authHeaders, req: authReq })
34
+
35
+ if (result.user) {
36
+ const authenticatedUser = result.user
37
+ const user = await payload.findByID({
38
+ id: authenticatedUser.id,
39
+ collection: authenticatedUser.collection,
40
+ overrideAccess: false,
41
+ req: authReq,
42
+ })
43
+
44
+ result.user = {
45
+ ...user,
46
+ _sid: authenticatedUser._sid,
47
+ _strategy: authenticatedUser._strategy,
48
+ collection: authenticatedUser.collection,
49
+ }
50
+ }
33
51
 
34
52
  if (verboseLogs) {
35
53
  payload.logger.info('[payload-mcp] Authentication check completed successfully')
@@ -8,7 +8,7 @@ export const forgotPasswordTool = (
8
8
  req: PayloadRequest,
9
9
  verboseLogs: boolean,
10
10
  ) => {
11
- const tool = async (collection: string, email: string, disableEmail: boolean = false) => {
11
+ const tool = async (collection: string, email: string) => {
12
12
  const payload = req.payload
13
13
 
14
14
  if (verboseLogs) {
@@ -18,12 +18,14 @@ export const forgotPasswordTool = (
18
18
  }
19
19
 
20
20
  try {
21
- const result = await payload.forgotPassword({
21
+ await payload.forgotPassword({
22
22
  collection,
23
23
  data: {
24
24
  email,
25
25
  },
26
- disableEmail,
26
+ disableEmail: false,
27
+ overrideAccess: false,
28
+ req,
27
29
  })
28
30
 
29
31
  if (verboseLogs) {
@@ -36,7 +38,7 @@ export const forgotPasswordTool = (
36
38
  content: [
37
39
  {
38
40
  type: 'text' as const,
39
- text: `# Password Reset Email Sent\n\n**User:** ${email}\n**Collection:** ${collection}\n**Email Disabled:** ${disableEmail}\n\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``,
41
+ text: 'If an account matches that email, password reset instructions have been sent.',
40
42
  },
41
43
  ],
42
44
  }
@@ -63,8 +65,8 @@ export const forgotPasswordTool = (
63
65
  description: toolSchemas.forgotPassword.description,
64
66
  inputSchema: toolSchemas.forgotPassword.parameters.shape,
65
67
  },
66
- async ({ collection, disableEmail, email }) => {
67
- return await tool(collection, email, disableEmail)
68
+ async ({ collection, email }) => {
69
+ return await tool(collection, email)
68
70
  },
69
71
  )
70
72
  }
@@ -18,7 +18,7 @@ export const resetPasswordTool = (server: McpServer, req: PayloadRequest, verbos
18
18
  password,
19
19
  token,
20
20
  },
21
- overrideAccess: true,
21
+ overrideAccess: false,
22
22
  })
23
23
 
24
24
  if (verboseLogs) {
@@ -19,7 +19,8 @@ export const unlockTool = (server: McpServer, req: PayloadRequest, verboseLogs:
19
19
  data: {
20
20
  email,
21
21
  },
22
- overrideAccess: true,
22
+ overrideAccess: false,
23
+ req,
23
24
  })
24
25
 
25
26
  if (verboseLogs) {
@@ -415,11 +415,6 @@ export const toolSchemas = {
415
415
  description: 'Sends a password reset email to a user.',
416
416
  parameters: z.object({
417
417
  collection: z.string().describe('The collection containing the user (e.g., "users")'),
418
- disableEmail: z
419
- .boolean()
420
- .optional()
421
- .default(false)
422
- .describe('Whether to disable sending the email (for testing)'),
423
418
  email: z.string().email().describe('The user email address'),
424
419
  }),
425
420
  },