@payloadcms/plugin-mcp 3.86.0-internal.ac46214 → 4.0.0-canary.1

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 (368) hide show
  1. package/README.md +2 -2
  2. package/bin.js +39 -0
  3. package/dist/collection/getAccessField.d.ts +12 -0
  4. package/dist/collection/getAccessField.d.ts.map +1 -0
  5. package/dist/collection/getAccessField.js +57 -0
  6. package/dist/collection/getAccessField.js.map +1 -0
  7. package/dist/collection/index.d.ts +6 -0
  8. package/dist/collection/index.d.ts.map +1 -0
  9. package/dist/collection/index.js +60 -0
  10. package/dist/collection/index.js.map +1 -0
  11. package/dist/components/AccessField/index.client.d.ts +10 -0
  12. package/dist/components/AccessField/index.client.d.ts.map +1 -0
  13. package/dist/components/AccessField/index.client.js +305 -0
  14. package/dist/components/AccessField/index.client.js.map +1 -0
  15. package/dist/components/AccessField/index.css +93 -0
  16. package/dist/defineTool.d.ts +26 -0
  17. package/dist/defineTool.d.ts.map +1 -0
  18. package/dist/defineTool.js +37 -0
  19. package/dist/defineTool.js.map +1 -0
  20. package/dist/endpoint/access.d.ts +10 -0
  21. package/dist/endpoint/access.d.ts.map +1 -0
  22. package/dist/endpoint/access.js +106 -0
  23. package/dist/endpoint/access.js.map +1 -0
  24. package/dist/endpoint/index.d.ts +3 -0
  25. package/dist/endpoint/index.d.ts.map +1 -0
  26. package/dist/endpoint/index.js +36 -0
  27. package/dist/endpoint/index.js.map +1 -0
  28. package/dist/exports/client.d.ts +2 -0
  29. package/dist/exports/client.d.ts.map +1 -0
  30. package/dist/exports/client.js +4 -0
  31. package/dist/exports/client.js.map +1 -0
  32. package/dist/index.d.ts +4 -7
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +44 -67
  35. package/dist/index.js.map +1 -1
  36. package/dist/mcp/buildMcpServer.d.ts +19 -0
  37. package/dist/mcp/buildMcpServer.d.ts.map +1 -0
  38. package/dist/mcp/buildMcpServer.js +199 -0
  39. package/dist/mcp/buildMcpServer.js.map +1 -0
  40. package/dist/mcp/builtin/collections/authTools.d.ts +7 -0
  41. package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -0
  42. package/dist/mcp/builtin/collections/authTools.js +250 -0
  43. package/dist/mcp/builtin/collections/authTools.js.map +1 -0
  44. package/dist/mcp/builtin/collections/createTool.d.ts +2 -0
  45. package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -0
  46. package/dist/mcp/builtin/collections/createTool.js +94 -0
  47. package/dist/mcp/builtin/collections/createTool.js.map +1 -0
  48. package/dist/mcp/builtin/collections/deleteTool.d.ts +2 -0
  49. package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -0
  50. package/dist/mcp/builtin/collections/deleteTool.js +102 -0
  51. package/dist/mcp/builtin/collections/deleteTool.js.map +1 -0
  52. package/dist/mcp/builtin/collections/findTool.d.ts +2 -0
  53. package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -0
  54. package/dist/mcp/builtin/collections/findTool.js +144 -0
  55. package/dist/mcp/builtin/collections/findTool.js.map +1 -0
  56. package/dist/mcp/builtin/collections/formatCollectionError.d.ts +9 -0
  57. package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -0
  58. package/dist/mcp/builtin/collections/formatCollectionError.js +60 -0
  59. package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -0
  60. package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts +2 -0
  61. package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -0
  62. package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +35 -0
  63. package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -0
  64. package/dist/mcp/builtin/collections/updateTool.d.ts +2 -0
  65. package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -0
  66. package/dist/mcp/builtin/collections/updateTool.js +199 -0
  67. package/dist/mcp/builtin/collections/updateTool.js.map +1 -0
  68. package/dist/mcp/builtin/getConfigInfoTool.d.ts +2 -0
  69. package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -0
  70. package/dist/mcp/builtin/getConfigInfoTool.js +49 -0
  71. package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -0
  72. package/dist/mcp/builtin/globals/findTool.d.ts +2 -0
  73. package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -0
  74. package/dist/mcp/builtin/globals/findTool.js +76 -0
  75. package/dist/mcp/builtin/globals/findTool.js.map +1 -0
  76. package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts +2 -0
  77. package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -0
  78. package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +35 -0
  79. package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -0
  80. package/dist/mcp/builtin/globals/updateTool.d.ts +2 -0
  81. package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -0
  82. package/dist/mcp/builtin/globals/updateTool.js +94 -0
  83. package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
  84. package/dist/mcp/builtin/validateEntityData.d.ts +14 -0
  85. package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -0
  86. package/dist/mcp/builtin/validateEntityData.js +82 -0
  87. package/dist/mcp/builtin/validateEntityData.js.map +1 -0
  88. package/dist/mcp/builtinTools.d.ts +105 -0
  89. package/dist/mcp/builtinTools.d.ts.map +1 -0
  90. package/dist/mcp/builtinTools.js +107 -0
  91. package/dist/mcp/builtinTools.js.map +1 -0
  92. package/dist/mcp/sanitizeMCPConfig.d.ts +17 -0
  93. package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -0
  94. package/dist/mcp/sanitizeMCPConfig.js +188 -0
  95. package/dist/mcp/sanitizeMCPConfig.js.map +1 -0
  96. package/dist/stdio.d.ts +8 -0
  97. package/dist/stdio.d.ts.map +1 -0
  98. package/dist/stdio.js +89 -0
  99. package/dist/stdio.js.map +1 -0
  100. package/dist/types.d.ts +251 -455
  101. package/dist/types.d.ts.map +1 -1
  102. package/dist/types.js +6 -1
  103. package/dist/types.js.map +1 -1
  104. package/dist/utils/camelCase.d.ts.map +1 -1
  105. package/dist/utils/getLogger.d.ts +10 -0
  106. package/dist/utils/getLogger.d.ts.map +1 -0
  107. package/dist/utils/getLogger.js +22 -0
  108. package/dist/utils/getLogger.js.map +1 -0
  109. package/dist/utils/getPluginConfig.d.ts +12 -0
  110. package/dist/utils/getPluginConfig.d.ts.map +1 -0
  111. package/dist/utils/getPluginConfig.js +15 -0
  112. package/dist/utils/getPluginConfig.js.map +1 -0
  113. package/dist/utils/localAPIDefaults.d.ts +20 -0
  114. package/dist/utils/localAPIDefaults.d.ts.map +1 -0
  115. package/dist/utils/localAPIDefaults.js +19 -0
  116. package/dist/utils/localAPIDefaults.js.map +1 -0
  117. package/dist/utils/resolveProjectRoot.d.ts +7 -0
  118. package/dist/utils/resolveProjectRoot.d.ts.map +1 -0
  119. package/dist/utils/resolveProjectRoot.js +15 -0
  120. package/dist/utils/resolveProjectRoot.js.map +1 -0
  121. package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +11 -0
  122. package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -0
  123. package/dist/utils/schemaConversion/getEntityInputSchema.js +34 -0
  124. package/dist/utils/schemaConversion/getEntityInputSchema.js.map +1 -0
  125. package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +2 -2
  126. package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +1 -1
  127. package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +1 -1
  128. package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +15 -0
  129. package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -0
  130. package/dist/utils/schemaConversion/sanitizeEntitySchema.js +464 -0
  131. package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -0
  132. package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +158 -0
  133. package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -0
  134. package/dist/utils/toStandardSchema.d.ts +5 -0
  135. package/dist/utils/toStandardSchema.d.ts.map +1 -0
  136. package/dist/utils/toStandardSchema.js +4 -0
  137. package/dist/utils/toStandardSchema.js.map +1 -0
  138. package/dist/utils/whereSchema.d.ts +9 -0
  139. package/dist/utils/whereSchema.d.ts.map +1 -0
  140. package/dist/utils/whereSchema.js +13 -0
  141. package/dist/utils/whereSchema.js.map +1 -0
  142. package/package.json +35 -10
  143. package/src/collection/getAccessField.ts +64 -0
  144. package/src/collection/index.ts +64 -0
  145. package/src/components/AccessField/index.client.tsx +347 -0
  146. package/src/components/AccessField/index.css +93 -0
  147. package/src/defineTool.ts +44 -0
  148. package/src/endpoint/access.ts +132 -0
  149. package/src/endpoint/index.ts +35 -0
  150. package/src/exports/client.ts +2 -0
  151. package/src/index.ts +35 -85
  152. package/src/mcp/buildMcpServer.ts +257 -0
  153. package/src/mcp/builtin/collections/authTools.ts +233 -0
  154. package/src/mcp/builtin/collections/createTool.ts +112 -0
  155. package/src/mcp/builtin/collections/deleteTool.ts +116 -0
  156. package/src/mcp/builtin/collections/findTool.ts +177 -0
  157. package/src/mcp/builtin/collections/formatCollectionError.ts +84 -0
  158. package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +28 -0
  159. package/src/mcp/builtin/collections/updateTool.ts +211 -0
  160. package/src/mcp/builtin/getConfigInfoTool.ts +44 -0
  161. package/src/mcp/builtin/globals/findTool.ts +96 -0
  162. package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +28 -0
  163. package/src/mcp/builtin/globals/updateTool.ts +115 -0
  164. package/src/mcp/builtin/validateEntityData.ts +132 -0
  165. package/src/mcp/builtinTools.ts +98 -0
  166. package/src/mcp/sanitizeMCPConfig.ts +260 -0
  167. package/src/stdio.ts +98 -0
  168. package/src/types.ts +290 -490
  169. package/src/utils/getLogger.ts +22 -0
  170. package/src/utils/getPluginConfig.ts +24 -0
  171. package/src/utils/localAPIDefaults.ts +22 -0
  172. package/src/utils/resolveProjectRoot.ts +17 -0
  173. package/src/utils/schemaConversion/getEntityInputSchema.ts +78 -0
  174. package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +3 -3
  175. package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +103 -0
  176. package/src/utils/schemaConversion/sanitizeEntitySchema.ts +529 -0
  177. package/src/utils/toStandardSchema.ts +9 -0
  178. package/src/utils/whereSchema.ts +24 -0
  179. package/dist/collections/createApiKeysCollection.d.ts +0 -7
  180. package/dist/collections/createApiKeysCollection.d.ts.map +0 -1
  181. package/dist/collections/createApiKeysCollection.js +0 -317
  182. package/dist/collections/createApiKeysCollection.js.map +0 -1
  183. package/dist/defaults.d.ts +0 -4
  184. package/dist/defaults.d.ts.map +0 -1
  185. package/dist/defaults.js +0 -5
  186. package/dist/defaults.js.map +0 -1
  187. package/dist/endpoints/mcp.d.ts +0 -4
  188. package/dist/endpoints/mcp.d.ts.map +0 -1
  189. package/dist/endpoints/mcp.js +0 -71
  190. package/dist/endpoints/mcp.js.map +0 -1
  191. package/dist/mcp/createRequest.d.ts +0 -3
  192. package/dist/mcp/createRequest.d.ts.map +0 -1
  193. package/dist/mcp/createRequest.js +0 -14
  194. package/dist/mcp/createRequest.js.map +0 -1
  195. package/dist/mcp/getMcpHandler.d.ts +0 -4
  196. package/dist/mcp/getMcpHandler.d.ts.map +0 -1
  197. package/dist/mcp/getMcpHandler.js +0 -231
  198. package/dist/mcp/getMcpHandler.js.map +0 -1
  199. package/dist/mcp/helpers/config.d.ts +0 -22
  200. package/dist/mcp/helpers/config.d.ts.map +0 -1
  201. package/dist/mcp/helpers/config.js +0 -153
  202. package/dist/mcp/helpers/config.js.map +0 -1
  203. package/dist/mcp/helpers/fields.d.ts +0 -19
  204. package/dist/mcp/helpers/fields.d.ts.map +0 -1
  205. package/dist/mcp/helpers/fields.js +0 -102
  206. package/dist/mcp/helpers/fields.js.map +0 -1
  207. package/dist/mcp/helpers/fileValidation.d.ts +0 -67
  208. package/dist/mcp/helpers/fileValidation.d.ts.map +0 -1
  209. package/dist/mcp/helpers/fileValidation.js +0 -267
  210. package/dist/mcp/helpers/fileValidation.js.map +0 -1
  211. package/dist/mcp/registerTool.d.ts +0 -6
  212. package/dist/mcp/registerTool.d.ts.map +0 -1
  213. package/dist/mcp/registerTool.js +0 -18
  214. package/dist/mcp/registerTool.js.map +0 -1
  215. package/dist/mcp/tools/auth/auth.d.ts +0 -4
  216. package/dist/mcp/tools/auth/auth.d.ts.map +0 -1
  217. package/dist/mcp/tools/auth/auth.js +0 -57
  218. package/dist/mcp/tools/auth/auth.js.map +0 -1
  219. package/dist/mcp/tools/auth/forgotPassword.d.ts +0 -4
  220. package/dist/mcp/tools/auth/forgotPassword.d.ts.map +0 -1
  221. package/dist/mcp/tools/auth/forgotPassword.js +0 -48
  222. package/dist/mcp/tools/auth/forgotPassword.js.map +0 -1
  223. package/dist/mcp/tools/auth/login.d.ts +0 -4
  224. package/dist/mcp/tools/auth/login.d.ts.map +0 -1
  225. package/dist/mcp/tools/auth/login.js +0 -51
  226. package/dist/mcp/tools/auth/login.js.map +0 -1
  227. package/dist/mcp/tools/auth/resetPassword.d.ts +0 -4
  228. package/dist/mcp/tools/auth/resetPassword.d.ts.map +0 -1
  229. package/dist/mcp/tools/auth/resetPassword.js +0 -49
  230. package/dist/mcp/tools/auth/resetPassword.js.map +0 -1
  231. package/dist/mcp/tools/auth/unlock.d.ts +0 -4
  232. package/dist/mcp/tools/auth/unlock.d.ts.map +0 -1
  233. package/dist/mcp/tools/auth/unlock.js +0 -48
  234. package/dist/mcp/tools/auth/unlock.js.map +0 -1
  235. package/dist/mcp/tools/auth/verify.d.ts +0 -4
  236. package/dist/mcp/tools/auth/verify.d.ts.map +0 -1
  237. package/dist/mcp/tools/auth/verify.js +0 -45
  238. package/dist/mcp/tools/auth/verify.js.map +0 -1
  239. package/dist/mcp/tools/collection/create.d.ts +0 -10
  240. package/dist/mcp/tools/collection/create.d.ts.map +0 -1
  241. package/dist/mcp/tools/collection/create.js +0 -139
  242. package/dist/mcp/tools/collection/create.js.map +0 -1
  243. package/dist/mcp/tools/collection/delete.d.ts +0 -10
  244. package/dist/mcp/tools/collection/delete.d.ts.map +0 -1
  245. package/dist/mcp/tools/collection/delete.js +0 -154
  246. package/dist/mcp/tools/collection/delete.js.map +0 -1
  247. package/dist/mcp/tools/collection/find.d.ts +0 -10
  248. package/dist/mcp/tools/collection/find.d.ts.map +0 -1
  249. package/dist/mcp/tools/collection/find.js +0 -165
  250. package/dist/mcp/tools/collection/find.js.map +0 -1
  251. package/dist/mcp/tools/collection/update.d.ts +0 -10
  252. package/dist/mcp/tools/collection/update.d.ts.map +0 -1
  253. package/dist/mcp/tools/collection/update.js +0 -209
  254. package/dist/mcp/tools/collection/update.js.map +0 -1
  255. package/dist/mcp/tools/config/find.d.ts +0 -10
  256. package/dist/mcp/tools/config/find.d.ts.map +0 -1
  257. package/dist/mcp/tools/config/find.js +0 -97
  258. package/dist/mcp/tools/config/find.js.map +0 -1
  259. package/dist/mcp/tools/config/update.d.ts +0 -10
  260. package/dist/mcp/tools/config/update.d.ts.map +0 -1
  261. package/dist/mcp/tools/config/update.js +0 -215
  262. package/dist/mcp/tools/config/update.js.map +0 -1
  263. package/dist/mcp/tools/global/find.d.ts +0 -5
  264. package/dist/mcp/tools/global/find.d.ts.map +0 -1
  265. package/dist/mcp/tools/global/find.js +0 -82
  266. package/dist/mcp/tools/global/find.js.map +0 -1
  267. package/dist/mcp/tools/global/update.d.ts +0 -6
  268. package/dist/mcp/tools/global/update.d.ts.map +0 -1
  269. package/dist/mcp/tools/global/update.js +0 -124
  270. package/dist/mcp/tools/global/update.js.map +0 -1
  271. package/dist/mcp/tools/job/create.d.ts +0 -10
  272. package/dist/mcp/tools/job/create.d.ts.map +0 -1
  273. package/dist/mcp/tools/job/create.js +0 -293
  274. package/dist/mcp/tools/job/create.js.map +0 -1
  275. package/dist/mcp/tools/job/run.d.ts +0 -10
  276. package/dist/mcp/tools/job/run.d.ts.map +0 -1
  277. package/dist/mcp/tools/job/run.js +0 -129
  278. package/dist/mcp/tools/job/run.js.map +0 -1
  279. package/dist/mcp/tools/job/update.d.ts +0 -11
  280. package/dist/mcp/tools/job/update.d.ts.map +0 -1
  281. package/dist/mcp/tools/job/update.js +0 -186
  282. package/dist/mcp/tools/job/update.js.map +0 -1
  283. package/dist/mcp/tools/resource/create.d.ts +0 -6
  284. package/dist/mcp/tools/resource/create.d.ts.map +0 -1
  285. package/dist/mcp/tools/resource/create.js +0 -124
  286. package/dist/mcp/tools/resource/create.js.map +0 -1
  287. package/dist/mcp/tools/resource/delete.d.ts +0 -5
  288. package/dist/mcp/tools/resource/delete.d.ts.map +0 -1
  289. package/dist/mcp/tools/resource/delete.js +0 -151
  290. package/dist/mcp/tools/resource/delete.js.map +0 -1
  291. package/dist/mcp/tools/resource/find.d.ts +0 -5
  292. package/dist/mcp/tools/resource/find.d.ts.map +0 -1
  293. package/dist/mcp/tools/resource/find.js +0 -170
  294. package/dist/mcp/tools/resource/find.js.map +0 -1
  295. package/dist/mcp/tools/resource/update.d.ts +0 -6
  296. package/dist/mcp/tools/resource/update.d.ts.map +0 -1
  297. package/dist/mcp/tools/resource/update.js +0 -256
  298. package/dist/mcp/tools/resource/update.js.map +0 -1
  299. package/dist/mcp/tools/schemas.d.ts +0 -457
  300. package/dist/mcp/tools/schemas.d.ts.map +0 -1
  301. package/dist/mcp/tools/schemas.js +0 -243
  302. package/dist/mcp/tools/schemas.js.map +0 -1
  303. package/dist/utils/adminEntitySettings.d.ts +0 -17
  304. package/dist/utils/adminEntitySettings.d.ts.map +0 -1
  305. package/dist/utils/adminEntitySettings.js +0 -41
  306. package/dist/utils/adminEntitySettings.js.map +0 -1
  307. package/dist/utils/createApiKeyFields.d.ts +0 -15
  308. package/dist/utils/createApiKeyFields.d.ts.map +0 -1
  309. package/dist/utils/createApiKeyFields.js +0 -57
  310. package/dist/utils/createApiKeyFields.js.map +0 -1
  311. package/dist/utils/getEnabledSlugs.d.ts +0 -13
  312. package/dist/utils/getEnabledSlugs.d.ts.map +0 -1
  313. package/dist/utils/getEnabledSlugs.js +0 -32
  314. package/dist/utils/getEnabledSlugs.js.map +0 -1
  315. package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts +0 -3
  316. package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts.map +0 -1
  317. package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js +0 -43
  318. package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js.map +0 -1
  319. package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts +0 -13
  320. package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts.map +0 -1
  321. package/dist/utils/schemaConversion/sanitizeJsonSchema.js +0 -56
  322. package/dist/utils/schemaConversion/sanitizeJsonSchema.js.map +0 -1
  323. package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts +0 -20
  324. package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts.map +0 -1
  325. package/dist/utils/schemaConversion/simplifyRelationshipFields.js +0 -53
  326. package/dist/utils/schemaConversion/simplifyRelationshipFields.js.map +0 -1
  327. package/dist/utils/schemaConversion/transformPointFields.d.ts +0 -3
  328. package/dist/utils/schemaConversion/transformPointFields.d.ts.map +0 -1
  329. package/dist/utils/schemaConversion/transformPointFields.js +0 -51
  330. package/dist/utils/schemaConversion/transformPointFields.js.map +0 -1
  331. package/src/collections/createApiKeysCollection.ts +0 -373
  332. package/src/defaults.ts +0 -3
  333. package/src/endpoints/mcp.ts +0 -91
  334. package/src/mcp/createRequest.ts +0 -13
  335. package/src/mcp/getMcpHandler.ts +0 -545
  336. package/src/mcp/helpers/config.ts +0 -213
  337. package/src/mcp/helpers/fields.ts +0 -154
  338. package/src/mcp/helpers/fileValidation.ts +0 -362
  339. package/src/mcp/registerTool.ts +0 -22
  340. package/src/mcp/tools/auth/auth.ts +0 -71
  341. package/src/mcp/tools/auth/forgotPassword.ts +0 -70
  342. package/src/mcp/tools/auth/login.ts +0 -72
  343. package/src/mcp/tools/auth/resetPassword.ts +0 -61
  344. package/src/mcp/tools/auth/unlock.ts +0 -64
  345. package/src/mcp/tools/auth/verify.ts +0 -57
  346. package/src/mcp/tools/collection/create.ts +0 -210
  347. package/src/mcp/tools/collection/delete.ts +0 -211
  348. package/src/mcp/tools/collection/find.ts +0 -224
  349. package/src/mcp/tools/collection/update.ts +0 -290
  350. package/src/mcp/tools/config/find.ts +0 -128
  351. package/src/mcp/tools/config/update.ts +0 -280
  352. package/src/mcp/tools/global/find.ts +0 -128
  353. package/src/mcp/tools/global/update.ts +0 -207
  354. package/src/mcp/tools/job/create.ts +0 -416
  355. package/src/mcp/tools/job/run.ts +0 -167
  356. package/src/mcp/tools/job/update.ts +0 -274
  357. package/src/mcp/tools/resource/create.ts +0 -211
  358. package/src/mcp/tools/resource/delete.ts +0 -218
  359. package/src/mcp/tools/resource/find.ts +0 -246
  360. package/src/mcp/tools/resource/update.ts +0 -383
  361. package/src/mcp/tools/schemas.ts +0 -520
  362. package/src/utils/adminEntitySettings.ts +0 -40
  363. package/src/utils/createApiKeyFields.ts +0 -72
  364. package/src/utils/getEnabledSlugs.ts +0 -42
  365. package/src/utils/schemaConversion/convertCollectionSchemaToZod.ts +0 -52
  366. package/src/utils/schemaConversion/sanitizeJsonSchema.ts +0 -62
  367. package/src/utils/schemaConversion/simplifyRelationshipFields.ts +0 -65
  368. package/src/utils/schemaConversion/transformPointFields.ts +0 -55
