@payloadcms/plugin-mcp 4.0.0-internal.a0ef1b8 → 4.0.0-internal.add4c47

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 (250) hide show
  1. package/LICENSE.md +1 -1
  2. package/bin.js +7 -0
  3. package/dist/defaultAccess.d.ts +3 -0
  4. package/dist/defaultAccess.d.ts.map +1 -0
  5. package/dist/defaultAccess.js +3 -0
  6. package/dist/defaultAccess.js.map +1 -0
  7. package/dist/defineTool.d.ts +8 -8
  8. package/dist/defineTool.d.ts.map +1 -1
  9. package/dist/endpoint/access.d.ts +12 -5
  10. package/dist/endpoint/access.d.ts.map +1 -1
  11. package/dist/endpoint/access.js +75 -88
  12. package/dist/endpoint/access.js.map +1 -1
  13. package/dist/endpoint/index.d.ts +1 -1
  14. package/dist/endpoint/index.d.ts.map +1 -1
  15. package/dist/endpoint/index.js +68 -17
  16. package/dist/endpoint/index.js.map +1 -1
  17. package/dist/exports/client.d.ts +1 -1
  18. package/dist/exports/client.d.ts.map +1 -1
  19. package/dist/exports/client.js +1 -1
  20. package/dist/exports/client.js.map +1 -1
  21. package/dist/exports/internal.d.ts +2 -0
  22. package/dist/exports/internal.d.ts.map +1 -0
  23. package/dist/exports/internal.js +3 -0
  24. package/dist/exports/internal.js.map +1 -0
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +15 -20
  28. package/dist/index.js.map +1 -1
  29. package/dist/mcp/buildMcpServer.d.ts +4 -4
  30. package/dist/mcp/buildMcpServer.d.ts.map +1 -1
  31. package/dist/mcp/buildMcpServer.js +133 -80
  32. package/dist/mcp/buildMcpServer.js.map +1 -1
  33. package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -1
  34. package/dist/mcp/builtin/collections/authTools.js +44 -6
  35. package/dist/mcp/builtin/collections/authTools.js.map +1 -1
  36. package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
  37. package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
  38. package/dist/mcp/builtin/collections/countTool.js +68 -0
  39. package/dist/mcp/builtin/collections/countTool.js.map +1 -0
  40. package/dist/mcp/builtin/collections/countVersionsTool.d.ts +2 -0
  41. package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -0
  42. package/dist/mcp/builtin/collections/countVersionsTool.js +64 -0
  43. package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -0
  44. package/dist/mcp/builtin/collections/createTool.d.ts +1 -1
  45. package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -1
  46. package/dist/mcp/builtin/collections/createTool.js +50 -45
  47. package/dist/mcp/builtin/collections/createTool.js.map +1 -1
  48. package/dist/mcp/builtin/collections/deleteTool.d.ts +1 -1
  49. package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -1
  50. package/dist/mcp/builtin/collections/deleteTool.js +15 -22
  51. package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
  52. package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
  53. package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
  54. package/dist/mcp/builtin/collections/duplicateTool.js +96 -0
  55. package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
  56. package/dist/mcp/builtin/collections/fileInput.d.ts +28 -0
  57. package/dist/mcp/builtin/collections/fileInput.d.ts.map +1 -0
  58. package/dist/mcp/builtin/collections/fileInput.js +117 -0
  59. package/dist/mcp/builtin/collections/fileInput.js.map +1 -0
  60. package/dist/mcp/builtin/collections/fileInput.spec.js +86 -0
  61. package/dist/mcp/builtin/collections/fileInput.spec.js.map +1 -0
  62. package/dist/mcp/builtin/collections/findDistinctTool.d.ts +2 -0
  63. package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -0
  64. package/dist/mcp/builtin/collections/findDistinctTool.js +92 -0
  65. package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -0
  66. package/dist/mcp/builtin/collections/findTool.d.ts +1 -1
  67. package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
  68. package/dist/mcp/builtin/collections/findTool.js +52 -47
  69. package/dist/mcp/builtin/collections/findTool.js.map +1 -1
  70. package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts +2 -0
  71. package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -0
  72. package/dist/mcp/builtin/collections/findVersionByIDTool.js +83 -0
  73. package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -0
  74. package/dist/mcp/builtin/collections/findVersionsTool.d.ts +2 -0
  75. package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -0
  76. package/dist/mcp/builtin/collections/findVersionsTool.js +98 -0
  77. package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
  78. package/dist/mcp/builtin/collections/formatCollectionError.d.ts +9 -0
  79. package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -0
  80. package/dist/mcp/builtin/collections/formatCollectionError.js +60 -0
  81. package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -0
  82. package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts +2 -0
  83. package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -0
  84. package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +87 -0
  85. package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -0
  86. package/dist/mcp/builtin/collections/restoreVersionTool.d.ts +2 -0
  87. package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -0
  88. package/dist/mcp/builtin/collections/restoreVersionTool.js +81 -0
  89. package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -0
  90. package/dist/mcp/builtin/collections/updateTool.d.ts +1 -1
  91. package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
  92. package/dist/mcp/builtin/collections/updateTool.js +106 -93
  93. package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
  94. package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts +2 -0
  95. package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts.map +1 -0
  96. package/dist/mcp/builtin/collections/uploadInstructionsTool.js +55 -0
  97. package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -0
  98. package/dist/mcp/builtin/getConfigInfoTool.d.ts +2 -0
  99. package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -0
  100. package/dist/mcp/builtin/getConfigInfoTool.js +68 -0
  101. package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -0
  102. package/dist/mcp/builtin/globals/countVersionsTool.d.ts +2 -0
  103. package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -0
  104. package/dist/mcp/builtin/globals/countVersionsTool.js +64 -0
  105. package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -0
  106. package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
  107. package/dist/mcp/builtin/globals/findTool.js +20 -23
  108. package/dist/mcp/builtin/globals/findTool.js.map +1 -1
  109. package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
  110. package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
  111. package/dist/mcp/builtin/globals/findVersionByIDTool.js +79 -0
  112. package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -0
  113. package/dist/mcp/builtin/globals/findVersionsTool.d.ts +2 -0
  114. package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -0
  115. package/dist/mcp/builtin/globals/findVersionsTool.js +94 -0
  116. package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -0
  117. package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts +2 -0
  118. package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -0
  119. package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +65 -0
  120. package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -0
  121. package/dist/mcp/builtin/globals/restoreVersionTool.d.ts +2 -0
  122. package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -0
  123. package/dist/mcp/builtin/globals/restoreVersionTool.js +77 -0
  124. package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -0
  125. package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
  126. package/dist/mcp/builtin/globals/updateTool.js +33 -42
  127. package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
  128. package/dist/mcp/builtin/validateEntityData.d.ts +14 -0
  129. package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -0
  130. package/dist/mcp/builtin/validateEntityData.js +82 -0
  131. package/dist/mcp/builtin/validateEntityData.js.map +1 -0
  132. package/dist/mcp/builtinTools.d.ts +150 -19
  133. package/dist/mcp/builtinTools.d.ts.map +1 -1
  134. package/dist/mcp/builtinTools.js +125 -20
  135. package/dist/mcp/builtinTools.js.map +1 -1
  136. package/dist/mcp/sanitizeMCPConfig.d.ts +0 -1
  137. package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -1
  138. package/dist/mcp/sanitizeMCPConfig.js +124 -58
  139. package/dist/mcp/sanitizeMCPConfig.js.map +1 -1
  140. package/dist/stdio.d.ts +3 -3
  141. package/dist/stdio.d.ts.map +1 -1
  142. package/dist/stdio.js +84 -46
  143. package/dist/stdio.js.map +1 -1
  144. package/dist/types.d.ts +112 -110
  145. package/dist/types.d.ts.map +1 -1
  146. package/dist/types.js +2 -4
  147. package/dist/types.js.map +1 -1
  148. package/dist/utils/camelCase.d.ts.map +1 -1
  149. package/dist/utils/getPluginConfig.d.ts +1 -1
  150. package/dist/utils/getPluginConfig.js +1 -1
  151. package/dist/utils/getPluginConfig.js.map +1 -1
  152. package/dist/utils/resolveProjectRoot.d.ts.map +1 -1
  153. package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts +28 -0
  154. package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts.map +1 -0
  155. package/dist/utils/schemaConversion/filterFieldsByAccess.js +71 -0
  156. package/dist/utils/schemaConversion/filterFieldsByAccess.js.map +1 -0
  157. package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +13 -0
  158. package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -0
  159. package/dist/utils/schemaConversion/getEntityInputSchema.js +66 -0
  160. package/dist/utils/schemaConversion/getEntityInputSchema.js.map +1 -0
  161. package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +5 -10
  162. package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -1
  163. package/dist/utils/schemaConversion/sanitizeEntitySchema.js +15 -95
  164. package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -1
  165. package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +15 -40
  166. package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -1
  167. package/dist/utils/toStandardSchema.d.ts.map +1 -1
  168. package/dist/utils/whereSchema.d.ts +9 -0
  169. package/dist/utils/whereSchema.d.ts.map +1 -0
  170. package/dist/utils/whereSchema.js +13 -0
  171. package/dist/utils/whereSchema.js.map +1 -0
  172. package/package.json +10 -15
  173. package/src/defaultAccess.ts +3 -0
  174. package/src/endpoint/access.ts +81 -101
  175. package/src/endpoint/index.ts +58 -16
  176. package/src/exports/client.ts +2 -1
  177. package/src/exports/internal.ts +1 -0
  178. package/src/index.ts +12 -20
  179. package/src/mcp/buildMcpServer.ts +170 -115
  180. package/src/mcp/builtin/collections/authTools.ts +45 -9
  181. package/src/mcp/builtin/collections/countTool.ts +73 -0
  182. package/src/mcp/builtin/collections/countVersionsTool.ts +69 -0
  183. package/src/mcp/builtin/collections/createTool.ts +67 -62
  184. package/src/mcp/builtin/collections/deleteTool.ts +20 -18
  185. package/src/mcp/builtin/collections/duplicateTool.ts +134 -0
  186. package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
  187. package/src/mcp/builtin/collections/fileInput.ts +154 -0
  188. package/src/mcp/builtin/collections/findDistinctTool.ts +119 -0
  189. package/src/mcp/builtin/collections/findTool.ts +66 -37
  190. package/src/mcp/builtin/collections/findVersionByIDTool.ts +109 -0
  191. package/src/mcp/builtin/collections/findVersionsTool.ts +154 -0
  192. package/src/mcp/builtin/collections/formatCollectionError.ts +84 -0
  193. package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +80 -0
  194. package/src/mcp/builtin/collections/restoreVersionTool.ts +107 -0
  195. package/src/mcp/builtin/collections/updateTool.ts +132 -115
  196. package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
  197. package/src/mcp/builtin/getConfigInfoTool.ts +67 -0
  198. package/src/mcp/builtin/globals/countVersionsTool.ts +68 -0
  199. package/src/mcp/builtin/globals/findTool.ts +28 -19
  200. package/src/mcp/builtin/globals/findVersionByIDTool.ts +103 -0
  201. package/src/mcp/builtin/globals/findVersionsTool.ts +147 -0
  202. package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +63 -0
  203. package/src/mcp/builtin/globals/restoreVersionTool.ts +99 -0
  204. package/src/mcp/builtin/globals/updateTool.ts +52 -57
  205. package/src/mcp/builtin/validateEntityData.ts +132 -0
  206. package/src/mcp/builtinTools.ts +118 -41
  207. package/src/mcp/sanitizeMCPConfig.ts +120 -78
  208. package/src/stdio.ts +79 -46
  209. package/src/types.ts +128 -115
  210. package/src/utils/getPluginConfig.ts +1 -1
  211. package/src/utils/schemaConversion/filterFieldsByAccess.ts +123 -0
  212. package/src/utils/schemaConversion/getEntityInputSchema.ts +96 -0
  213. package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +12 -19
  214. package/src/utils/schemaConversion/sanitizeEntitySchema.ts +17 -114
  215. package/src/utils/whereSchema.ts +24 -0
  216. package/dist/@types/assets.d.js +0 -2
  217. package/dist/@types/assets.d.js.map +0 -1
  218. package/dist/collection/getAccessField.d.ts +0 -12
  219. package/dist/collection/getAccessField.d.ts.map +0 -1
  220. package/dist/collection/getAccessField.js +0 -57
  221. package/dist/collection/getAccessField.js.map +0 -1
  222. package/dist/collection/index.d.ts +0 -6
  223. package/dist/collection/index.d.ts.map +0 -1
  224. package/dist/collection/index.js +0 -60
  225. package/dist/collection/index.js.map +0 -1
  226. package/dist/components/AccessField/index.client.d.ts +0 -10
  227. package/dist/components/AccessField/index.client.d.ts.map +0 -1
  228. package/dist/components/AccessField/index.client.js +0 -305
  229. package/dist/components/AccessField/index.client.js.map +0 -1
  230. package/dist/components/AccessField/index.css +0 -93
  231. package/dist/utils/localAPIDefaults.d.ts +0 -20
  232. package/dist/utils/localAPIDefaults.d.ts.map +0 -1
  233. package/dist/utils/localAPIDefaults.js +0 -19
  234. package/dist/utils/localAPIDefaults.js.map +0 -1
  235. package/dist/utils/schemaConversion/buildToolInput.d.ts +0 -29
  236. package/dist/utils/schemaConversion/buildToolInput.d.ts.map +0 -1
  237. package/dist/utils/schemaConversion/buildToolInput.js +0 -51
  238. package/dist/utils/schemaConversion/buildToolInput.js.map +0 -1
  239. package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +0 -7
  240. package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +0 -1
  241. package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js +0 -20
  242. package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +0 -1
  243. package/src/@types/assets.d.ts +0 -3
  244. package/src/collection/getAccessField.ts +0 -64
  245. package/src/collection/index.ts +0 -64
  246. package/src/components/AccessField/index.client.tsx +0 -344
  247. package/src/components/AccessField/index.css +0 -93
  248. package/src/utils/localAPIDefaults.ts +0 -22
  249. package/src/utils/schemaConversion/buildToolInput.ts +0 -68
  250. package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