package/dist/types.d.ts CHANGED
@@ -1,482 +1,278 @@
1
- import type { CollectionConfig, CollectionSlug, GlobalSlug, PayloadRequest, TypedUser } from 'payload';
2
- import type { z } from 'zod';
3
- import { type ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
4
- export type MCPPluginConfig = {
5
- /**
6
- * Set the collections that should be available as resources via MCP.
7
- */
8
- collections?: Partial<Record<CollectionSlug, {
9
- /**
10
- * Set the description of the collection. This is used by MCP clients to determine when to use the collecton as a resource.
11
- */
12
- description?: string;
13
- /**
14
- * Set the enabled capabilities of the collection. Admins can then allow or disallow the use of the capability by MCP clients.
15
- */
16
- enabled: {
17
- create?: boolean;
18
- delete?: boolean;
19
- find?: boolean;
20
- update?: boolean;
21
- } | boolean;
22
- /**
23
- * Override the response generated by the MCP client. This allows you to modify the response that is sent to the MCP client. This is useful for adding additional data to the response, data normalization, or verifying data.
24
- */
25
- overrideResponse?: (response: {
26
- content: Array<{
27
- text: string;
28
- type: string;
29
- }>;
30
- }, doc: Record<string, unknown>, req: PayloadRequest) => {
31
- content: Array<{
32
- text: string;
33
- type: string;
34
- }>;
35
- };
36
- }>>;
1
+ import type { CallToolResult, ContentBlock, JsonSchemaType, McpServer, ResourceTemplate, ServerContext, StandardSchemaWithJSON } from '@modelcontextprotocol/server';
2
+ import type { AuthCollectionSlug, CollectionConfig, CollectionSlug, DefaultDocumentIDType, GlobalSlug, MaybePromise, PayloadRequest, TypedUser } from 'payload';
3
+ import type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName } from './mcp/builtinTools.js';
4
+ export type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName };
5
+ /** Re-exported from `@modelcontextprotocol/server` — the JSON Schema shape the MCP runtime validates against. */
6
+ export type { JsonSchemaType, StandardSchemaWithJSON };
7
+ /**
8
+ * What a tool's `input` (or a prompt's `argsSchema`) can be — either a raw
9
+ * JSON Schema literal, or a Standard Schema instance (Zod, Valibot, …).
10
+ */
11
+ export type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON;
12
+ /**
13
+ * Serializable mirror of `SanitizedMCPPluginConfig` for client components —
14
+ * the full sanitized config carries functions (tool handlers, etc.) that can't
15
+ * cross the server→client boundary. Built by `sanitizeClientPluginConfig` and
16
+ * passed to the `AccessField` component via `clientProps`.
17
+ *
18
+ * @internal
19
+ */
20
+ export type ClientMCPPluginConfig = {
21
+ items: Array<{
22
+ collectionSlug?: string;
23
+ configKey: string;
24
+ description: string;
25
+ globalSlug?: string;
26
+ label: string;
27
+ type: 'collectionTool' | 'globalTool' | 'prompt' | 'resource' | 'tool';
28
+ }>;
29
+ };
30
+ export type MCPToolResponse = {
31
+ content: ContentBlock[];
37
32
  /**
38
- * Disable the MCP plugin.
33
+ * If available, return the document fetched within the
34
+ * mcp tool. This is threaded as an additional argument to
35
+ * overrideResponse functions and stripped before going on the wire.
39
36
  */
40
- disabled?: boolean;
37
+ doc?: Record<string, unknown>;
38
+ } & Pick<CallToolResult, '_meta' | 'isError' | 'structuredContent'>;
39
+ export type MCPResponseOverride = (response: MCPToolResponse, doc: Record<string, unknown>, req: PayloadRequest) => MCPToolResponse;
40
+ /**
41
+ * The handler's `input` type. A specific Standard Schema (Zod, Valibot, …) gets
42
+ * its inferred output; anything else falls back to `Record<string, unknown>`.
43
+ */
44
+ export type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON ? StandardSchemaWithJSON extends TSchema ? Record<string, unknown> : StandardSchemaWithJSON.InferOutput<TSchema> : Record<string, unknown>;
45
+ export type ToolHandlerArgs<TSchema = undefined> = {
46
+ authorizedMCP: AuthorizedMCP;
47
+ input: TypedInput<TSchema>;
48
+ req: PayloadRequest;
49
+ serverContext: ServerContext;
50
+ };
51
+ export type CollectionToolHandlerArgs<TSchema = undefined> = {
52
+ collectionSlug: CollectionSlug;
53
+ } & ToolHandlerArgs<TSchema>;
54
+ export type GlobalToolHandlerArgs<TSchema = undefined> = {
55
+ globalSlug: GlobalSlug;
56
+ } & ToolHandlerArgs<TSchema>;
57
+ export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
58
+ description: string;
59
+ handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
60
+ input?: TSchema;
41
61
  /**
42
- * Experimental features
43
- * **These features are for experimental purposes -- They are Disabled in Production by Default**
62
+ * Override the return value of the tool handler
44
63
  */