@@ -1,47 +1,121 @@
1
1
  import { authCollectionTool, forgotPasswordCollectionTool, loginCollectionTool, resetPasswordCollectionTool, unlockCollectionTool, verifyCollectionTool } from './builtin/collections/authTools.js';
2
- import { createCollectionTool } from './builtin/collections/createTool.js';
3
- import { deleteCollectionTool } from './builtin/collections/deleteTool.js';
4
- import { findCollectionTool } from './builtin/collections/findTool.js';
5
- import { updateCollectionTool } from './builtin/collections/updateTool.js';
2
+ import { countDocumentsTool } from './builtin/collections/countTool.js';
3
+ import { countVersionsTool } from './builtin/collections/countVersionsTool.js';
4
+ import { createDocumentTool } from './builtin/collections/createTool.js';
5
+ import { deleteDocumentsTool } from './builtin/collections/deleteTool.js';
6
+ import { duplicateDocumentTool } from './builtin/collections/duplicateTool.js';
7
+ import { findDistinctTool } from './builtin/collections/findDistinctTool.js';
8
+ import { findDocumentsTool } from './builtin/collections/findTool.js';
9
+ import { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js';
10
+ import { findVersionsTool } from './builtin/collections/findVersionsTool.js';
11
+ import { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js';
12
+ import { restoreVersionTool } from './builtin/collections/restoreVersionTool.js';
13
+ import { updateDocumentTool } from './builtin/collections/updateTool.js';
14
+ import { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js';
15
+ import { getConfigInfoTool } from './builtin/getConfigInfoTool.js';
16
+ import { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js';
6
17
  import { findGlobalTool } from './builtin/globals/findTool.js';
18
+ import { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js';
19
+ import { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js';
20
+ import { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js';
21
+ import { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js';
7
22
  import { updateGlobalTool } from './builtin/globals/updateTool.js';
23
+ export const TOOL_BUILTINS = {
24
+ getConfigInfo: {
25
+ mcpName: 'getConfigInfo',
26
+ tool: getConfigInfoTool
27
+ }
28
+ };
8
29
  /**
9
30
  * The static built-in collection CRUD tools. Keys here are the source of truth
10
31
  * for `MCPCollectionBuiltinName` — adding/removing an entry updates the type
11
32
  * automatically.
12
33
  */ export const COLLECTION_BUILTINS = {
13
- create: createCollectionTool,
14
- delete: deleteCollectionTool,
15
- find: findCollectionTool,
16
- update: updateCollectionTool
34
+ count: {
35
+ mcpName: 'countDocuments',
36
+ tool: countDocumentsTool
37
+ },
38
+ countVersions: {
39
+ mcpName: 'countVersions',
40
+ requiresVersions: true,
41
+ tool: countVersionsTool
42
+ },
43
+ create: {
44
+ mcpName: 'createDocument',
45
+ tool: createDocumentTool
46
+ },
47
+ delete: {
48
+ mcpName: 'deleteDocuments',
49
+ tool: deleteDocumentsTool
50
+ },
51
+ duplicate: {
52
+ mcpName: 'duplicateDocument',
53
+ requiresDuplicateEnabled: true,
54
+ tool: duplicateDocumentTool
55
+ },
56
+ find: {
57
+ mcpName: 'findDocuments',
58
+ tool: findDocumentsTool
59
+ },
60
+ findDistinct: {
61
+ mcpName: 'findDistinct',
62
+ tool: findDistinctTool
63
+ },
64
+ findVersionByID: {
65
+ mcpName: 'findVersionByID',
66
+ requiresVersions: true,
67
+ tool: findVersionByIDTool
68
+ },
69
+ findVersions: {
70
+ mcpName: 'findVersions',
71
+ requiresVersions: true,
72
+ tool: findVersionsTool
73
+ },
74
+ getCollectionSchema: {
75
+ mcpName: 'getCollectionSchema',
76
+ tool: getCollectionSchemaTool
77
+ },
78
+ getUploadInstructions: {
79
+ mcpName: 'getUploadInstructions',
80
+ requiresUpload: true,
81
+ tool: getUploadInstructionsTool
82
+ },
83
+ restoreVersion: {
84
+ mcpName: 'restoreVersion',
85
+ requiresVersions: true,
86
+ tool: restoreVersionTool
87
+ },
88
+ update: {
89
+ mcpName: 'updateDocument',
90
+ tool: updateDocumentTool
91
+ }
17
92
  };
18
93
  /**
19
- * The static auth tools surfaced under auth-enabled collections. Each entry
20
- * carries the admin-UI label alongside the tool. Keys are the source of truth
21
- * for `MCPCollectionAuthToolName`.
94
+ * The static auth tools surfaced under auth-enabled collections. Keys are the
95
+ * source of truth for `MCPCollectionAuthToolName`.
22
96
  */ export const COLLECTION_AUTH_BUILTINS = {
23
97
  auth: {
24
- label: 'Check Auth Status',
98
+ mcpName: 'auth',
25
99
  tool: authCollectionTool
26
100
  },
27
101
  forgotPassword: {
28
- label: 'Forgot Password',
102
+ mcpName: 'forgotPassword',
29
103
  tool: forgotPasswordCollectionTool
30
104
  },
31
105
  login: {
32
- label: 'User Login',
106
+ mcpName: 'login',
33
107
  tool: loginCollectionTool
34
108
  },
35
109
  resetPassword: {
36
- label: 'Reset Password',
110
+ mcpName: 'resetPassword',
37
111
  tool: resetPasswordCollectionTool
38
112
  },
39
113
  unlock: {
40
- label: 'Unlock Account',
114
+ mcpName: 'unlock',
41
115
  tool: unlockCollectionTool
42
116
  },
43
117
  verify: {
44
- label: 'Email Verification',
118
+ mcpName: 'verify',
45
119
  tool: verifyCollectionTool
46
120
  }
47
121
  };
@@ -49,15 +123,46 @@ import { updateGlobalTool } from './builtin/globals/updateTool.js';
49
123
  * The static built-in global tools. Keys are the source of truth for
50
124
  * `MCPGlobalBuiltinName`.
51
125
  */ export const GLOBAL_BUILTINS = {
52
- find: findGlobalTool,
53
- update: updateGlobalTool
126
+ countGlobalVersions: {
127
+ mcpName: 'countGlobalVersions',
128
+ requiresVersions: true,
129
+ tool: countGlobalVersionsTool
130
+ },
131
+ find: {
132
+ mcpName: 'findGlobal',
133
+ tool: findGlobalTool
134
+ },
135
+ findGlobalVersionByID: {
136
+ mcpName: 'findGlobalVersionByID',
137
+ requiresVersions: true,
138
+ tool: findGlobalVersionByIDTool
139
+ },
140
+ findGlobalVersions: {
141
+ mcpName: 'findGlobalVersions',
142
+ requiresVersions: true,
143
+ tool: findGlobalVersionsTool
144
+ },
145
+ getGlobalSchema: {
146
+ mcpName: 'getGlobalSchema',
147
+ tool: getGlobalSchemaTool
148
+ },
149
+ restoreGlobalVersion: {
150
+ mcpName: 'restoreGlobalVersion',
151
+ requiresVersions: true,
152
+ tool: restoreGlobalVersionTool
153
+ },
154
+ update: {
155
+ mcpName: 'updateGlobal',
156
+ tool: updateGlobalTool
157
+ }
54
158
  };
55
159
  /**
56
160
  * Pre-typed `Object.entries` for each registry. The cast from `string` to the
57
161
  * literal key union lives here once so consumers can iterate without their own
58
162
  * cast — TypeScript's `Object.entries` always widens keys to `string`, which
59
163
  * defeats the narrow type lookups on `MCPCollectionToolsMap`.
60
- */ export const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS);
164
+ */ export const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS);
165
+ export const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS);
61
166
  export const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS);
62
167
  export const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS);
63
168
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/mcp/builtinTools.ts"],"sourcesContent":["import type { CollectionTool, GlobalTool } from '../types.js'\n\nimport {\n authCollectionTool,\n forgotPasswordCollectionTool,\n loginCollectionTool,\n resetPasswordCollectionTool,\n unlockCollectionTool,\n verifyCollectionTool,\n} from './builtin/collections/authTools.js'\nimport { createCollectionTool } from './builtin/collections/createTool.js'\nimport { deleteCollectionTool } from './builtin/collections/deleteTool.js'\nimport { findCollectionTool } from './builtin/collections/findTool.js'\nimport { updateCollectionTool } from './builtin/collections/updateTool.js'\nimport { findGlobalTool } from './builtin/globals/findTool.js'\nimport { updateGlobalTool } from './builtin/globals/updateTool.js'\n\n/**\n * The static built-in collection CRUD tools. Keys here are the source of truth\n * for `MCPCollectionBuiltinName` — adding/removing an entry updates the type\n * automatically.\n */\nexport const COLLECTION_BUILTINS: Record<MCPCollectionBuiltinName, CollectionTool> = {\n create: createCollectionTool,\n delete: deleteCollectionTool,\n find: findCollectionTool,\n update: updateCollectionTool,\n}\n\n/**\n * The static auth tools surfaced under auth-enabled collections. Each entry\n * carries the admin-UI label alongside the tool. Keys are the source of truth\n * for `MCPCollectionAuthToolName`.\n */\nexport const COLLECTION_AUTH_BUILTINS: Record<\n MCPCollectionAuthToolName,\n { label: string; tool: CollectionTool }\n> = {\n auth: { label: 'Check Auth Status', tool: authCollectionTool },\n forgotPassword: { label: 'Forgot Password', tool: forgotPasswordCollectionTool },\n login: { label: 'User Login', tool: loginCollectionTool },\n resetPassword: { label: 'Reset Password', tool: resetPasswordCollectionTool },\n unlock: { label: 'Unlock Account', tool: unlockCollectionTool },\n verify: { label: 'Email Verification', tool: verifyCollectionTool },\n}\n\n/**\n * The static built-in global tools. Keys are the source of truth for\n * `MCPGlobalBuiltinName`.\n */\nexport const GLOBAL_BUILTINS: Record<MCPGlobalBuiltinName, GlobalTool> = {\n find: findGlobalTool,\n update: updateGlobalTool,\n}\n\nexport type MCPCollectionBuiltinName = 'create' | 'delete' | 'find' | 'update'\n\nexport type MCPCollectionAuthToolName =\n | 'auth'\n | 'forgotPassword'\n | 'login'\n | 'resetPassword'\n | 'unlock'\n | 'verify'\n\nexport type MCPGlobalBuiltinName = 'find' | 'update'\n\n/**\n * Pre-typed `Object.entries` for each registry. The cast from `string` to the\n * literal key union lives here once so consumers can iterate without their own\n * cast — TypeScript's `Object.entries` always widens keys to `string`, which\n * defeats the narrow type lookups on `MCPCollectionToolsMap`.\n */\nexport const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS) as Array<\n [MCPCollectionBuiltinName, CollectionTool]\n>\n\nexport const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS) as Array<\n [MCPCollectionAuthToolName, { label: string; tool: CollectionTool }]\n>\n\nexport const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS) as Array<\n [MCPGlobalBuiltinName, GlobalTool]\n>\n"],"names":["authCollectionTool","forgotPasswordCollectionTool","loginCollectionTool","resetPasswordCollectionTool","unlockCollectionTool","verifyCollectionTool","createCollectionTool","deleteCollectionTool","findCollectionTool","updateCollectionTool","findGlobalTool","updateGlobalTool","COLLECTION_BUILTINS","create","delete","find","update","COLLECTION_AUTH_BUILTINS","auth","label","tool","forgotPassword","login","resetPass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p/builtinTools.ts"],"sourcesContent":["import type { CollectionTool, GlobalTool, Tool } from '../types.js'\n\nimport {\n authCollectionTool,\n forgotPasswordCollectionTool,\n loginCollectionTool,\n resetPasswordCollectionTool,\n unlockCollectionTool,\n verifyCollectionTool,\n} from './builtin/collections/authTools.js'\nimport { countDocumentsTool } from './builtin/collections/countTool.js'\nimport { countVersionsTool } from './builtin/collections/countVersionsTool.js'\nimport { createDocumentTool } from './builtin/collections/createTool.js'\nimport { deleteDocumentsTool } from './builtin/collections/deleteTool.js'\nimport { duplicateDocumentTool } from './builtin/collections/duplicateTool.js'\nimport { findDistinctTool } from './builtin/collections/findDistinctTool.js'\nimport { findDocumentsTool } from './builtin/collections/findTool.js'\nimport { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js'\nimport { findVersionsTool } from './builtin/collections/findVersionsTool.js'\nimport { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js'\nimport { restoreVersionTool } from './builtin/collections/restoreVersionTool.js'\nimport { updateDocumentTool } from './builtin/collections/updateTool.js'\nimport { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js'\nimport { getConfigInfoTool } from './builtin/getConfigInfoTool.js'\nimport { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js'\nimport { findGlobalTool } from './builtin/globals/findTool.js'\nimport { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js'\nimport { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js'\nimport { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js'\nimport { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js'\nimport { updateGlobalTool } from './builtin/globals/updateTool.js'\n\ntype CollectionBuiltin = {\n mcpName: string\n requiresDuplicateEnabled?: boolean\n requiresUpload?: boolean\n requiresVersions?: boolean\n tool: CollectionTool\n}\n\ntype GlobalBuiltin = {\n mcpName: string\n requiresVersions?: boolean\n tool: GlobalTool\n}\n\nexport const TOOL_BUILTINS = {\n getConfigInfo: { mcpName: 'getConfigInfo', tool: getConfigInfoTool },\n} satisfies Record<string, { mcpName: string; tool: Tool }>\n\n/**\n * The static built-in collection CRUD tools. Keys here are the source of truth\n * for `MCPCollectionBuiltinName` — adding/removing an entry updates the type\n * automatically.\n */\nexport const COLLECTION_BUILTINS = {\n count: { mcpName: 'countDocuments', tool: countDocumentsTool },\n countVersions: { mcpName: 'countVersions', requiresVersions: true, tool: countVersionsTool },\n create: { mcpName: 'createDocument', tool: createDocumentTool },\n delete: { mcpName: 'deleteDocuments', tool: deleteDocumentsTool },\n duplicate: {\n mcpName: 'duplicateDocument',\n requiresDuplicateEnabled: true,\n tool: duplicateDocumentTool,\n },\n find: { mcpName: 'findDocuments', tool: findDocumentsTool },\n findDistinct: { mcpName: 'findDistinct', tool: findDistinctTool },\n findVersionByID: {\n mcpName: 'findVersionByID',\n requiresVersions: true,\n tool: findVersionByIDTool,\n },\n findVersions: { mcpName: 'findVersions', requiresVersions: true, tool: findVersionsTool },\n getCollectionSchema: { mcpName: 'getCollectionSchema', tool: getCollectionSchemaTool },\n getUploadInstructions: {\n mcpName: 'getUploadInstructions',\n requiresUpload: true,\n tool: getUploadInstructionsTool,\n },\n restoreVersion: { mcpName: 'restoreVersion', requiresVersions: true, tool: restoreVersionTool },\n update: { mcpName: 'updateDocument', tool: updateDocumentTool },\n} satisfies Record<string, CollectionBuiltin>\n\n/**\n * The static auth tools surfaced under auth-enabled collections. Keys are the\n * source of truth for `MCPCollectionAuthToolName`.\n */\nexport const COLLECTION_AUTH_BUILTINS = {\n auth: { mcpName: 'auth', tool: authCollectionTool },\n forgotPassword: {\n mcpName: 'forgotPassword',\n tool: forgotPasswordCollectionTool,\n },\n login: { mcpName: 'login', tool: loginCollectionTool },\n resetPassword: {\n mcpName: 'resetPassword',\n tool: resetPasswordCollectionTool,\n },\n unlock: { mcpName: 'unlock', tool: unlockCollectionTool },\n verify: { mcpName: 'verify', tool: verifyCollectionTool },\n} satisfies Record<string, { mcpName: string; tool: CollectionTool }>\n\n/**\n * The static built-in global tools. Keys are the source of truth for\n * `MCPGlobalBuiltinName`.\n */\nexport const GLOBAL_BUILTINS = {\n countGlobalVersions: {\n mcpName: 'countGlobalVersions',\n requiresVersions: true,\n tool: countGlobalVersionsTool,\n },\n find: { mcpName: 'findGlobal', tool: findGlobalTool },\n findGlobalVersionByID: {\n mcpName: 'findGlobalVersionByID',\n requiresVersions: true,\n tool: findGlobalVersionByIDTool,\n },\n findGlobalVersions: {\n mcpName: 'findGlobalVersions',\n requiresVersions: true,\n tool: findGlobalVersionsTool,\n },\n getGlobalSchema: { mcpName: 'getGlobalSchema', tool: getGlobalSchemaTool },\n restoreGlobalVersion: {\n mcpName: 'restoreGlobalVersion',\n requiresVersions: true,\n tool: restoreGlobalVersionTool,\n },\n update: { mcpName: 'updateGlobal', tool: updateGlobalTool },\n} satisfies Record<string, GlobalBuiltin>\n\nexport type MCPCollectionBuiltinName = keyof typeof COLLECTION_BUILTINS\n\nexport type MCPCollectionAuthToolName = keyof typeof COLLECTION_AUTH_BUILTINS\n\nexport type MCPGlobalBuiltinName = keyof typeof GLOBAL_BUILTINS\n\nexport type MCPTopLevelBuiltinName = keyof typeof TOOL_BUILTINS\n\n/**\n * Pre-typed `Object.entries` for each registry. The cast from `string` to the\n * literal key union lives here once so consumers can iterate without their own\n * cast — TypeScript's `Object.entries` always widens keys to `string`, which\n * defeats the narrow type lookups on `MCPCollectionToolsMap`.\n */\nexport const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS) as Array<\n [MCPTopLevelBuiltinName, (typeof TOOL_BUILTINS)[MCPTopLevelBuiltinName]]\n>\n\nexport const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS) as Array<\n [MCPCollectionBuiltinName, CollectionBuiltin]\n>\n\nexport const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS) as Array<\n [MCPCollectionAuthToolName, (typeof COLLECTION_AUTH_BUILTINS)[MCPCollectionAuthToolName]]\n>\n\nexport const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS) as Array<\n [MCPGlobalBuiltinName, GlobalBuiltin]\n>\n"],"names":["authCollectionTool","forgotPasswordCollectionTool","loginCollectionTool","resetPasswordCollectionTool","unlockCollectionTool","verifyCollectionTool","countDocumentsTool","countVersionsTool","createDocumentTool","deleteDocumentsTool","duplicateDocumentTool","findDistinctTool","findDocumentsTool","findVersionByIDTool","findVersionsTool","getCollectionSchemaTool","restoreVersionTool","updateDocumentTool","getUploadInstructionsTool","getConfigInfoTool","countGlobalVersionsTool","findGlobalTool","findGlobalVersionByIDTool","findGlobalVersionsTool","getGlobalSchemaTool","restoreGlobalVersionTool","updateGlobalTool","TOOL_BUILTINS","getConfigInfo","mcpName","tool","COLLECTION_BUILTINS","count","countVersions","requiresVersions","create","delete","duplicate","requiresDuplicateEnabled","find","findDistinct","findVersionByID","findVersions","getCollectionSchema","getUploadInstructions","requiresUpload","restoreVersion","update","COLLECTION_AUTH_BUILTINS","auth","forgotPassword","login","resetPassword","unlock","verify","GLOBAL_BUILTINS","countGlobalVersions","findGlobalVersionByID","findGlobalVersions","getGlobalSchema","restoreGlobalVersion","TOOL_BUILTIN_ENTRIES","Object","entries","COLLECTION_BUILTIN_ENTRIES","COLLECTION_AUTH_BUILTIN_ENTRIES","GLOBAL_BUILTIN_ENTRIES"],"mappings":"AAEA,SACEA,kBAAkB,EAClBC,4BAA4B,EAC5BC,mBAAmB,EACnBC,2BAA2B,EAC3BC,oBAAoB,EACpBC,oBAAoB,QACf,qCAAoC;AAC3C,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,iBAAiB,QAAQ,6CAA4C;AAC9E,SAASC,kBAAkB,QAAQ,sCAAqC;AACxE,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,qBAAqB,QAAQ,yCAAwC;AAC9E,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,iBAAiB,Q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,OAAO,MAAMkB,yBAAyBJ,OAAOC,OAAO,CAACR,iBAEpD"}
@@ -5,7 +5,6 @@ import type { MCPPluginConfig, SanitizedMCPPluginConfig } from '../types.js';
5
5
  * - Flattens `tools` / `prompts` / `resources` / per-collection / per-global
6
6
  * tool maps into a single `items` array.
7
7
  * - Applies built-in tools for collections and globals, respecting opt-out user overrides.
8
- * - Applies the `userCollection` default
9
8
  *
10
9
  * Called once during plugin init. After that, `plugins['@payloadcms/plugin-mcp']
11
10
  * ?.options` holds the sanitized result
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizeMCPConfig.d.ts","sourceRoot":"","sources":["../../src/mcp/sanitizeMCPConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,MAAM,EAGN,eAAe,EAEhB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAMV,eAAe,EAEf,wBAAwB,EACzB,MAAM,aAAa,CAAA;AAWpB;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,2BAG/B;IACD,MAAM,EAAE,MAAM,GAAG,eAAe,CAAA;IAChC,YAAY,EAAE,eAAe,CAAA;CAC9B,KAAG,wBAkDH,CAAA"}
1
+ {"version":3,"file":"sanitizeMCPConfig.d.ts","sourceRoot":"","sources":["../../src/mcp/sanitizeMCPConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,MAAM,EAGN,eAAe,EAEhB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAMV,eAAe,EACf,wBAAwB,EACzB,MAAM,aAAa,CAAA;AAcpB;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,8BAG3B;IACD,MAAM,EAAE,MAAM,GAAG,eAAe,CAAA;IAChC,YAAY,EAAE,eAAe,CAAA;CAC9B,KAAG,wBA6DH,CAAA"}
@@ -1,10 +1,10 @@
1
- import { COLLECTION_AUTH_BUILTIN_ENTRIES, COLLECTION_AUTH_BUILTINS, COLLECTION_BUILTIN_ENTRIES, COLLECTION_BUILTINS, GLOBAL_BUILTIN_ENTRIES, GLOBAL_BUILTINS } from './builtinTools.js';
1
+ import { defaultAccess } from '../defaultAccess.js';
2
+ import { COLLECTION_AUTH_BUILTIN_ENTRIES, COLLECTION_AUTH_BUILTINS, COLLECTION_BUILTIN_ENTRIES, COLLECTION_BUILTINS, GLOBAL_BUILTIN_ENTRIES, GLOBAL_BUILTINS, TOOL_BUILTIN_ENTRIES, TOOL_BUILTINS } from './builtinTools.js';
2
3
  /**
3
4
  * Converts the user-configured `MCPPluginConfig` into a `SanitizedMCPPluginConfig`:
4
5
  * - Flattens `tools` / `prompts` / `resources` / per-collection / per-global
5
6
  * tool maps into a single `items` array.
6
7
  * - Applies built-in tools for collections and globals, respecting opt-out user overrides.
7
- * - Applies the `userCollection` default
8
8
  *
9
9
  * Called once during plugin init. After that, `plugins['@payloadcms/plugin-mcp']
10
10
  * ?.options` holds the sanitized result
@@ -22,83 +22,140 @@ import { COLLECTION_AUTH_BUILTIN_ENTRIES, COLLECTION_AUTH_BUILTINS, COLLECTION_B
22
22
  pluginConfig
23
23
  }));
24
24
  }
25
- for (const [key, tool] of Object.entries(pluginConfig.tools ?? {})){
25
+ for (const [configKey, { mcpName, tool }] of TOOL_BUILTIN_ENTRIES){
26
26
  items.push({
27
27
  type: 'tool',
28
- key,
29
- label: key,
30
- tool
28
+ configKey,
29
+ label: tool.annotations?.title ?? configKey,
30
+ mcpName,
31
+ tool: {
32
+ ...tool,
33
+ access: tool.access ?? defaultAccess
34
+ }
35
+ });
36
+ }
37
+ for (const [configKey, tool] of Object.entries(pluginConfig.tools ?? {})){
38
+ if (configKey in TOOL_BUILTINS) {
39
+ continue;
40
+ }
41
+ items.push({
42
+ type: 'tool',
43
+ configKey,
44
+ label: tool.annotations?.title ?? configKey,
45
+ mcpName: configKey,
46
+ tool: {
47
+ ...tool,
48
+ access: tool.access ?? defaultAccess
49
+ }
31
50
  });
32
51
  }
33
- for (const [key, prompt] of Object.entries(pluginConfig.prompts ?? {})){
52
+ for (const [configKey, prompt] of Object.entries(pluginConfig.prompts ?? {})){
34
53
  items.push({
35
54
  type: 'prompt',
36
- key,
37
- label: prompt.title ?? key,
38
- prompt
55
+ configKey,
56
+ label: prompt.title ?? configKey,
57
+ mcpName: configKey,
58
+ prompt: {
59
+ ...prompt,
60
+ access: prompt.access ?? defaultAccess
61
+ }
39
62
  });
40
63
  }
41
- for (const [key, resource] of Object.entries(pluginConfig.resources ?? {})){
64
+ for (const [configKey, resource] of Object.entries(pluginConfig.resources ?? {})){
42
65
  items.push({
43
66
  type: 'resource',
44
- key,
45
- label: resource.title ?? key,
46
- resource
67
+ configKey,
68
+ label: resource.title ?? configKey,
69
+ mcpName: configKey,
70
+ resource: {
71
+ ...resource,
72
+ access: resource.access ?? defaultAccess
73
+ }
47
74
  });
48
75
  }
49
- // Mirror Payload's own admin.user detection (sanitize.ts) since plugins run first.
50
- const firstCollectionWithAuth = config.collections.find(({ auth })=>Boolean(auth));
51
76
  return {
52
77
  disabled: pluginConfig.disabled,
78
+ hooks: pluginConfig.hooks,
53
79
  items,
54
80
  mcp: pluginConfig.mcp,
55
- overrideApiKeyCollection: pluginConfig.overrideApiKeyCollection,
56
- overrideAuth: pluginConfig.overrideAuth,
57
- userCollection: pluginConfig.userCollection ?? config.admin?.user ?? firstCollectionWithAuth?.slug ?? 'users'
81
+ overrideGetAuthorizedMCP: pluginConfig.overrideGetAuthorizedMCP
58
82
  };
59
83
  };
60
84
  const sanitizeCollectionConfig = ({ collection, pluginConfig })=>{
61
- if (collection.slug === 'payload-mcp-api-keys') {
62
- return [];
63
- }
64
85
  const slug = collection.slug;
65
86
  const collectionPluginConfig = pluginConfig.collections?.[slug];
66
87
  const items = [];
67
- for (const [toolKey, tool] of COLLECTION_BUILTIN_ENTRIES){
88
+ /**
89
+ * Payload disables duplicate for auth collections by default unless the
90
+ * collection explicitly opts back in with `disableDuplicate: false`.
91
+ */ const isDuplicateDisabled = collection.disableDuplicate === true || Boolean(collection.auth) && collection.disableDuplicate !== false;
92
+ for (const [toolKey, { mcpName, requiresDuplicateEnabled, requiresUpload, requiresVersions, tool }] of COLLECTION_BUILTIN_ENTRIES){
93
+ if (requiresVersions && !collection.versions) {
94
+ continue;
95
+ }
96
+ if (requiresDuplicateEnabled && isDuplicateDisabled) {
97
+ continue;
98
+ }
99
+ if (requiresUpload && !collection.upload) {
100
+ continue;
101
+ }
68
102
  const matchedConfigEntry = collectionPluginConfig?.tools?.[toolKey];
69
103
  if (matchedConfigEntry === false) {
70
104
  continue;
71
105
  }
106
+ const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined;
107
+ const annotations = {
108
+ ...tool.annotations,
109
+ ...override?.annotations
110
+ };
72
111
  items.push({
73
112
  type: 'collectionTool',
74
113
  collectionSlug: slug,
75
- key: toolKey,
76
- label: capitalize(toolKey),
77
- tool: overrideBuiltinTool(tool, matchedConfigEntry, collectionPluginConfig)
114
+ configKey: toolKey,
115
+ label: annotations.title ?? toolKey,
116
+ mcpName,
117
+ tool: {
118
+ ...tool,
119
+ access: override?.access ?? tool.access ?? defaultAccess,
120
+ annotations,
121
+ description: override?.description ?? tool.description,
122
+ overrideResponse: override?.overrideResponse ?? collectionPluginConfig?.overrideResponse ?? tool.overrideResponse
123
+ }
78
124
  });
79
125
  }
80
126
  if (collection.auth) {
81
- for (const [authToolKey, { label, tool }] of COLLECTION_AUTH_BUILTIN_ENTRIES){
127
+ for (const [authToolKey, { mcpName, tool }] of COLLECTION_AUTH_BUILTIN_ENTRIES){
82
128
  const matchedConfigEntry = collectionPluginConfig?.tools?.[authToolKey];
83
129
  if (!matchedConfigEntry) {
84
130
  continue;
85
131
  }
86
132
  // `true` means "enable, no override"; only the object form carries fields.
87
133
  const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined;
134
+ const annotations = {
135
+ ...tool.annotations,
136
+ ...override?.annotations
137
+ };
88
138
  items.push({
89
139
  type: 'collectionTool',
90
140
  collectionSlug: slug,
91
- key: authToolKey,
92
- label,
93
- tool: overrideBuiltinTool(tool, override, collectionPluginConfig)
141
+ configKey: authToolKey,
142
+ label: annotations.title ?? authToolKey,
143
+ mcpName,
144
+ tool: {
145
+ ...tool,
146
+ access: override?.access ?? tool.access ?? defaultAccess,
147
+ annotations,
148
+ description: override?.description ?? tool.description,
149
+ overrideResponse: override?.overrideResponse ?? collectionPluginConfig?.overrideResponse ?? tool.overrideResponse
150
+ }
94
151
  });
95
152
  }
96
153
  }
97
154
  // Cast: builtin keys are filtered out below, so the remaining values are
98
155
  // always custom tools (`CollectionTool`) or undefined
99
156
  const customEntries = Object.entries(collectionPluginConfig?.tools ?? {});
100
- for (const [key, customTool] of customEntries){
101
- if (key in COLLECTION_BUILTINS || key in COLLECTION_AUTH_BUILTINS) {
157
+ for (const [configKey, customTool] of customEntries){
158
+ if (configKey in COLLECTION_BUILTINS || configKey in COLLECTION_AUTH_BUILTINS) {
102
159
  continue;
103
160
  }
104
161
  if (!customTool) {
@@ -107,9 +164,13 @@ const sanitizeCollectionConfig = ({ collection, pluginConfig })=>{
107
164
  items.push({
108
165
  type: 'collectionTool',
109
166
  collectionSlug: slug,
110
- key,
111
- label: key,
112
- tool: customTool
167
+ configKey,
168
+ label: customTool.annotations?.title ?? configKey,
169
+ mcpName: configKey,
170
+ tool: {
171
+ ...customTool,
172
+ access: customTool.access ?? defaultAccess
173
+ }
113
174
  });
114
175
  }
115
176
  return items;
@@ -118,22 +179,37 @@ const sanitizeGlobalConfig = ({ global, pluginConfig })=>{
118
179
  const slug = global.slug;
119
180
  const globalPluginConfig = pluginConfig.globals?.[slug];
120
181
  const items = [];
121
- for (const [toolKey, baseTool] of GLOBAL_BUILTIN_ENTRIES){
182
+ for (const [toolKey, { mcpName, requiresVersions, tool }] of GLOBAL_BUILTIN_ENTRIES){
183
+ if (requiresVersions && !global.versions) {
184
+ continue;
185
+ }
122
186
  const matchedConfigEntry = globalPluginConfig?.tools?.[toolKey];
123
187
  if (matchedConfigEntry === false) {
124
188
  continue;
125
189
  }
190
+ const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined;
191
+ const annotations = {
192
+ ...tool.annotations,
193
+ ...override?.annotations
194
+ };
126
195
  items.push({
127
196
  type: 'globalTool',
197
+ configKey: toolKey,
128
198
  globalSlug: slug,
129
- key: toolKey,
130
- label: capitalize(toolKey),
131
- tool: overrideBuiltinTool(baseTool, matchedConfigEntry, globalPluginConfig)
199
+ label: annotations.title ?? toolKey,
200
+ mcpName,
201
+ tool: {
202
+ ...tool,
203
+ access: override?.access ?? tool.access ?? defaultAccess,
204
+ annotations,
205
+ description: override?.description ?? tool.description,
206
+ overrideResponse: override?.overrideResponse ?? globalPluginConfig?.overrideResponse ?? tool.overrideResponse
207
+ }
132
208
  });
133
209
  }
134
210
  const customEntries = Object.entries(globalPluginConfig?.tools ?? {});
135
- for (const [key, customTool] of customEntries){
136
- if (key in GLOBAL_BUILTINS) {
211
+ for (const [configKey, customTool] of customEntries){
212
+ if (configKey in GLOBAL_BUILTINS) {
137
213
  continue;
138
214
  }
139
215
  if (!customTool) {
@@ -141,27 +217,17 @@ const sanitizeGlobalConfig = ({ global, pluginConfig })=>{
141
217
  }
142
218
  items.push({
143
219
  type: 'globalTool',
220
+ configKey,
144
221
  globalSlug: slug,
145
- key,
146
- label: key,
147
- tool: customTool
222
+ label: customTool.annotations?.title ?? configKey,
223
+ mcpName: configKey,
224
+ tool: {
225
+ ...customTool,
226
+ access: customTool.access ?? defaultAccess
227
+ }
148
228
  });
149
229
  }
150
230
  return items;
151
231
  };
152
- const capitalize = (s)=>s.charAt(0).toUpperCase() + s.slice(1);
153
- /**
154
- * Spread the static built-in tool and apply consumer-side overrides.
155
- * Precedence: per-tool override > scope-level (collection/global) override >
156
- * the static tool's defaults. `toolEntry` is whatever the user put under
157
- * `tools: { find: ... }` — could be `true`, `false`, or an override object —
158
- * so it's narrowed internally.
159
- */ const overrideBuiltinTool = (tool, toolOverride, entityPluginConfig)=>{
160
- return {
161
- ...tool,
162
- description: toolOverride?.description ?? entityPluginConfig?.description ?? tool.description,
163
- overrideResponse: toolOverride?.overrideResponse ?? entityPluginConfig?.overrideResponse ?? tool.overrideResponse
164
- };
165
- };
166
232
 
167
233
  //# sourceMappingURL=sanitizeMCPConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/mcp/sanitizeMCPConfig.ts"],"sourcesContent":["import type {\n CollectionConfig,\n Config,\n GlobalConfig,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport type {\n CollectionTool,\n GlobalTool,\n MCPBuiltInToolOverride,\n MCPItem,\n MCPPluginCollectionConfig,\n MCPPluginConfig,\n MCPPluginGlobalConfig,\n SanitizedMCPPluginConfig,\n} from '../types.js'\n\nimport {\n COLLECTION_AUTH_BUILTIN_ENTRIES,\n COLLECTION_AUTH_BUILTINS,\n COLLECTION_BUILTIN_ENTRIES,\n COLLECTION_BUILTINS,\n GLOBAL_BUILTIN_ENTRIES,\n GLOBAL_BUILTINS,\n} from './builtinTools.js'\n\n/**\n * Converts the user-configured `MCPPluginConfig` into a `SanitizedMCPPluginConfig`:\n * - Flattens `tools` / `prompts` / `resources` / per-collection / per-global\n * tool maps into a single `items` array.\n * - Applies built-in tools for collections and globals, respecting opt-out user overrides.\n * - Applies the `userCollection` default\n *\n * Called once during plugin init. After that, `plugins['@payloadcms/plugin-mcp']\n * ?.options` holds the sanitized result\n */\nexport const sanitizeMCPConfig = ({\n config,\n pluginConfig,\n}: {\n config: Config | SanitizedConfig\n pluginConfig: MCPPluginConfig\n}): SanitizedMCPPluginConfig => {\n const items: MCPItem[] = []\n\n for (const collection of config.collections ?? []) {\n items.push(...sanitizeCollectionConfig({ collection, pluginConfig }))\n }\n\n for (const global of config.globals ?? []) {\n items.push(...sanitizeGlobalConfig({ global, pluginConfig }))\n }\n\n for (const [key, tool] of Object.entries(pluginConfig.tools ?? {})) {\n items.push({\n type: 'tool',\n key,\n label: key,\n tool,\n })\n }\n\n for (const [key, prompt] of Object.entries(pluginConfig.prompts ?? {})) {\n items.push({\n type: 'prompt',\n key,\n label: prompt.title ?? key,\n prompt,\n })\n }\n\n for (const [key, resource] of Object.entries(pluginConfig.resources ?? {})) {\n items.push({\n type: 'resource',\n key,\n label: resource.title ?? key,\n resource,\n })\n }\n\n // Mirror Payload's own admin.user detection (sanitize.ts) since plugins run first.\n const firstCollectionWithAuth = config.collections!.find(({ auth }) => Boolean(auth))\n\n return {\n disabled: pluginConfig.disabled,\n items,\n mcp: pluginConfig.mcp,\n overrideApiKeyCollection: pluginConfig.overrideApiKeyCollection,\n overrideAuth: pluginConfig.overrideAuth,\n userCollection:\n pluginConfig.userCollection ?? config.admin?.user ?? firstCollectionWithAuth?.slug ?? 'users',\n }\n}\n\nconst sanitizeCollectionConfig = ({\n collection,\n pluginConfig,\n}: {\n collection: CollectionConfig | SanitizedCollectionConfig\n pluginConfig: MCPPluginConfig\n}): MCPItem[] => {\n if (collection.slug === 'payload-mcp-api-keys') {\n return []\n }\n const slug = collection.slug\n const collectionPluginConfig = pluginConfig.collections?.[slug]\n const items: MCPItem[] = []\n\n for (const [toolKey, tool] of COLLECTION_BUILTIN_ENTRIES) {\n const matchedConfigEntry = collectionPluginConfig?.tools?.[toolKey]\n if (matchedConfigEntry === false) {\n continue\n }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n key: toolKey,\n label: capitalize(toolKey),\n tool: overrideBuiltinTool(tool, matchedConfigEntry, collectionPluginConfig),\n })\n }\n\n if (collection.auth) {\n for (const [authToolKey, { label, tool }] of COLLECTION_AUTH_BUILTIN_ENTRIES) {\n const matchedConfigEntry = collectionPluginConfig?.tools?.[authToolKey]\n if (!matchedConfigEntry) {\n continue\n }\n // `true` means \"enable, no override\"; only the object form carries fields.\n const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n key: authToolKey,\n label,\n tool: overrideBuiltinTool(tool, override, collectionPluginConfig),\n })\n }\n }\n\n // Cast: builtin keys are filtered out below, so the remaining values are\n // always custom tools (`CollectionTool`) or undefined\n const customEntries = Object.entries(collectionPluginConfig?.tools ?? {}) as Array<\n [string, CollectionTool | undefined]\n >\n for (const [key, customTool] of customEntries) {\n if (key in COLLECTION_BUILTINS || key in COLLECTION_AUTH_BUILTINS) {\n continue\n }\n if (!customTool) {\n continue\n }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n key,\n label: key,\n tool: customTool,\n })\n }\n\n return items\n}\n\nconst sanitizeGlobalConfig = ({\n global,\n pluginConfig,\n}: {\n global: GlobalConfig | SanitizedGlobalConfig\n pluginConfig: MCPPluginConfig\n}): MCPItem[] => {\n const slug = global.slug\n const globalPluginConfig = pluginConfig.globals?.[slug]\n const items: MCPItem[] = []\n\n for (const [toolKey, baseTool] of GLOBAL_BUILTIN_ENTRIES) {\n const matchedConfigEntry = globalPluginConfig?.tools?.[toolKey]\n if (matchedConfigEntry === false) {\n continue\n }\n items.push({\n type: 'globalTool',\n globalSlug: slug,\n key: toolKey,\n label: capitalize(toolKey),\n tool: overrideBuiltinTool(baseTool, matchedConfigEntry, globalPluginConfig),\n })\n }\n\n const customEntries = Object.entries(globalPluginConfig?.tools ?? {}) as Array<\n [string, GlobalTool | undefined]\n >\n for (const [key, customTool] of customEntries) {\n if (key in GLOBAL_BUILTINS) {\n continue\n }\n if (!customTool) {\n continue\n }\n items.push({\n type: 'globalTool',\n globalSlug: slug,\n key,\n label: key,\n tool: customTool,\n })\n }\n\n return items\n}\n\nconst capitalize = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1)\n\n/**\n * Spread the static built-in tool and apply consumer-side overrides.\n * Precedence: per-tool override > scope-level (collection/global) override >\n * the static tool's defaults. `toolEntry` is whatever the user put under\n * `tools: { find: ... }` — could be `true`, `false`, or an override object —\n * so it's narrowed internally.\n */\nconst overrideBuiltinTool = <TTool extends CollectionTool | GlobalTool>(\n tool: TTool,\n toolOverride?: MCPBuiltInToolOverride,\n entityPluginConfig?: TTool extends CollectionTool\n ? MCPPluginCollectionConfig<any>\n : MCPPluginGlobalConfig,\n): TTool => {\n return {\n ...tool,\n description: toolOverride?.description ?? entityPluginConfig?.description ?? tool.description,\n overrideResponse:\n toolOverride?.overrideResponse ??\n entityPluginConfig?.overrideResponse ??\n tool.overrideResponse,\n }\n}\n"],"names":["COLLECTION_AUTH_BUILTIN_ENTRIES","COLLECTION_AUTH_BUILTINS","COLLECTION_BUILTIN_ENTRIES","COLLECTION_BUILTINS","GLOBAL_BUILTIN_ENTRIES","GLOBAL_BUILTINS","sanitizeMCPConfig","config","pluginConfig","items","collection","collections","push","sanitizeCollectionConfig","global","globals","sanitizeGlobalConfig","key","tool","Object","entries","tools","type","label","prompt","prompts","title","resource","resources","firstCollectionWithAuth","find","auth","Boolean","disabled","mcp","overrideApiKeyCollection","overrideAuth","userCollection","admin","user","slug","collectionPluginConfig","toolKey","matchedConfigEntry","collectionSlug","capitalize","overrideBuiltinTool","authToolKey","override","undefined","customEntries","customTool","globalPluginConfig","baseTool","globalSlug","s","charAt","toUpperCase","slice","toolOverride","entityPluginConfig","description","overrideResponse"],"mappings":"AAoBA,SACEA,+BAA+B,EAC/BC,wBAAwB,EACxBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,sBAAsB,EACtBC,eAAe,QACV,oBAAmB;AAE1B;;;;;;;;;CASC,GACD,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,MAAM,EACNC,YAAY,EAIb;IACC,MAAMC,QAAmB,EAAE;IAE3B,KAAK,MAAMC,cAAcH,OAAOI,WAAW,IAAI,EAAE,CAAE;QACjDF,MAAMG,IAAI,IAAIC,yBAAyB;YAAEH;YAAYF;QAAa;IACpE;IAEA,KAAK,MAAMM,UAAUP,OAAOQ,OAAO,IAAI,EAAE,CAAE;QACzCN,MAAMG,IAAI,IAAII,qBAAqB;YAAEF;YAAQN;QAAa;IAC5D;IAEA,KAAK,MAAM,CAACS,KAAKC,KAAK,IA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MAAMuC,qBAAqBS,oBAAoB/B,OAAO,CAACqB,QAAQ;QAC/D,IAAIC,uBAAuB,OAAO;YAChC;QACF;QACAlC,MAAMG,IAAI,CAAC;YACTU,MAAM;YACNgC,YAAYd;YACZvB,KAAKyB;YACLnB,OAAOsB,WAAWH;YAClBxB,MAAM4B,oBAAoBO,UAAUV,oBAAoBS;QAC1D;IACF;IAEA,MAAMF,gBAAgB/B,OAAOC,OAAO,CAACgC,oBAAoB/B,SAAS,CAAC;IAGnE,KAAK,MAAM,CAACJ,KAAKkC,WAAW,IAAID,cAAe;QAC7C,IAAIjC,OAAOZ,iBAAiB;YAC1B;QACF;QACA,IAAI,CAAC8C,YAAY;YACf;QACF;QACA1C,MAAMG,IAAI,CAAC;YACTU,MAAM;YACNgC,YAAYd;YACZvB;YACAM,OAAON;YACPC,MAAMiC;QACR;IACF;IAEA,OAAO1C;AACT;AAEA,MAAMoC,aAAa,CAACU,IAAsBA,EAAEC,MAAM,CAAC,GAAGC,WAAW,KAAKF,EAAEG,KAAK,CAAC;AAE9E;;;;;;CAMC,GACD,MAAMZ,sBAAsB,CAC1B5B,MACAyC,cACAC;IAIA,OAAO;QACL,GAAG1C,IAAI;QACP2C,aAAaF,cAAcE,eAAeD,oBAAoBC,eAAe3C,KAAK2C,WAAW;QAC7FC,kBACEH,cAAcG,oBACdF,oBAAoBE,oBACpB5C,KAAK4C,gBAAgB;IACzB;AACF"}
1
+ {"version":3,"sources":["../../src/mcp/sanitizeMCPConfig.ts"],"sourcesContent":["import type {\n CollectionConfig,\n Config,\n GlobalConfig,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport type {\n CollectionMCPItem,\n CollectionTool,\n GlobalMCPItem,\n GlobalTool,\n MCPItem,\n MCPPluginConfig,\n SanitizedMCPPluginConfig,\n} from '../types.js'\n\nimport { defaultAccess } from '../defaultAccess.js'\nimport {\n COLLECTION_AUTH_BUILTIN_ENTRIES,\n COLLECTION_AUTH_BUILTINS,\n COLLECTION_BUILTIN_ENTRIES,\n COLLECTION_BUILTINS,\n GLOBAL_BUILTIN_ENTRIES,\n GLOBAL_BUILTINS,\n TOOL_BUILTIN_ENTRIES,\n TOOL_BUILTINS,\n} from './builtinTools.js'\n\n/**\n * Converts the user-configured `MCPPluginConfig` into a `SanitizedMCPPluginConfig`:\n * - Flattens `tools` / `prompts` / `resources` / per-collection / per-global\n * tool maps into a single `items` array.\n * - Applies built-in tools for collections and globals, respecting opt-out user overrides.\n *\n * Called once during plugin init. After that, `plugins['@payloadcms/plugin-mcp']\n * ?.options` holds the sanitized result\n */\nexport const sanitizeMCPConfig = ({\n config,\n pluginConfig,\n}: {\n config: Config | SanitizedConfig\n pluginConfig: MCPPluginConfig\n}): SanitizedMCPPluginConfig => {\n const items: MCPItem[] = []\n\n for (const collection of config.collections ?? []) {\n items.push(...sanitizeCollectionConfig({ collection, pluginConfig }))\n }\n\n for (const global of config.globals ?? []) {\n items.push(...sanitizeGlobalConfig({ global, pluginConfig }))\n }\n\n for (const [configKey, { mcpName, tool }] of TOOL_BUILTIN_ENTRIES) {\n items.push({\n type: 'tool',\n configKey,\n label: tool.annotations?.title ?? configKey,\n mcpName,\n tool: { ...tool, access: tool.access ?? defaultAccess },\n })\n }\n\n for (const [configKey, tool] of Object.entries(pluginConfig.tools ?? {})) {\n if (configKey in TOOL_BUILTINS) {\n continue\n }\n items.push({\n type: 'tool',\n configKey,\n label: tool.annotations?.title ?? configKey,\n mcpName: configKey,\n tool: { ...tool, access: tool.access ?? defaultAccess },\n })\n }\n\n for (const [configKey, prompt] of Object.entries(pluginConfig.prompts ?? {})) {\n items.push({\n type: 'prompt',\n configKey,\n label: prompt.title ?? configKey,\n mcpName: configKey,\n prompt: { ...prompt, access: prompt.access ?? defaultAccess },\n })\n }\n\n for (const [configKey, resource] of Object.entries(pluginConfig.resources ?? {})) {\n items.push({\n type: 'resource',\n configKey,\n label: resource.title ?? configKey,\n mcpName: configKey,\n resource: { ...resource, access: resource.access ?? defaultAccess },\n })\n }\n\n return {\n disabled: pluginConfig.disabled,\n hooks: pluginConfig.hooks,\n items,\n mcp: pluginConfig.mcp,\n overrideGetAuthorizedMCP: pluginConfig.overrideGetAuthorizedMCP,\n }\n}\n\nconst sanitizeCollectionConfig = ({\n collection,\n pluginConfig,\n}: {\n collection: CollectionConfig | SanitizedCollectionConfig\n pluginConfig: MCPPluginConfig\n}): CollectionMCPItem[] => {\n const slug = collection.slug\n const collectionPluginConfig = pluginConfig.collections?.[slug]\n const items: CollectionMCPItem[] = []\n /**\n * Payload disables duplicate for auth collections by default unless the\n * collection explicitly opts back in with `disableDuplicate: false`.\n */\n const isDuplicateDisabled =\n collection.disableDuplicate === true ||\n (Boolean(collection.auth) && collection.disableDuplicate !== false)\n\n for (const [\n toolKey,\n { mcpName, requiresDuplicateEnabled, requiresUpload, requiresVersions, tool },\n ] of COLLECTION_BUILTIN_ENTRIES) {\n if (requiresVersions && !collection.versions) {\n continue\n }\n if (requiresDuplicateEnabled && isDuplicateDisabled) {\n continue\n }\n if (requiresUpload && !collection.upload) {\n continue\n }\n const matchedConfigEntry = collectionPluginConfig?.tools?.[toolKey]\n if (matchedConfigEntry === false) {\n continue\n }\n const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined\n const annotations = { ...tool.annotations, ...override?.annotations }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n configKey: toolKey,\n label: annotations.title ?? toolKey,\n mcpName,\n tool: {\n ...tool,\n access: override?.access ?? tool.access ?? defaultAccess,\n annotations,\n description: override?.description ?? tool.description,\n overrideResponse:\n override?.overrideResponse ??\n collectionPluginConfig?.overrideResponse ??\n tool.overrideResponse,\n },\n })\n }\n\n if (collection.auth) {\n for (const [authToolKey, { mcpName, tool }] of COLLECTION_AUTH_BUILTIN_ENTRIES) {\n const matchedConfigEntry = collectionPluginConfig?.tools?.[authToolKey]\n if (!matchedConfigEntry) {\n continue\n }\n // `true` means \"enable, no override\"; only the object form carries fields.\n const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined\n const annotations = { ...tool.annotations, ...override?.annotations }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n configKey: authToolKey,\n label: annotations.title ?? authToolKey,\n mcpName,\n tool: {\n ...tool,\n access: override?.access ?? tool.access ?? defaultAccess,\n annotations,\n description: override?.description ?? tool.description,\n overrideResponse:\n override?.overrideResponse ??\n collectionPluginConfig?.overrideResponse ??\n tool.overrideResponse,\n },\n })\n }\n }\n\n // Cast: builtin keys are filtered out below, so the remaining values are\n // always custom tools (`CollectionTool`) or undefined\n const customEntries = Object.entries(collectionPluginConfig?.tools ?? {}) as Array<\n [string, CollectionTool | undefined]\n >\n for (const [configKey, customTool] of customEntries) {\n if (configKey in COLLECTION_BUILTINS || configKey in COLLECTION_AUTH_BUILTINS) {\n continue\n }\n if (!customTool) {\n continue\n }\n items.push({\n type: 'collectionTool',\n collectionSlug: slug,\n configKey,\n label: customTool.annotations?.title ?? configKey,\n mcpName: configKey,\n tool: { ...customTool, access: customTool.access ?? defaultAccess },\n })\n }\n\n return items\n}\n\nconst sanitizeGlobalConfig = ({\n global,\n pluginConfig,\n}: {\n global: GlobalConfig | SanitizedGlobalConfig\n pluginConfig: MCPPluginConfig\n}): GlobalMCPItem[] => {\n const slug = global.slug\n const globalPluginConfig = pluginConfig.globals?.[slug]\n const items: GlobalMCPItem[] = []\n\n for (const [toolKey, { mcpName, requiresVersions, tool }] of GLOBAL_BUILTIN_ENTRIES) {\n if (requiresVersions && !global.versions) {\n continue\n }\n const matchedConfigEntry = globalPluginConfig?.tools?.[toolKey]\n if (matchedConfigEntry === false) {\n continue\n }\n const override = typeof matchedConfigEntry === 'object' ? matchedConfigEntry : undefined\n const annotations = { ...tool.annotations, ...override?.annotations }\n items.push({\n type: 'globalTool',\n configKey: toolKey,\n globalSlug: slug,\n label: annotations.title ?? toolKey,\n mcpName,\n tool: {\n ...tool,\n access: override?.access ?? tool.access ?? defaultAccess,\n annotations,\n description: override?.description ?? tool.description,\n overrideResponse:\n override?.overrideResponse ??\n globalPluginConfig?.overrideResponse ??\n tool.overrideResponse,\n },\n })\n }\n\n const customEntries = Object.entries(globalPluginConfig?.tools ?? {}) as Array<\n [string, GlobalTool | undefined]\n >\n for (const [configKey, customTool] of customEntries) {\n if (configKey in GLOBAL_BUILTINS) {\n continue\n }\n if (!customTool) {\n continue\n }\n items.push({\n type: 'globalTool',\n configKey,\n globalSlug: slug,\n label: customTool.annotations?.title ?? configKey,\n mcpName: configKey,\n tool: { ...customTool, access: customTool.access ?? defaultAccess },\n })\n }\n\n return items\n}\n"],"names":["defaultAccess","COLLECTION_AUTH_BUILTIN_ENTRIES","COLLECTION_AUTH_BUILTINS","COLLECTION_BUILTIN_ENTRIES","COLLECTION_BUILTINS","GLOBAL_BUILTIN_ENTRIES","GLOBAL_BUILTINS","TOOL_BUILTIN_ENTRIES","TOOL_BUILTINS","sanitizeMCPConfig","config","pluginConfig","items","collection","collections","push","sanitizeCollectionConfig","global","globals","sanitizeGlobalConfig","configKey","mcpName","tool","type","label","annotations","title","access","Object","entries","tools","prompt","prompts","resource","resources","disabled","hooks","mcp","overrideGetAuthorizedMCP","slug","collectionPluginConfig","isDuplicateDisabled","disableDuplicate","Boolean","auth","toolKey","requiresDuplicateEnabled","requiresUpload","requiresVersions","versions","upload","matchedConfigEntry","override","undefined","collectionSlug","description","overrideResponse","authToolKey","customEntries","customTool","globalPluginConfig","globalSlug"],"mappings":"AAmBA,SAASA,aAAa,QAAQ,sBAAqB;AACnD,SACEC,+BAA+B,EAC/BC,wBAAwB,EACxBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,sBAAsB,EACtBC,eAAe,EACfC,oBAAoB,EACpBC,aAAa,QACR,oBAAmB;AAE1B;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,MAAM,EACNC,YAAY,EAIb;IACC,MAAMC,QAAmB,EAAE;IAE3B,KAAK,MAAMC,cAAcH,OAA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aAAad,iBAAiB;YAChC;QACF;QACA,IAAI,CAACqD,YAAY;YACf;QACF;QACA/C,MAAMG,IAAI,CAAC;YACTQ,MAAM;YACNH;YACAyC,YAAYtB;YACZf,OAAOmC,WAAWlC,WAAW,EAAEC,SAASN;YACxCC,SAASD;YACTE,MAAM;gBAAE,GAAGqC,UAAU;gBAAEhC,QAAQgC,WAAWhC,MAAM,IAAI3B;YAAc;QACpE;IACF;IAEA,OAAOY;AACT"}
package/dist/stdio.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Stdio adapter for the Payload MCP server.
2
+ * Starts Payload's MCP server over stdin and stdout.
3
3
  *
4
- * Do not use in production. There's no auth; whoever can spawn the process gets
5
- * full access to your local data.
4
+ * Set `PAYLOAD_MCP_AUTHORIZATION` to authenticate. In development,
5
+ * `PAYLOAD_MCP_OVERRIDE_ACCESS=true` skips access checks.
6
6
  */
7
7
  export declare const runMcpStdio: () => Promise<void>;
8
8
  //# sourceMappingURL=stdio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,IAAI,CA4EhD,CAAA"}
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,IAAI,CA4GhD,CAAA"}