45
- experimental?: {
46
- /**
47
- * These are MCP tools that can be used by a client to modify Payload.
48
- */
49
- tools: {
50
- /**
51
- * **Experimental** -- Auth MCP tools allow a client to change authentication priviliages for users. This is for developing ideas that help Admins with authentication tasks.
52
- */
53
- auth?: {
54
- /**
55
- * Enable the auth MCP tools. This allows Admins to enable or disable the auth capabilities.
56
- * @default false
57
- */
58
- enabled: boolean;
59
- };
60
- /**
61
- * **Experimental** -- Collection MCP tools allow for the creation, modification, and deletion of Payload collections. This is for developing ideas that help Developers with collection tasks.
62
- */
63
- collections?: {
64
- /**
65
- * Set the directory path to the collections directory. This can be a directory outside of your default directory, or another Payload project.
66
- */
67
- collectionsDirPath: string;
68
- /**
69
- * Enable the collection MCP tools. This allows Admins to enable or disable the Collection modification capabilities.
70
- * @default false
71
- */
72
- enabled: boolean;
73
- };
74
- /**
75
- * **Experimental** -- Config MCP tools allow for the modification of a Payload Config. This is for developing ideas that help Developers with config tasks.
76
- */
77
- config?: {
78
- /**
79
- * Set the directory path to the config directory. This can be a directory outside of your default directory, or another Payload project.
80
- */
81
- configFilePath: string;
82
- /**
83
- * Enable the config MCP tools. This allows Admins to enable or disable the Payload Config modification capabilities.
84
- * @default false
85
- */
86
- enabled: boolean;
87
- };
88
- /**
89
- * **Experimental** -- Jobs MCP tools allow for the modification of Payload jobs. This is for developing ideas that help Developers with job tasks.
90
- */
91
- jobs?: {
92
- /**
93
- * Enable the jobs MCP tools. This allows Admins to enable or disable the Job modification capabilities.
94
- * @default false
95
- */
96
- enabled: boolean;
97
- /**
98
- * Set the directory path to the jobs directory. This can be a directory outside of your default directory, or another Payload project.
99
- */
100
- jobsDirPath: string;
64
+ overrideResponse?: MCPResponseOverride;
65
+ };
66
+ export type CollectionTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
67
+ handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
68
+ input?: TSchema;
69
+ } & Pick<Tool, 'description' | 'overrideResponse'>;
70
+ export type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
71
+ handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>;
72
+ input?: TSchema;
73
+ } & Pick<Tool, 'description' | 'overrideResponse'>;
74
+ /**
75
+ * Configures (or disables) a built-in tool without replacing it.
76
+ * `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a
77
+ * required handler) from being silently accepted at a built-in key slot.
78
+ */
79
+ export type MCPBuiltInToolOverride = {
80
+ description?: string;
81
+ handler?: never;
82
+ overrideResponse?: MCPResponseOverride;
83
+ };
84
+ /**
85
+ * Value at a custom (non-built-in) tool key. Either the tool itself, or `false`
86
+ * to disable it (useful when one plugin defines a custom tool and another
87
+ * wants to opt out per-collection).
88
+ */
89
+ export type MCPTopLevelToolEntry = Tool;
90
+ export type MCPCollectionToolsMap = {
91
+ [customToolName: string]: boolean | CollectionTool | MCPBuiltInToolOverride | undefined;
92
+ } & {
93
+ [K in MCPCollectionBuiltinName]?: false | MCPBuiltInToolOverride;
94
+ };
95
+ export type MCPAuthCollectionToolsMap = {
96
+ [K in MCPCollectionAuthToolName]?: MCPBuiltInToolOverride | true;
97
+ } & MCPCollectionToolsMap;
98
+ /** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */
99
+ export type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends AuthCollectionSlug ? MCPAuthCollectionToolsMap : MCPCollectionToolsMap;
100
+ export type MCPGlobalToolsMap = {
101
+ [customToolName: string]: boolean | GlobalTool | MCPBuiltInToolOverride | undefined;
102
+ } & {
103
+ [K in MCPGlobalBuiltinName]?: false | MCPBuiltInToolOverride;
104
+ };
105
+ export type MCPTopLevelToolsMap = Record<string, Tool>;
106
+ export type PromptHandlerArgs<TSchema = undefined> = {
107
+ input: TypedInput<TSchema>;
108
+ req: PayloadRequest;
109
+ serverContext: ServerContext;
110
+ };
111
+ export type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {
112
+ argsSchema: TSchema;
113
+ description: string;
114
+ handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{
115
+ messages: Array<{
116
+ content: {
117
+ text: string;
118
+ type: 'text';
101
119
  };
102
- };
120
+ role: 'assistant' | 'user';
121
+ }>;
122
+ }>;
123
+ title: string;
124
+ };
125
+ export type ResourceHandlerArgs = {
126
+ /** Variables extracted from a `ResourceTemplate` URI. Empty for static-URI resources. */
127
+ params: Record<string, string>;
128
+ req: PayloadRequest;
129
+ serverContext: ServerContext;
130
+ uri: URL;
131
+ };
132
+ export type Resource = {
133
+ description: string;
134
+ handler: (args: ResourceHandlerArgs) => MaybePromise<{
135
+ contents: Array<{
136
+ text: string;
137
+ uri: string;
138
+ }>;
139
+ }>;
140
+ mimeType: string;
141
+ title: string;
142
+ uri: ResourceTemplate | string;
143
+ };
144
+ export type MCPPluginCollectionConfig<TSlug extends CollectionSlug> = {
145
+ description?: string;
146
+ /** Fallback for built-in tools that don't set their own `overrideResponse`. */
147
+ overrideResponse?: MCPResponseOverride;
148
+ tools?: MCPToolsMapForCollection<TSlug>;
149
+ };
150
+ export type MCPPluginGlobalConfig = {
151
+ description?: string;
152
+ overrideResponse?: MCPResponseOverride;
153
+ tools?: MCPGlobalToolsMap;
154
+ };
155
+ /**
156
+ * The user-facing config shape passed to `mcpPlugin({ ... })`. Tools, prompts,
157
+ * resources, and per-collection/global tool maps live in their own nested
158
+ * fields. `sanitizeMCPConfig` flattens those into `items` and applies defaults
159
+ * to produce a `SanitizedMCPPluginConfig` — the form every internal consumer
160
+ * actually works with.
161
+ */
162
+ export type MCPPluginConfig = {
163
+ collections?: {
164
+ [Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>;
165
+ };
166
+ /** Skip MCP registration. The API key collection is still added (so DB / types stay stable). */
167
+ disabled?: boolean;
168
+ globals?: {
169
+ [Slug in GlobalSlug]?: MCPPluginGlobalConfig;
103
170
  };
104
- /**
105
- * Set the globals that should be available as resources via MCP.
106
- * Globals are singleton configuration objects (e.g., site settings, navigation).
107
- * Note: Globals only support find and update operations.
108
- */
109
- globals?: Partial<Record<GlobalSlug, {
110
- /**
111
- * Set the description of the global. This is used by MCP clients to determine when to use the global as a resource.
112
- */
113
- description?: string;
114
- /**
115
- * Set the enabled capabilities of the global. Admins can then allow or disallow the use of the capability by MCP clients.
116
- * Note: Globals only support find and update operations as they are singletons.
117
- */
118
- enabled: {
119
- find?: boolean;
120
- update?: boolean;
121
- } | boolean;
122
- /**
123
- * Override the response generated by the MCP client. This allows you to modify the response that is sent to the MCP client. This is useful for adding additional data to the response, data normalization, or verifying data.
124
- */
125
- overrideResponse?: (response: {
126
- content: Array<{
127
- text: string;
128
- type: string;
129
- }>;
130
- }, doc: Record<string, unknown>, req: PayloadRequest) => {
131
- content: Array<{
132
- text: string;
133
- type: string;
134
- }>;
135
- };
136
- }>>;
137
- /**
138
- * MCP Server options.
139
- */
140
171
  mcp?: {
141
- handlerOptions?: MCPHandlerOptions;
142
- /**
143
- * Add custom MCP Prompts.
144
- */
145
- prompts?: {
146
- /**
147
- * Set the args schema of the prompt. This is the args schema that will be passed to the prompt. This is used by MCP clients to determine the arguments that will be passed to the prompt.
148
- */
149
- argsSchema: z.ZodRawShape;
150
- /**
151
- * Set the description of the prompt. This is used by MCP clients to determine when to use the prompt.
152
- */
153
- description: string;
154
- /**
155
- * Set the handler of the prompt. This is the function that will be called when the prompt is used.
156
- */
157
- handler: (args: Record<string, unknown>, req: PayloadRequest, _extra: unknown) => {
158
- messages: Array<{
159
- content: {
160
- text: string;
161
- type: 'text';
162
- };
163
- role: 'assistant' | 'user';
164
- }>;
165
- } | Promise<{
166
- messages: Array<{
167
- content: {
168
- text: string;
169
- type: 'text';
170
- };
171
- role: 'assistant' | 'user';
172
- }>;
173
- }>;
174
- /**
175
- * Set the function name of the prompt.
176
- */
177
- name: string;
178
- /**
179
- * Set the title of the prompt. LLMs will interperate the title to determine when to use the prompt.
180
- */
181
- title: string;
182
- }[];
183
- /**
184
- * Add custom MCP Resource.
185
- */
186
- resources?: {
187
- /**
188
- * Set the description of the resource. This is used by MCP clients to determine when to use the resource.
189
- * example: 'Data is a resource that contains special data.'
190
- */
191
- description: string;
192
- /**
193
- * Set the handler of the resource. This is the function that will be called when the resource is used.
194
- * The handler can have either 3 arguments (when no args are passed) or 4 arguments (when args are passed).
195
- */
196
- handler: (...args: any[]) => {
197
- contents: Array<{
198
- text: string;
199
- uri: string;
200
- }>;
201
- } | Promise<{
202
- contents: Array<{
203
- text: string;
204
- uri: string;
205
- }>;
206
- }>;
207
- /**
208
- * Set the mime type of the resource.
209
- * example: 'text/plain'
210
- */
211
- mimeType: string;
212
- /**
213
- * Set the function name of the resource.
214
- * example: 'data'
215
- */
216
- name: string;
217
- /**
218
- * Set the title of the resource. LLMs will interperate the title to determine when to use the resource.
219
- * example: 'Data'
220
- */
221
- title: string;
222
- /**
223
- * Set the uri of the resource.
224
- * example: 'data://app'
225
- */
226
- uri: ResourceTemplate | string;
227
- }[];
228
172
  serverOptions?: MCPServerOptions;
229
- /**
230
- * Add custom MCP Tools.
231
- */
232
- tools?: {
233
- /**
234
- * Set the description of the tool. This is used by MCP clients to determine when to use the tool.
235
- */
236
- description: string;
237
- /**
238
- * Set the handler of the tool. This is the function that will be called when the tool is used.
239
- */
240
- handler: (args: Record<string, unknown>, req: PayloadRequest, _extra: unknown) => {
241
- content: Array<{
242
- text: string;
243
- type: 'text';
244
- }>;
245
- role?: string;
246
- } | Promise<{
247
- content: Array<{
248
- text: string;
249
- type: 'text';
250
- }>;
251
- role?: string;
252
- }>;
253
- /**
254
- * Set the name of the tool. This is the name that will be used to identify the tool. LLMs will interperate the name to determine when to use the tool.
255
- */
256
- name: string;
257
- /**
258
- * Set the parameters of the tool. This is the parameters that will be passed to the tool.
259
- */
260
- parameters: z.ZodRawShape;
261
- }[];
173
+ verboseLogs?: boolean;
262
174
  };
263
- /**
264
- * Override the API key collection.
265
- * This allows you to add fields to the API key collection or modify the collection in any way you want.
266
- * @param collection - The API key collection.
267
- * @returns The modified API key collection.
268
- */
269
175
  overrideApiKeyCollection?: (collection: CollectionConfig) => CollectionConfig;
270
- /**
271
- * Override the authentication method.
272
- * This allows you to use a custom authentication method instead of the default API key authentication.
273
- * @param req - The request object.
274
- * @returns The MCP access settings.
275
- */
276
- overrideAuth?: (req: PayloadRequest, getDefaultMcpAccessSettings: (overrideApiKey?: null | string) => Promise<MCPAccessSettings>) => MCPAccessSettings | Promise<MCPAccessSettings>;
277
- /**
278
- * Set the users collection that API keys should be associated with.
279
- */
176
+ /** Replace the default API-key auth with a custom resolver. */
177
+ overrideAuth?: (args: {
178
+ getAPIKeyDoc: (overrideApiKey?: string) => Promise<MCPAPIKeysDoc>;
179
+ getAuthorizedMCP: (args: {
180
+ apiKeyDoc: MCPAPIKeysDoc;
181
+ }) => AuthorizedMCP;
182
+ pluginConfig: SanitizedMCPPluginConfig;
183
+ req: PayloadRequest;
184
+ }) => MaybePromise<AuthorizedMCP>;
185
+ prompts?: Record<string, Prompt>;
186
+ resources?: Record<string, Resource>;
187
+ /** Cross-cutting tools (not scoped to any collection or global). */
188
+ tools?: MCPTopLevelToolsMap;
280
189
  userCollection?: CollectionSlug;
281
190
  };
282
- /**
283
- * MCP Handler options.
284
- */
285
- export type MCPHandlerOptions = {
286
- /**
287
- * Set the base path of the MCP handler. This is the path that will be used to access the MCP handler.
288
- * @default /api
289
- */
290
- basePath?: string;
291
- /**
292
- * If true, disables the SSE endpoint. Only Streamable HTTP will be available.
293
- * @default true
294
- */
295
- disableSse?: boolean;
296
- /**
297
- * Set the maximum duration of the MCP handler. This is the maximum duration that the MCP handler will run for.
298
- * @default 60
299
- */
300
- maxDuration?: number;
301
- /**
302
- * Callback function that receives MCP events.
303
- * This can be used to track analytics, debug issues, or implement custom behaviors.
304
- */
305
- onEvent?: (event: unknown) => void;
306
- /**
307
- * Set the Redis URL for the MCP handler. This is the URL that will be used to access the Redis server.
308
- * @default process.env.REDIS_URL
309
- */
310
- redisUrl?: string;
311
- /**
312
- * Set verbose logging.
313
- * @default false
314
- */
315
- verboseLogs?: boolean;
191
+ export type SanitizedMCPPluginConfig = {
192
+ items: MCPItem[];
193
+ userCollection: CollectionSlug;
194
+ } & Pick<MCPPluginConfig, 'disabled' | 'mcp' | 'overrideApiKeyCollection' | 'overrideAuth'>;
195
+ export type MCPServerOptions = {
196
+ options?: ConstructorParameters<typeof McpServer>[1];
197
+ serverInfo?: Partial<ConstructorParameters<typeof McpServer>[0]>;
316
198
  };
317
199
  /**
318
- * MCP Server options.
200
+ * Nested access tree as stored in the collection.
201
+ * A `false` leaf disables that tool; missing keys defer to
202
+ * defaults (built-in CRUD is on, opt-in tools are off).
319
203
  */
320
- export type MCPServerOptions = {
321
- /**
322
- * Optional instructions describing how to use the server and its features.
323
- */
324
- instructions?: string;
325
- /**
326
- * Set the server info of the MCP server.
327
- */
328
- serverInfo?: {
329
- /**
330
- * Set the name of the MCP server.
331
- * @default 'Payload MCP Server'
332
- */
333
- name: string;
334
- /**
335
- * Set the version of the MCP server.
336
- * @default '1.0.0'
337
- */
338
- version: string;
339
- };
340
- };
341
- export type MCPAccessSettings = {
342
- auth?: {
343
- auth?: boolean;
344
- forgotPassword?: boolean;
345
- login?: boolean;
346
- resetPassword?: boolean;
347
- unlock?: boolean;
348
- verify?: boolean;
349
- };
204
+ export type MCPAPIKeysDocAccessTree = {
350
205
  collections?: {
351
- create?: boolean;
352
- delete?: boolean;
353
- find?: boolean;
354
- update?: boolean;
355
- };
356
- config?: {
357
- find?: boolean;
358
- update?: boolean;
206
+ [CollectionSlug: CollectionSlug]: {
207
+ [ToolKey: string]: boolean;
208
+ };
359
209
  };
360
- custom?: Record<string, boolean>;
361
210
  globals?: {
362
- find?: boolean;
363
- update?: boolean;
364
- };
365
- jobs?: {
366
- create?: boolean;
367
- run?: boolean;
368
- update?: boolean;
369
- };
370
- 'payload-mcp-prompt'?: Record<string, boolean>;
371
- 'payload-mcp-resource'?: Record<string, boolean>;
372
- 'payload-mcp-tool'?: Record<string, boolean>;
373
- user: TypedUser;
374
- } & Record<string, unknown>;
375
- export type EntityConfig = MCPPluginConfig['collections'] | MCPPluginConfig['globals'];
376
- export type FieldDefinition = {
377
- description?: string;
378
- name: string;
379
- options?: {
380
- label: string;
381
- value: string;
382
- }[];
383
- position?: 'main' | 'sidebar';
384
- required?: boolean;
385
- type: string;
386
- };
387
- export type FieldModification = {
388
- changes: {
389
- description?: string;
390
- options?: {
391
- label: string;
392
- value: string;
393
- }[];
394
- position?: 'main' | 'sidebar';
395
- required?: boolean;
396
- type?: string;
211
+ [GlobalSlug: GlobalSlug]: {
212
+ [ToolKey: string]: boolean;
213
+ };
397
214
  };
398
- fieldName: string;
399
- };
400
- export type CollectionConfigUpdates = {
401
- access?: {
402
- create?: string;
403
- delete?: string;
404
- read?: string;
405
- update?: string;
215
+ prompts?: {
216
+ [PromptKey: string]: boolean;
406
217
  };
407
- description?: string;
408
- slug?: string;
409
- timestamps?: boolean;
410
- versioning?: boolean;
411
- };
412
- export type AdminConfig = {
413
- avatar?: string;
414
- css?: string;
415
- dateFormat?: string;
416
- inactivityRoute?: string;
417
- livePreview?: {
418
- breakpoints?: Array<{
419
- height: number;
420
- label: string;
421
- name: string;
422
- width: number;
423
- }>;
218
+ resources?: {
219
+ [ResourceKey: string]: boolean;
424
220
  };
425
- logoutRoute?: string;
426
- meta?: {
427
- favicon?: string;
428
- ogImage?: string;
429
- titleSuffix?: string;
221
+ tools?: {
222
+ [ToolKey: string]: boolean;
430
223
  };
431
- user?: string;
432
224
  };
433
- export type DatabaseConfig = {
434
- connectOptions?: string;
435
- type?: 'mongodb' | 'postgres';
436
- url?: string;
225
+ /**
226
+ * Stored on `payload-mcp-api-keys` docs
227
+ */
228
+ export type MCPAPIKeysDoc = {
229
+ access: MCPAPIKeysDocAccessTree;
230
+ id: DefaultDocumentIDType;
231
+ overrideAccess?: boolean;
232
+ user: null | TypedUser;
437
233
  };
438
- export type PluginUpdates = {
439
- add?: string[];
440
- remove?: string[];
234
+ /**
235
+ * One MCP primitive plus the metadata needed for access checks, admin UI, and
236
+ * registration.
237
+ *
238
+ * - `configKey`: the config/API-key identifier, e.g. `find` or `echo`.
239
+ * - `mcpName`: the MCP wire name, e.g. `findDocuments` or `echo`.
240
+ * - `label`: human-readable admin checkbox text.
241
+ */
242
+ export type MCPItemBase = {
243
+ configKey: string;
244
+ label: string;
245
+ mcpName: string;
441
246
  };
442
- export type GeneralConfig = {
443
- cookiePrefix?: string;
444
- cors?: string;
445
- csrf?: string;
446
- graphQL?: {
447
- disable?: boolean;
448
- schemaOutputFile?: string;
449
- };
450
- rateLimit?: {
451
- max?: number;
452
- skip?: string;
453
- window?: number;
454
- };
455
- secret?: string;
456
- serverURL?: string;
457
- typescript?: {
458
- declare?: boolean;
459
- outputFile?: string;
460
- };
247
+ export type CollectionMCPItem = {
248
+ collectionSlug: CollectionSlug;
249
+ tool: CollectionTool;
250
+ type: 'collectionTool';
251
+ } & MCPItemBase;
252
+ export type GlobalMCPItem = {
253
+ globalSlug: GlobalSlug;
254
+ tool: GlobalTool;
255
+ type: 'globalTool';
256
+ } & MCPItemBase;
257
+ export type MCPItem = ({
258
+ prompt: Prompt;
259
+ type: 'prompt';
260
+ } & MCPItemBase) | ({
261
+ resource: Resource;
262
+ type: 'resource';
263
+ } & MCPItemBase) | ({
264
+ tool: Tool;
265
+ type: 'tool';
266
+ } & MCPItemBase) | CollectionMCPItem | GlobalMCPItem;
267
+ /**
268
+ * The caller's identity + the MCP items they can use for this request. Returned
269
+ * by `getAuthorizedMCP`; denied items are simply absent from `items`. Handlers
270
+ * receive this via `args.authorizedMCP` so they can spread
271
+ * `localAPIDefaults(authorizedMCP)` into every local API call.
272
+ */
273
+ export type AuthorizedMCP = {
274
+ items: MCPItem[];
275
+ overrideAccess: boolean;
276
+ user: null | TypedUser;
461
277
  };
462
- export interface SchemaField {
463
- description?: string;
464
- name: string;
465
- options?: string[];
466
- required?: boolean;
467
- type: string;
468
- }
469
- export interface TaskSequenceItem {
470
- description?: string;
471
- retries?: number;
472
- taskId: string;
473
- taskSlug: string;
474
- timeout?: number;
475
- }
476
- export interface JobConfigUpdate {
477
- description?: string;
478
- queue?: string;
479
- retries?: number;
480
- timeout?: number;
481
- }
482
278
  //# sourceMappingURL=types.d.ts.map