@payloadcms/plugin-mcp 3.70.0-canary.9 → 3.71.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collections/createApiKeysCollection.d.ts +1 -1
- package/dist/collections/createApiKeysCollection.d.ts.map +1 -1
- package/dist/collections/createApiKeysCollection.js +10 -75
- package/dist/collections/createApiKeysCollection.js.map +1 -1
- package/dist/endpoints/mcp.d.ts.map +1 -1
- package/dist/endpoints/mcp.js +1 -0
- package/dist/endpoints/mcp.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/getMcpHandler.d.ts.map +1 -1
- package/dist/mcp/getMcpHandler.js +24 -10
- package/dist/mcp/getMcpHandler.js.map +1 -1
- package/dist/mcp/tools/global/find.d.ts +5 -0
- package/dist/mcp/tools/global/find.d.ts.map +1 -0
- package/dist/mcp/tools/global/find.js +59 -0
- package/dist/mcp/tools/global/find.js.map +1 -0
- package/dist/mcp/tools/global/update.d.ts +6 -0
- package/dist/mcp/tools/global/update.d.ts.map +1 -0
- package/dist/mcp/tools/global/update.js +97 -0
- package/dist/mcp/tools/global/update.js.map +1 -0
- package/dist/mcp/tools/resource/find.d.ts.map +1 -1
- package/dist/mcp/tools/resource/find.js +9 -3
- package/dist/mcp/tools/resource/find.js.map +1 -1
- package/dist/mcp/tools/schemas.d.ts +58 -17
- package/dist/mcp/tools/schemas.d.ts.map +1 -1
- package/dist/mcp/tools/schemas.js +19 -0
- package/dist/mcp/tools/schemas.js.map +1 -1
- package/dist/types.d.ts +40 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/adminEntitySettings.d.ts +17 -0
- package/dist/utils/adminEntitySettings.d.ts.map +1 -0
- package/dist/utils/adminEntitySettings.js +41 -0
- package/dist/utils/adminEntitySettings.js.map +1 -0
- package/dist/utils/createApiKeyFields.d.ts +15 -0
- package/dist/utils/createApiKeyFields.d.ts.map +1 -0
- package/dist/utils/createApiKeyFields.js +57 -0
- package/dist/utils/createApiKeyFields.js.map +1 -0
- package/dist/utils/getEnabledSlugs.d.ts +13 -0
- package/dist/utils/getEnabledSlugs.d.ts.map +1 -0
- package/dist/utils/getEnabledSlugs.js +32 -0
- package/dist/utils/getEnabledSlugs.js.map +1 -0
- package/package.json +5 -5
- package/src/collections/createApiKeysCollection.ts +11 -111
- package/src/endpoints/mcp.ts +1 -0
- package/src/index.ts +4 -0
- package/src/mcp/getMcpHandler.ts +62 -26
- package/src/mcp/tools/global/find.ts +104 -0
- package/src/mcp/tools/global/update.ts +168 -0
- package/src/mcp/tools/resource/find.ts +5 -2
- package/src/mcp/tools/schemas.ts +56 -0
- package/src/types.ts +59 -1
- package/src/utils/adminEntitySettings.ts +40 -0
- package/src/utils/createApiKeyFields.ts +72 -0
- package/src/utils/getEnabledSlugs.ts +42 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/mcp/tools/schemas.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const toolSchemas = {\n findResources: {\n description: 'Find documents in a collection by ID or where clause using Find or FindByID.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe(\n 'Optional: specific document ID to retrieve. If not provided, returns all documents',\n ),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n limit: z\n .number()\n .int()\n .min(1, 'Limit must be at least 1')\n .max(100, 'Limit cannot exceed 100')\n .optional()\n .default(10)\n .describe('Maximum number of documents to return (default: 10, max: 100)'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n page: z\n .number()\n .int()\n .min(1, 'Page must be at least 1')\n .optional()\n .default(1)\n .describe('Page number for pagination (default: 1)'),\n sort: z\n .string()\n .optional()\n .describe('Field to sort by (e.g., \"createdAt\", \"-updatedAt\" for descending)'),\n where: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string for where clause filtering (e.g., \\'{\"title\": {\"contains\": \"test\"}}\\')',\n ),\n }),\n },\n\n createResource: {\n description: 'Create a document in a collection.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data for the new document'),\n draft: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to create the document as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to create the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n }),\n },\n\n updateResource: {\n description: 'Update documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to update'),\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n filePath: z.string().optional().describe('Optional: absolute file path for file uploads'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n overrideLock: z\n .boolean()\n .optional()\n .default(true)\n .describe('Whether to override document locks'),\n overwriteExistingFiles: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to overwrite existing files'),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to update multiple documents'),\n }),\n },\n\n deleteResource: {\n description: 'Delete documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to delete'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships in response'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code for the operation (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to delete multiple documents'),\n }),\n },\n\n // Experimental Below This Line\n createCollection: {\n description: 'Creates a new collection with specified fields and configuration.',\n parameters: z.object({\n collectionDescription: z\n .string()\n .optional()\n .describe('Optional description for the collection'),\n collectionName: z.string().describe('The name of the collection to create'),\n fields: z.array(z.any()).describe('Array of field definitions for the collection'),\n hasUpload: z\n .boolean()\n .optional()\n .describe('Whether the collection should have upload capabilities'),\n }),\n },\n\n findCollections: {\n description: 'Finds and lists collections with optional content and document counts.',\n parameters: z.object({\n collectionName: z\n .string()\n .optional()\n .describe('Optional: specific collection name to retrieve'),\n includeContent: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include collection file content'),\n includeCount: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include document counts for each collection'),\n }),\n },\n\n updateCollection: {\n description:\n 'Updates an existing collection with new fields, modifications, or configuration changes.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to update'),\n configUpdates: z.any().optional().describe('Configuration updates (for update_config type)'),\n fieldModifications: z\n .array(z.any())\n .optional()\n .describe('Field modifications (for modify_field type)'),\n fieldNamesToRemove: z\n .array(z.string())\n .optional()\n .describe('Field names to remove (for remove_field type)'),\n newContent: z\n .string()\n .optional()\n .describe('New content to replace entire collection (for replace_content type)'),\n newFields: z.array(z.any()).optional().describe('New fields to add (for add_field type)'),\n updateType: z\n .enum(['add_field', 'remove_field', 'modify_field', 'update_config', 'replace_content'])\n .describe('Type of update to perform'),\n }),\n },\n\n deleteCollection: {\n description: 'Deletes a collection and optionally updates the configuration.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to delete'),\n confirmDeletion: z.boolean().describe('Confirmation flag to prevent accidental deletion'),\n updateConfig: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to update payload.config.ts to remove collection reference'),\n }),\n },\n\n findConfig: {\n description: 'Reads and displays the current configuration file.',\n parameters: z.object({\n includeMetadata: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include file metadata (size, modified date, etc.)'),\n }),\n },\n\n updateConfig: {\n description: 'Updates the configuration file with various modifications.',\n parameters: z.object({\n adminConfig: z\n .any()\n .optional()\n .describe('Admin configuration updates (for update_admin type)'),\n collectionName: z\n .string()\n .optional()\n .describe('Collection name (required for add_collection and remove_collection)'),\n databaseConfig: z\n .any()\n .optional()\n .describe('Database configuration updates (for update_database type)'),\n generalConfig: z.any().optional().describe('General configuration updates'),\n newContent: z\n .string()\n .optional()\n .describe('New configuration content (for replace_content type)'),\n pluginUpdates: z\n .any()\n .optional()\n .describe('Plugin configuration updates (for update_plugins type)'),\n updateType: z\n .enum([\n 'add_collection',\n 'remove_collection',\n 'update_admin',\n 'update_database',\n 'update_plugins',\n 'replace_content',\n ])\n .describe('Type of configuration update to perform'),\n }),\n },\n\n auth: {\n description: 'Checks authentication status for the current user.',\n parameters: z.object({\n headers: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string containing custom headers to send with the authentication request',\n ),\n }),\n },\n\n login: {\n description: 'Authenticates a user with email and password.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n email: z.string().email().describe('The user email address'),\n overrideAccess: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to override access controls'),\n password: z.string().describe('The user password'),\n showHiddenFields: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to show hidden fields in the response'),\n }),\n },\n\n verify: {\n description: 'Verifies a user email with a verification token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n token: z.string().describe('The verification token sent to the user email'),\n }),\n },\n\n resetPassword: {\n description: 'Resets a user password with a reset token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n password: z.string().describe('The new password for the user'),\n token: z.string().describe('The password reset token sent to the user email'),\n }),\n },\n\n forgotPassword: {\n description: 'Sends a password reset email to a user.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n disableEmail: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to disable sending the email (for testing)'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n unlock: {\n description: 'Unlocks a user account that has been locked due to failed login attempts.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n createJob: {\n description: 'Creates a new job (task or workflow) with specified configuration.',\n parameters: z.object({\n description: z.string().describe('Description of what the job does'),\n inputSchema: z.record(z.any()).optional().default({}).describe('Input schema for the job'),\n jobData: z\n .record(z.any())\n .optional()\n .default({})\n .describe('Additional job configuration data'),\n jobName: z\n .string()\n .min(1, 'Job name cannot be empty')\n .regex(/^[a-z][\\w-]*$/i, 'Job name must be alphanumeric and can contain underscores/dashes')\n .describe('The name of the job to create'),\n jobSlug: z\n .string()\n .min(1, 'Job slug cannot be empty')\n .regex(/^[a-z][a-z0-9-]*$/, 'Job slug must be kebab-case')\n .describe('The slug for the job (kebab-case format)'),\n jobType: z\n .enum(['task', 'workflow'])\n .describe('Whether to create a task (individual unit) or workflow (orchestrates tasks)'),\n outputSchema: z.record(z.any()).optional().default({}).describe('Output schema for the job'),\n }),\n },\n\n updateJob: {\n description: 'Updates an existing job with new configuration, schema, or handler code.',\n parameters: z.object({\n configUpdate: z.record(z.any()).optional().describe('New configuration for the job'),\n handlerCode: z\n .string()\n .optional()\n .describe('New handler code to replace the existing handler'),\n inputSchema: z.record(z.any()).optional().describe('New input schema for the job'),\n jobSlug: z.string().describe('The slug of the job to update'),\n outputSchema: z.record(z.any()).optional().describe('New output schema for the job'),\n taskSequence: z.array(z.any()).optional().describe('New task sequence for workflows'),\n updateType: z\n .enum(['modify_schema', 'update_tasks', 'change_config', 'replace_handler'])\n .describe('Type of update to perform on the job'),\n }),\n },\n\n runJob: {\n description: 'Runs a job with specified input data and queue options.',\n parameters: z.object({\n delay: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Delay in milliseconds before job execution'),\n input: z.record(z.any()).describe('Input data for the job execution'),\n jobSlug: z.string().describe('The slug of the job to run'),\n priority: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe('Job priority (1-10, higher is more important)'),\n queue: z\n .string()\n .optional()\n .describe('Queue name to use for job execution (default: \"default\")'),\n }),\n },\n}\n"],"names":["z","toolSchemas","findResources","description","parameters","object","id","union","string","number","optional","describe","fallbackLocale","limit","int","min","max","default","locale","page","sort","where","createResource","data","draft","boolean","updateResource","depth","filePath","overrideLock","overwriteExistingFiles","deleteResource","createCollection","collectionDescription","collectionName","fields","array","any","hasUpload","findCollections","includeContent","includeCount","updateCollection","configUpdates","fieldModifications","fieldNamesToRemove","newContent","newFields","updateType","enum","deleteCollection","confirmDeletion","updateConfig","findConfig","includeMetadata","adminConfig","databaseConfig","generalConfig","pluginUpdates","auth","headers","login","collection","email","overrideAccess","password","showHiddenFields","verify","token","resetPassword","forgotPassword","disableEmail","unlock","createJob","inputSchema","record","jobData","jobName","regex","jobSlug","jobType","outputSchema","updateJob","configUpdate","handlerCode","taskSequence","runJob","delay","input","priority","queue"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAK;AAEvB,OAAO,MAAMC,cAAc;IACzBC,eAAe;QACbC,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBC,IAAIN,EACDO,KAAK,CAAC;gBAACP,EAAEQ,MAAM;gBAAIR,EAAES,MAAM;aAAG,EAC9BC,QAAQ,GACRC,QAAQ,CACP;YAEJC,gBAAgBZ,EACbQ,MAAM,GACNE,QAAQ,GACRC,QAAQ,CAAC;YACZE,OAAOb,EACJS,MAAM,GACNK,GAAG,GACHC,GAAG,CAAC,GAAG,4BACPC,GAAG,CAAC,K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,EAAE2E,MAAM,CAAC3E,EAAEqC,GAAG,IAAI1B,QAAQ,CAAC;YAClCoE,SAAS/E,EAAEQ,MAAM,GAAGG,QAAQ,CAAC;YAC7B8E,UAAUzF,EACPS,MAAM,GACNK,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJN,QAAQ,GACRC,QAAQ,CAAC;YACZ+E,OAAO1F,EACJQ,MAAM,GACNE,QAAQ,GACRC,QAAQ,CAAC;QACd;IACF;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/mcp/tools/schemas.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const toolSchemas = {\n findGlobal: {\n description: 'Find a Payload global singleton configuration.',\n parameters: z.object({\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n }),\n },\n\n findResources: {\n description: 'Find documents in a collection by ID or where clause using Find or FindByID.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe(\n 'Optional: specific document ID to retrieve. If not provided, returns all documents',\n ),\n draft: z\n .boolean()\n .optional()\n .describe(\n 'Optional: Whether the document should be queried from the versions table/collection or not.',\n ),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n limit: z\n .number()\n .int()\n .min(1, 'Limit must be at least 1')\n .max(100, 'Limit cannot exceed 100')\n .optional()\n .default(10)\n .describe('Maximum number of documents to return (default: 10, max: 100)'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n page: z\n .number()\n .int()\n .min(1, 'Page must be at least 1')\n .optional()\n .default(1)\n .describe('Page number for pagination (default: 1)'),\n sort: z\n .string()\n .optional()\n .describe('Field to sort by (e.g., \"createdAt\", \"-updatedAt\" for descending)'),\n where: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string for where clause filtering (e.g., \\'{\"title\": {\"contains\": \"test\"}}\\')',\n ),\n }),\n },\n\n createResource: {\n description: 'Create a document in a collection.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data for the new document'),\n draft: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to create the document as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to create the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n }),\n },\n\n updateResource: {\n description: 'Update documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to update'),\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n filePath: z.string().optional().describe('Optional: absolute file path for file uploads'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n overrideLock: z\n .boolean()\n .optional()\n .default(true)\n .describe('Whether to override document locks'),\n overwriteExistingFiles: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to overwrite existing files'),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to update multiple documents'),\n }),\n },\n\n deleteResource: {\n description: 'Delete documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to delete'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships in response'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code for the operation (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to delete multiple documents'),\n }),\n },\n\n updateGlobal: {\n description: 'Update a Payload global singleton configuration.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update data in (e.g., \"en\", \"es\"). Use \"all\" to update all locales for localized fields',\n ),\n }),\n },\n\n // Experimental Below This Line\n createCollection: {\n description: 'Creates a new collection with specified fields and configuration.',\n parameters: z.object({\n collectionDescription: z\n .string()\n .optional()\n .describe('Optional description for the collection'),\n collectionName: z.string().describe('The name of the collection to create'),\n fields: z.array(z.any()).describe('Array of field definitions for the collection'),\n hasUpload: z\n .boolean()\n .optional()\n .describe('Whether the collection should have upload capabilities'),\n }),\n },\n\n findCollections: {\n description: 'Finds and lists collections with optional content and document counts.',\n parameters: z.object({\n collectionName: z\n .string()\n .optional()\n .describe('Optional: specific collection name to retrieve'),\n includeContent: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include collection file content'),\n includeCount: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include document counts for each collection'),\n }),\n },\n\n updateCollection: {\n description:\n 'Updates an existing collection with new fields, modifications, or configuration changes.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to update'),\n configUpdates: z.any().optional().describe('Configuration updates (for update_config type)'),\n fieldModifications: z\n .array(z.any())\n .optional()\n .describe('Field modifications (for modify_field type)'),\n fieldNamesToRemove: z\n .array(z.string())\n .optional()\n .describe('Field names to remove (for remove_field type)'),\n newContent: z\n .string()\n .optional()\n .describe('New content to replace entire collection (for replace_content type)'),\n newFields: z.array(z.any()).optional().describe('New fields to add (for add_field type)'),\n updateType: z\n .enum(['add_field', 'remove_field', 'modify_field', 'update_config', 'replace_content'])\n .describe('Type of update to perform'),\n }),\n },\n\n deleteCollection: {\n description: 'Deletes a collection and optionally updates the configuration.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to delete'),\n confirmDeletion: z.boolean().describe('Confirmation flag to prevent accidental deletion'),\n updateConfig: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to update payload.config.ts to remove collection reference'),\n }),\n },\n\n findConfig: {\n description: 'Reads and displays the current configuration file.',\n parameters: z.object({\n includeMetadata: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include file metadata (size, modified date, etc.)'),\n }),\n },\n\n updateConfig: {\n description: 'Updates the configuration file with various modifications.',\n parameters: z.object({\n adminConfig: z\n .any()\n .optional()\n .describe('Admin configuration updates (for update_admin type)'),\n collectionName: z\n .string()\n .optional()\n .describe('Collection name (required for add_collection and remove_collection)'),\n databaseConfig: z\n .any()\n .optional()\n .describe('Database configuration updates (for update_database type)'),\n generalConfig: z.any().optional().describe('General configuration updates'),\n newContent: z\n .string()\n .optional()\n .describe('New configuration content (for replace_content type)'),\n pluginUpdates: z\n .any()\n .optional()\n .describe('Plugin configuration updates (for update_plugins type)'),\n updateType: z\n .enum([\n 'add_collection',\n 'remove_collection',\n 'update_admin',\n 'update_database',\n 'update_plugins',\n 'replace_content',\n ])\n .describe('Type of configuration update to perform'),\n }),\n },\n\n auth: {\n description: 'Checks authentication status for the current user.',\n parameters: z.object({\n headers: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string containing custom headers to send with the authentication request',\n ),\n }),\n },\n\n login: {\n description: 'Authenticates a user with email and password.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n email: z.string().email().describe('The user email address'),\n overrideAccess: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to override access controls'),\n password: z.string().describe('The user password'),\n showHiddenFields: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to show hidden fields in the response'),\n }),\n },\n\n verify: {\n description: 'Verifies a user email with a verification token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n token: z.string().describe('The verification token sent to the user email'),\n }),\n },\n\n resetPassword: {\n description: 'Resets a user password with a reset token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n password: z.string().describe('The new password for the user'),\n token: z.string().describe('The password reset token sent to the user email'),\n }),\n },\n\n forgotPassword: {\n description: 'Sends a password reset email to a user.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n disableEmail: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to disable sending the email (for testing)'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n unlock: {\n description: 'Unlocks a user account that has been locked due to failed login attempts.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n createJob: {\n description: 'Creates a new job (task or workflow) with specified configuration.',\n parameters: z.object({\n description: z.string().describe('Description of what the job does'),\n inputSchema: z.record(z.any()).optional().default({}).describe('Input schema for the job'),\n jobData: z\n .record(z.any())\n .optional()\n .default({})\n .describe('Additional job configuration data'),\n jobName: z\n .string()\n .min(1, 'Job name cannot be empty')\n .regex(/^[a-z][\\w-]*$/i, 'Job name must be alphanumeric and can contain underscores/dashes')\n .describe('The name of the job to create'),\n jobSlug: z\n .string()\n .min(1, 'Job slug cannot be empty')\n .regex(/^[a-z][a-z0-9-]*$/, 'Job slug must be kebab-case')\n .describe('The slug for the job (kebab-case format)'),\n jobType: z\n .enum(['task', 'workflow'])\n .describe('Whether to create a task (individual unit) or workflow (orchestrates tasks)'),\n outputSchema: z.record(z.any()).optional().default({}).describe('Output schema for the job'),\n }),\n },\n\n updateJob: {\n description: 'Updates an existing job with new configuration, schema, or handler code.',\n parameters: z.object({\n configUpdate: z.record(z.any()).optional().describe('New configuration for the job'),\n handlerCode: z\n .string()\n .optional()\n .describe('New handler code to replace the existing handler'),\n inputSchema: z.record(z.any()).optional().describe('New input schema for the job'),\n jobSlug: z.string().describe('The slug of the job to update'),\n outputSchema: z.record(z.any()).optional().describe('New output schema for the job'),\n taskSequence: z.array(z.any()).optional().describe('New task sequence for workflows'),\n updateType: z\n .enum(['modify_schema', 'update_tasks', 'change_config', 'replace_handler'])\n .describe('Type of update to perform on the job'),\n }),\n },\n\n runJob: {\n description: 'Runs a job with specified input data and queue options.',\n parameters: z.object({\n delay: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Delay in milliseconds before job execution'),\n input: z.record(z.any()).describe('Input data for the job execution'),\n jobSlug: z.string().describe('The slug of the job to run'),\n priority: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe('Job priority (1-10, higher is more important)'),\n queue: z\n .string()\n .optional()\n .describe('Queue name to use for job execution (default: \"default\")'),\n }),\n },\n}\n"],"names":["z","toolSchemas","findGlobal","description","parameters","object","depth","number","int","min","max","optional","default","describe","fallbackLocale","string","locale","findResources","id","union","draft","boolean","limit","page","sort","where","createResource","data","updateResource","filePath","overrideLock","overwriteExistingFiles","deleteResource","updateGlobal","createCollection","collectionDescription","collectionName","fields","array","any","hasUpload","findCollections","includeContent","includeCount","updateCollection","configUpdates","fieldModifications","fieldNamesToRemove","newContent","newFields","updateType","enum","deleteCollection","confirmDeletion","updateConfig","findConfig","includeMetadata","adminConfig","databaseConfig","generalConfig","pluginUpdates","auth","headers","login","collection","email","overrideAccess","password","showHiddenFields","verify","token","resetPassword","forgotPassword","disableEmail","unlock","createJob","inputSchema","record","jobData","jobName","regex","jobSlug","jobType","outputSchema","updateJob","configUpdate","handlerCode","taskSequence","runJob","delay","input","priority","queue"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAK;AAEvB,OAAO,MAAMC,cAAc;IACzBC,YAAY;QACVC,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBC,OAAON,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRC,OAAO,CAAC,GACRC,QAAQ,CAAC;YACZC,gBAAgBd,EACbe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;YACZG,QAAQhB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;QAEN;IACF;IAEAI,eAAe;QACbd,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBa,IAAIlB,EACDmB,KAAK,CAAC;gBAACnB,EAAEe,MAAM;gBAAIf,EAAEO,MAAM;aAAG,EAC9BI,QAAQ,GACRE,QAAQ,CACP;YAEJO,OAAOpB,EACJqB,OAAO,GACPV,QAAQ,GACRE,QAAQ,CACP;YAEJC,gBAAgBd,EACbe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;YACZS,OAAOtB,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GAAG,4BACPC,GAAG,CAAC,KAAK,2BACTC,QAAQ,GACRC,OAAO,CAAC,IACRC,QAAQ,CAAC;YACZG,QAAQhB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;YAEJU,MAAMvB,EACHO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GAAG,2BACPE,QAAQ,GACRC,OAAO,CAAC,GACRC,QAAQ,CAAC;YACZW,MAAMxB,EACHe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;YACZY,OAAOzB,EACJe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;QAEN;IACF;IAEAa,gBAAgB;QACdvB,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CA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O1F,EAAE6E,MAAM,CAAC7E,EAAEuC,GAAG,IAAI1B,QAAQ,CAAC;YAClCoE,SAASjF,EAAEe,MAAM,GAAGF,QAAQ,CAAC;YAC7B8E,UAAU3F,EACPO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRE,QAAQ,CAAC;YACZ+E,OAAO5F,EACJe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;QACd;IACF;AACF,EAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollectionConfig, CollectionSlug, PayloadRequest, TypedUser } from 'payload';
|
|
1
|
+
import type { CollectionConfig, CollectionSlug, GlobalSlug, PayloadRequest, TypedUser } from 'payload';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import { type ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
4
|
export type PluginMCPServerConfig = {
|
|
@@ -101,6 +101,39 @@ export type PluginMCPServerConfig = {
|
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
103
|
};
|
|
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
|
+
}>>;
|
|
104
137
|
/**
|
|
105
138
|
* MCP Server options.
|
|
106
139
|
*/
|
|
@@ -310,6 +343,11 @@ export type MCPAccessSettings = {
|
|
|
310
343
|
find?: boolean;
|
|
311
344
|
update?: boolean;
|
|
312
345
|
};
|
|
346
|
+
custom?: Record<string, boolean>;
|
|
347
|
+
globals?: {
|
|
348
|
+
find?: boolean;
|
|
349
|
+
update?: boolean;
|
|
350
|
+
};
|
|
313
351
|
jobs?: {
|
|
314
352
|
create?: boolean;
|
|
315
353
|
run?: boolean;
|
|
@@ -320,6 +358,7 @@ export type MCPAccessSettings = {
|
|
|
320
358
|
'payload-mcp-tool'?: Record<string, boolean>;
|
|
321
359
|
user: TypedUser;
|
|
322
360
|
} & Record<string, unknown>;
|
|
361
|
+
export type EntityConfig = PluginMCPServerConfig['collections'] | PluginMCPServerConfig['globals'];
|
|
323
362
|
export type FieldDefinition = {
|
|
324
363
|
description?: string;
|
|
325
364
|
name: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACV,MAAM,SAAS,CAAA;AAChB,OAAO,KA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AM,CAAA;QACb,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE;QACX,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionConfig, CollectionSlug, PayloadRequest, TypedUser } from 'payload'\nimport type { z } from 'zod'\n\nimport { type ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'\n\nexport type PluginMCPServerConfig = {\n /**\n * Set the collections that should be available as resources via MCP.\n */\n collections?: Partial<\n Record<\n CollectionSlug,\n {\n /**\n * Set the description of the collection. This is used by MCP clients to determine when to use the collecton as a resource.\n */\n description?: string\n /**\n * Set the enabled capabilities of the collection. Admins can then allow or disallow the use of the capability by MCP clients.\n */\n enabled:\n | {\n create?: boolean\n delete?: boolean\n find?: boolean\n update?: boolean\n }\n | boolean\n\n /**\n * 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.\n */\n overrideResponse?: (\n response: {\n content: Array<{\n text: string\n type: string\n }>\n },\n doc: Record<string, unknown>,\n req: PayloadRequest,\n ) => {\n content: Array<{\n text: string\n type: string\n }>\n }\n }\n >\n >\n /**\n * Disable the MCP plugin.\n */\n disabled?: boolean\n /**\n * Experimental features\n * **These features are for experimental purposes -- They are Disabled in Production by Default**\n */\n experimental?: {\n /**\n * These are MCP tools that can be used by a client to modify Payload.\n */\n tools: {\n /**\n * **Experimental** -- Auth MCP tools allow a client to change authentication priviliages for users. This is for developing ideas that help Admins with authentication tasks.\n */\n auth?: {\n /**\n * Enable the auth MCP tools. This allows Admins to enable or disable the auth capabilities.\n * @default false\n */\n enabled: boolean\n }\n /**\n * **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.\n */\n collections?: {\n /**\n * Set the directory path to the collections directory. This can be a directory outside of your default directory, or another Payload project.\n */\n collectionsDirPath: string\n /**\n * Enable the collection MCP tools. This allows Admins to enable or disable the Collection modification capabilities.\n * @default false\n */\n enabled: boolean\n }\n /**\n * **Experimental** -- Config MCP tools allow for the modification of a Payload Config. This is for developing ideas that help Developers with config tasks.\n */\n config?: {\n /**\n * Set the directory path to the config directory. This can be a directory outside of your default directory, or another Payload project.\n */\n configFilePath: string\n /**\n * Enable the config MCP tools. This allows Admins to enable or disable the Payload Config modification capabilities.\n * @default false\n */\n enabled: boolean\n }\n /**\n * **Experimental** -- Jobs MCP tools allow for the modification of Payload jobs. This is for developing ideas that help Developers with job tasks.\n */\n jobs?: {\n /**\n * Enable the jobs MCP tools. This allows Admins to enable or disable the Job modification capabilities.\n * @default false\n */\n enabled: boolean\n /**\n * Set the directory path to the jobs directory. This can be a directory outside of your default directory, or another Payload project.\n */\n jobsDirPath: string\n }\n }\n }\n /**\n * MCP Server options.\n */\n mcp?: {\n handlerOptions?: MCPHandlerOptions\n /**\n * Add custom MCP Prompts.\n */\n prompts?: {\n /**\n * 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.\n */\n argsSchema: z.ZodRawShape\n /**\n * Set the description of the prompt. This is used by MCP clients to determine when to use the prompt.\n */\n description: string\n /**\n * Set the handler of the prompt. This is the function that will be called when the prompt is used.\n */\n handler: (\n args: Record<string, unknown>,\n req: PayloadRequest,\n _extra: unknown,\n ) =>\n | {\n messages: Array<{\n content: {\n text: string\n type: 'text'\n }\n role: 'assistant' | 'user'\n }>\n }\n | Promise<{\n messages: Array<{\n content: {\n text: string\n type: 'text'\n }\n role: 'assistant' | 'user'\n }>\n }>\n /**\n * Set the function name of the prompt.\n */\n name: string\n /**\n * Set the title of the prompt. LLMs will interperate the title to determine when to use the prompt.\n */\n title: string\n }[]\n\n /**\n * Add custom MCP Resource.\n */\n resources?: {\n /**\n * Set the description of the resource. This is used by MCP clients to determine when to use the resource.\n * example: 'Data is a resource that contains special data.'\n */\n description: string\n /**\n * Set the handler of the resource. This is the function that will be called when the resource is used.\n * The handler can have either 3 arguments (when no args are passed) or 4 arguments (when args are passed).\n */\n handler: (...args: any[]) =>\n | {\n contents: Array<{\n text: string\n uri: string\n }>\n }\n | Promise<{\n contents: Array<{\n text: string\n uri: string\n }>\n }>\n /**\n * Set the mime type of the resource.\n * example: 'text/plain'\n */\n mimeType: string\n /**\n * Set the function name of the resource.\n * example: 'data'\n */\n name: string\n /**\n * Set the title of the resource. LLMs will interperate the title to determine when to use the resource.\n * example: 'Data'\n */\n title: string\n /**\n * Set the uri of the resource.\n * example: 'data://app'\n */\n uri: ResourceTemplate | string\n }[]\n serverOptions?: MCPServerOptions\n /**\n * Add custom MCP Tools.\n */\n tools?: {\n /**\n * Set the description of the tool. This is used by MCP clients to determine when to use the tool.\n */\n description: string\n /**\n * Set the handler of the tool. This is the function that will be called when the tool is used.\n */\n handler: (\n args: Record<string, unknown>,\n req: PayloadRequest,\n _extra: unknown,\n ) =>\n | {\n content: Array<{\n text: string\n type: 'text'\n }>\n role?: string\n }\n | Promise<{\n content: Array<{\n text: string\n type: 'text'\n }>\n role?: string\n }>\n /**\n * 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.\n */\n name: string\n /**\n * Set the parameters of the tool. This is the parameters that will be passed to the tool.\n */\n parameters: z.ZodRawShape\n }[]\n }\n\n /**\n * Override the API key collection.\n * This allows you to add fields to the API key collection or modify the collection in any way you want.\n * @param collection - The API key collection.\n * @returns The modified API key collection.\n */\n overrideApiKeyCollection?: (collection: CollectionConfig) => CollectionConfig\n\n /**\n * Override the authentication method.\n * This allows you to use a custom authentication method instead of the default API key authentication.\n * @param req - The request object.\n * @returns The MCP access settings.\n */\n overrideAuth?: (\n req: PayloadRequest,\n getDefaultMcpAccessSettings: (overrideApiKey?: null | string) => Promise<MCPAccessSettings>,\n ) => MCPAccessSettings | Promise<MCPAccessSettings>\n\n /**\n * Set the users collection that API keys should be associated with.\n */\n userCollection?: CollectionConfig | string\n}\n\n/**\n * MCP Handler options.\n */\nexport type MCPHandlerOptions = {\n /**\n * Set the base path of the MCP handler. This is the path that will be used to access the MCP handler.\n * @default /api\n */\n basePath?: string\n /**\n * Set the maximum duration of the MCP handler. This is the maximum duration that the MCP handler will run for.\n * @default 60\n */\n maxDuration?: number\n /**\n * Set the Redis URL for the MCP handler. This is the URL that will be used to access the Redis server.\n * @default process.env.REDIS_URL\n * INFO: Disabled until developer clarity is reached for server side streaming and we have an auth pattern for all SSE patterns\n */\n // redisUrl?: string\n /**\n * Set verbose logging.\n * @default false\n */\n verboseLogs?: boolean\n}\n\n/**\n * MCP Server options.\n */\nexport type MCPServerOptions = {\n /**\n * Set the server info of the MCP server.\n */\n serverInfo?: {\n /**\n * Set the name of the MCP server.\n * @default 'Payload MCP Server'\n */\n name: string\n /**\n * Set the version of the MCP server.\n * @default '1.0.0'\n */\n version: string\n }\n}\n\nexport type MCPAccessSettings = {\n auth?: {\n auth?: boolean\n forgotPassword?: boolean\n login?: boolean\n resetPassword?: boolean\n unlock?: boolean\n verify?: boolean\n }\n collections?: {\n create?: boolean\n delete?: boolean\n find?: boolean\n update?: boolean\n }\n config?: {\n find?: boolean\n update?: boolean\n }\n jobs?: {\n create?: boolean\n run?: boolean\n update?: boolean\n }\n 'payload-mcp-prompt'?: Record<string, boolean>\n 'payload-mcp-resource'?: Record<string, boolean>\n 'payload-mcp-tool'?: Record<string, boolean>\n user: TypedUser\n} & Record<string, unknown>\n\nexport type FieldDefinition = {\n description?: string\n name: string\n options?: { label: string; value: string }[]\n position?: 'main' | 'sidebar'\n required?: boolean\n type: string\n}\n\nexport type FieldModification = {\n changes: {\n description?: string\n options?: { label: string; value: string }[]\n position?: 'main' | 'sidebar'\n required?: boolean\n type?: string\n }\n fieldName: string\n}\n\nexport type CollectionConfigUpdates = {\n access?: {\n create?: string\n delete?: string\n read?: string\n update?: string\n }\n description?: string\n slug?: string\n timestamps?: boolean\n versioning?: boolean\n}\n\nexport type AdminConfig = {\n avatar?: string\n css?: string\n dateFormat?: string\n inactivityRoute?: string\n livePreview?: {\n breakpoints?: Array<{\n height: number\n label: string\n name: string\n width: number\n }>\n }\n logoutRoute?: string\n meta?: {\n favicon?: string\n ogImage?: string\n titleSuffix?: string\n }\n user?: string\n}\n\nexport type DatabaseConfig = {\n connectOptions?: string\n type?: 'mongodb' | 'postgres'\n url?: string\n}\n\nexport type PluginUpdates = {\n add?: string[]\n remove?: string[]\n}\n\nexport type GeneralConfig = {\n cookiePrefix?: string\n cors?: string\n csrf?: string\n graphQL?: {\n disable?: boolean\n schemaOutputFile?: string\n }\n rateLimit?: {\n max?: number\n skip?: string\n window?: number\n }\n secret?: string\n serverURL?: string\n typescript?: {\n declare?: boolean\n outputFile?: string\n }\n}\n\nexport interface SchemaField {\n description?: string\n name: string\n options?: string[]\n required?: boolean\n type: string\n}\n\nexport interface TaskSequenceItem {\n description?: string\n retries?: number\n taskId: string\n taskSlug: string\n timeout?: number\n}\n\nexport interface JobConfigUpdate {\n description?: string\n queue?: string\n retries?: number\n timeout?: number\n}\n"],"names":[],"mappings":"AAidA,WAKC"}
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n CollectionConfig,\n CollectionSlug,\n GlobalSlug,\n PayloadRequest,\n TypedUser,\n} from 'payload'\nimport type { z } from 'zod'\n\nimport { type ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'\n\nexport type PluginMCPServerConfig = {\n /**\n * Set the collections that should be available as resources via MCP.\n */\n collections?: Partial<\n Record<\n CollectionSlug,\n {\n /**\n * Set the description of the collection. This is used by MCP clients to determine when to use the collecton as a resource.\n */\n description?: string\n /**\n * Set the enabled capabilities of the collection. Admins can then allow or disallow the use of the capability by MCP clients.\n */\n enabled:\n | {\n create?: boolean\n delete?: boolean\n find?: boolean\n update?: boolean\n }\n | boolean\n\n /**\n * 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.\n */\n overrideResponse?: (\n response: {\n content: Array<{\n text: string\n type: string\n }>\n },\n doc: Record<string, unknown>,\n req: PayloadRequest,\n ) => {\n content: Array<{\n text: string\n type: string\n }>\n }\n }\n >\n >\n /**\n * Disable the MCP plugin.\n */\n disabled?: boolean\n /**\n * Experimental features\n * **These features are for experimental purposes -- They are Disabled in Production by Default**\n */\n experimental?: {\n /**\n * These are MCP tools that can be used by a client to modify Payload.\n */\n tools: {\n /**\n * **Experimental** -- Auth MCP tools allow a client to change authentication priviliages for users. This is for developing ideas that help Admins with authentication tasks.\n */\n auth?: {\n /**\n * Enable the auth MCP tools. This allows Admins to enable or disable the auth capabilities.\n * @default false\n */\n enabled: boolean\n }\n /**\n * **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.\n */\n collections?: {\n /**\n * Set the directory path to the collections directory. This can be a directory outside of your default directory, or another Payload project.\n */\n collectionsDirPath: string\n /**\n * Enable the collection MCP tools. This allows Admins to enable or disable the Collection modification capabilities.\n * @default false\n */\n enabled: boolean\n }\n /**\n * **Experimental** -- Config MCP tools allow for the modification of a Payload Config. This is for developing ideas that help Developers with config tasks.\n */\n config?: {\n /**\n * Set the directory path to the config directory. This can be a directory outside of your default directory, or another Payload project.\n */\n configFilePath: string\n /**\n * Enable the config MCP tools. This allows Admins to enable or disable the Payload Config modification capabilities.\n * @default false\n */\n enabled: boolean\n }\n /**\n * **Experimental** -- Jobs MCP tools allow for the modification of Payload jobs. This is for developing ideas that help Developers with job tasks.\n */\n jobs?: {\n /**\n * Enable the jobs MCP tools. This allows Admins to enable or disable the Job modification capabilities.\n * @default false\n */\n enabled: boolean\n /**\n * Set the directory path to the jobs directory. This can be a directory outside of your default directory, or another Payload project.\n */\n jobsDirPath: string\n }\n }\n }\n /**\n * Set the globals that should be available as resources via MCP.\n * Globals are singleton configuration objects (e.g., site settings, navigation).\n * Note: Globals only support find and update operations.\n */\n globals?: Partial<\n Record<\n GlobalSlug,\n {\n /**\n * Set the description of the global. This is used by MCP clients to determine when to use the global as a resource.\n */\n description?: string\n /**\n * Set the enabled capabilities of the global. Admins can then allow or disallow the use of the capability by MCP clients.\n * Note: Globals only support find and update operations as they are singletons.\n */\n enabled:\n | {\n find?: boolean\n update?: boolean\n }\n | boolean\n\n /**\n * 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.\n */\n overrideResponse?: (\n response: {\n content: Array<{\n text: string\n type: string\n }>\n },\n doc: Record<string, unknown>,\n req: PayloadRequest,\n ) => {\n content: Array<{\n text: string\n type: string\n }>\n }\n }\n >\n >\n /**\n * MCP Server options.\n */\n mcp?: {\n handlerOptions?: MCPHandlerOptions\n /**\n * Add custom MCP Prompts.\n */\n prompts?: {\n /**\n * 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.\n */\n argsSchema: z.ZodRawShape\n /**\n * Set the description of the prompt. This is used by MCP clients to determine when to use the prompt.\n */\n description: string\n /**\n * Set the handler of the prompt. This is the function that will be called when the prompt is used.\n */\n handler: (\n args: Record<string, unknown>,\n req: PayloadRequest,\n _extra: unknown,\n ) =>\n | {\n messages: Array<{\n content: {\n text: string\n type: 'text'\n }\n role: 'assistant' | 'user'\n }>\n }\n | Promise<{\n messages: Array<{\n content: {\n text: string\n type: 'text'\n }\n role: 'assistant' | 'user'\n }>\n }>\n /**\n * Set the function name of the prompt.\n */\n name: string\n /**\n * Set the title of the prompt. LLMs will interperate the title to determine when to use the prompt.\n */\n title: string\n }[]\n\n /**\n * Add custom MCP Resource.\n */\n resources?: {\n /**\n * Set the description of the resource. This is used by MCP clients to determine when to use the resource.\n * example: 'Data is a resource that contains special data.'\n */\n description: string\n /**\n * Set the handler of the resource. This is the function that will be called when the resource is used.\n * The handler can have either 3 arguments (when no args are passed) or 4 arguments (when args are passed).\n */\n handler: (...args: any[]) =>\n | {\n contents: Array<{\n text: string\n uri: string\n }>\n }\n | Promise<{\n contents: Array<{\n text: string\n uri: string\n }>\n }>\n /**\n * Set the mime type of the resource.\n * example: 'text/plain'\n */\n mimeType: string\n /**\n * Set the function name of the resource.\n * example: 'data'\n */\n name: string\n /**\n * Set the title of the resource. LLMs will interperate the title to determine when to use the resource.\n * example: 'Data'\n */\n title: string\n /**\n * Set the uri of the resource.\n * example: 'data://app'\n */\n uri: ResourceTemplate | string\n }[]\n serverOptions?: MCPServerOptions\n /**\n * Add custom MCP Tools.\n */\n tools?: {\n /**\n * Set the description of the tool. This is used by MCP clients to determine when to use the tool.\n */\n description: string\n /**\n * Set the handler of the tool. This is the function that will be called when the tool is used.\n */\n handler: (\n args: Record<string, unknown>,\n req: PayloadRequest,\n _extra: unknown,\n ) =>\n | {\n content: Array<{\n text: string\n type: 'text'\n }>\n role?: string\n }\n | Promise<{\n content: Array<{\n text: string\n type: 'text'\n }>\n role?: string\n }>\n /**\n * 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.\n */\n name: string\n /**\n * Set the parameters of the tool. This is the parameters that will be passed to the tool.\n */\n parameters: z.ZodRawShape\n }[]\n }\n\n /**\n * Override the API key collection.\n * This allows you to add fields to the API key collection or modify the collection in any way you want.\n * @param collection - The API key collection.\n * @returns The modified API key collection.\n */\n overrideApiKeyCollection?: (collection: CollectionConfig) => CollectionConfig\n\n /**\n * Override the authentication method.\n * This allows you to use a custom authentication method instead of the default API key authentication.\n * @param req - The request object.\n * @returns The MCP access settings.\n */\n overrideAuth?: (\n req: PayloadRequest,\n getDefaultMcpAccessSettings: (overrideApiKey?: null | string) => Promise<MCPAccessSettings>,\n ) => MCPAccessSettings | Promise<MCPAccessSettings>\n\n /**\n * Set the users collection that API keys should be associated with.\n */\n userCollection?: CollectionConfig | string\n}\n\n/**\n * MCP Handler options.\n */\nexport type MCPHandlerOptions = {\n /**\n * Set the base path of the MCP handler. This is the path that will be used to access the MCP handler.\n * @default /api\n */\n basePath?: string\n /**\n * Set the maximum duration of the MCP handler. This is the maximum duration that the MCP handler will run for.\n * @default 60\n */\n maxDuration?: number\n /**\n * Set the Redis URL for the MCP handler. This is the URL that will be used to access the Redis server.\n * @default process.env.REDIS_URL\n * INFO: Disabled until developer clarity is reached for server side streaming and we have an auth pattern for all SSE patterns\n */\n // redisUrl?: string\n /**\n * Set verbose logging.\n * @default false\n */\n verboseLogs?: boolean\n}\n\n/**\n * MCP Server options.\n */\nexport type MCPServerOptions = {\n /**\n * Set the server info of the MCP server.\n */\n serverInfo?: {\n /**\n * Set the name of the MCP server.\n * @default 'Payload MCP Server'\n */\n name: string\n /**\n * Set the version of the MCP server.\n * @default '1.0.0'\n */\n version: string\n }\n}\n\nexport type MCPAccessSettings = {\n auth?: {\n auth?: boolean\n forgotPassword?: boolean\n login?: boolean\n resetPassword?: boolean\n unlock?: boolean\n verify?: boolean\n }\n collections?: {\n create?: boolean\n delete?: boolean\n find?: boolean\n update?: boolean\n }\n config?: {\n find?: boolean\n update?: boolean\n }\n custom?: Record<string, boolean>\n globals?: {\n find?: boolean\n update?: boolean\n }\n jobs?: {\n create?: boolean\n run?: boolean\n update?: boolean\n }\n 'payload-mcp-prompt'?: Record<string, boolean>\n 'payload-mcp-resource'?: Record<string, boolean>\n 'payload-mcp-tool'?: Record<string, boolean>\n user: TypedUser\n} & Record<string, unknown>\n\nexport type EntityConfig = PluginMCPServerConfig['collections'] | PluginMCPServerConfig['globals']\n\nexport type FieldDefinition = {\n description?: string\n name: string\n options?: { label: string; value: string }[]\n position?: 'main' | 'sidebar'\n required?: boolean\n type: string\n}\n\nexport type FieldModification = {\n changes: {\n description?: string\n options?: { label: string; value: string }[]\n position?: 'main' | 'sidebar'\n required?: boolean\n type?: string\n }\n fieldName: string\n}\n\nexport type CollectionConfigUpdates = {\n access?: {\n create?: string\n delete?: string\n read?: string\n update?: string\n }\n description?: string\n slug?: string\n timestamps?: boolean\n versioning?: boolean\n}\n\nexport type AdminConfig = {\n avatar?: string\n css?: string\n dateFormat?: string\n inactivityRoute?: string\n livePreview?: {\n breakpoints?: Array<{\n height: number\n label: string\n name: string\n width: number\n }>\n }\n logoutRoute?: string\n meta?: {\n favicon?: string\n ogImage?: string\n titleSuffix?: string\n }\n user?: string\n}\n\nexport type DatabaseConfig = {\n connectOptions?: string\n type?: 'mongodb' | 'postgres'\n url?: string\n}\n\nexport type PluginUpdates = {\n add?: string[]\n remove?: string[]\n}\n\nexport type GeneralConfig = {\n cookiePrefix?: string\n cors?: string\n csrf?: string\n graphQL?: {\n disable?: boolean\n schemaOutputFile?: string\n }\n rateLimit?: {\n max?: number\n skip?: string\n window?: number\n }\n secret?: string\n serverURL?: string\n typescript?: {\n declare?: boolean\n outputFile?: string\n }\n}\n\nexport interface SchemaField {\n description?: string\n name: string\n options?: string[]\n required?: boolean\n type: string\n}\n\nexport interface TaskSequenceItem {\n description?: string\n retries?: number\n taskId: string\n taskSlug: string\n timeout?: number\n}\n\nexport interface JobConfigUpdate {\n description?: string\n queue?: string\n retries?: number\n timeout?: number\n}\n"],"names":[],"mappings":"AA2gBA,WAKC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the default admin entity settings for Collections and Globals.
|
|
3
|
+
* This is used to create the MCP API key permission fields for the API Keys collection.
|
|
4
|
+
*/
|
|
5
|
+
export declare const adminEntitySettings: {
|
|
6
|
+
collection: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: (slug: string) => string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
global: {
|
|
12
|
+
name: string;
|
|
13
|
+
description: (slug: string) => string;
|
|
14
|
+
label: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=adminEntitySettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adminEntitySettings.d.ts","sourceRoot":"","sources":["../../src/utils/adminEntitySettings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;4BAIN,MAAM;;;;;4BAsBN,MAAM;;;CAS/B,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the default admin entity settings for Collections and Globals.
|
|
3
|
+
* This is used to create the MCP API key permission fields for the API Keys collection.
|
|
4
|
+
*/ export const adminEntitySettings = {
|
|
5
|
+
collection: [
|
|
6
|
+
{
|
|
7
|
+
name: 'find',
|
|
8
|
+
description: (slug)=>`Allow clients to find ${slug}.`,
|
|
9
|
+
label: 'Find'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'create',
|
|
13
|
+
description: (slug)=>`Allow clients to create ${slug}.`,
|
|
14
|
+
label: 'Create'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'update',
|
|
18
|
+
description: (slug)=>`Allow clients to update ${slug}.`,
|
|
19
|
+
label: 'Update'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'delete',
|
|
23
|
+
description: (slug)=>`Allow clients to delete ${slug}.`,
|
|
24
|
+
label: 'Delete'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
global: [
|
|
28
|
+
{
|
|
29
|
+
name: 'find',
|
|
30
|
+
description: (slug)=>`Allow clients to find ${slug} global.`,
|
|
31
|
+
label: 'Find'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'update',
|
|
35
|
+
description: (slug)=>`Allow clients to update ${slug} global.`,
|
|
36
|
+
label: 'Update'
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=adminEntitySettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/adminEntitySettings.ts"],"sourcesContent":["/**\n * Defines the default admin entity settings for Collections and Globals.\n * This is used to create the MCP API key permission fields for the API Keys collection.\n */\nexport const adminEntitySettings = {\n collection: [\n {\n name: 'find',\n description: (slug: string) => `Allow clients to find ${slug}.`,\n label: 'Find',\n },\n {\n name: 'create',\n description: (slug: string) => `Allow clients to create ${slug}.`,\n label: 'Create',\n },\n {\n name: 'update',\n description: (slug: string) => `Allow clients to update ${slug}.`,\n label: 'Update',\n },\n {\n name: 'delete',\n description: (slug: string) => `Allow clients to delete ${slug}.`,\n label: 'Delete',\n },\n ],\n global: [\n {\n name: 'find',\n description: (slug: string) => `Allow clients to find ${slug} global.`,\n label: 'Find',\n },\n {\n name: 'update',\n description: (slug: string) => `Allow clients to update ${slug} global.`,\n label: 'Update',\n },\n ],\n}\n"],"names":["adminEntitySettings","collection","name","description","slug","label","global"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,sBAAsB;IACjCC,YAAY;QACV;YACEC,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,sBAAsB,EAAEA,KAAK,CAAC,CAAC;YAC/DC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,CAAC,CAAC;YACjEC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,CAAC,CAAC;YACjEC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,CAAC,CAAC;YACjEC,OAAO;QACT;KACD;IACDC,QAAQ;QACN;YACEJ,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,sBAAsB,EAAEA,KAAK,QAAQ,CAAC;YACtEC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,QAAQ,CAAC;YACxEC,OAAO;QACT;KACD;AACH,EAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Field } from 'payload';
|
|
2
|
+
import type { EntityConfig } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates MCP API key permission fields using collections or globals.
|
|
5
|
+
* Generates collapsible field groups with checkboxes for each enabled operation.
|
|
6
|
+
*
|
|
7
|
+
* @param config - The collections or globals configuration object
|
|
8
|
+
* @param configType - The type of configuration ('collection' or 'global')
|
|
9
|
+
* @returns Array of fields for the MCP API Keys collection
|
|
10
|
+
*/
|
|
11
|
+
export declare const createApiKeyFields: ({ config, configType, }: {
|
|
12
|
+
config: EntityConfig | undefined;
|
|
13
|
+
configType: "collection" | "global";
|
|
14
|
+
}) => Field[];
|
|
15
|
+
//# sourceMappingURL=createApiKeyFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createApiKeyFields.d.ts","sourceRoot":"","sources":["../../src/utils/createApiKeyFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK/C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,4BAG5B;IACD,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC,UAAU,EAAE,YAAY,GAAG,QAAQ,CAAA;CACpC,KAAG,KAAK,EAkDR,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { adminEntitySettings } from './adminEntitySettings.js';
|
|
2
|
+
import { toCamelCase } from './camelCase.js';
|
|
3
|
+
import { getEnabledSlugs } from './getEnabledSlugs.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates MCP API key permission fields using collections or globals.
|
|
6
|
+
* Generates collapsible field groups with checkboxes for each enabled operation.
|
|
7
|
+
*
|
|
8
|
+
* @param config - The collections or globals configuration object
|
|
9
|
+
* @param configType - The type of configuration ('collection' or 'global')
|
|
10
|
+
* @returns Array of fields for the MCP API Keys collection
|
|
11
|
+
*/ export const createApiKeyFields = ({ config, configType })=>{
|
|
12
|
+
const operations = adminEntitySettings[configType];
|
|
13
|
+
const enabledSlugs = getEnabledSlugs(config, configType);
|
|
14
|
+
return enabledSlugs.map((slug)=>{
|
|
15
|
+
const entityConfig = config?.[slug];
|
|
16
|
+
const enabledOperations = operations.filter((operation)=>{
|
|
17
|
+
// If fully enabled, all operations are available
|
|
18
|
+
if (entityConfig?.enabled === true) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
// If partially enabled, check if this specific operation is enabled
|
|
22
|
+
const enabled = entityConfig?.enabled;
|
|
23
|
+
if (typeof enabled !== 'boolean' && enabled) {
|
|
24
|
+
const operationEnabled = enabled[operation.name];
|
|
25
|
+
return typeof operationEnabled === 'boolean' && operationEnabled === true;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
// Generate checkbox fields for each enabled operation
|
|
30
|
+
const operationFields = enabledOperations.map((operation)=>({
|
|
31
|
+
name: operation.name,
|
|
32
|
+
type: 'checkbox',
|
|
33
|
+
admin: {
|
|
34
|
+
description: operation.description(slug)
|
|
35
|
+
},
|
|
36
|
+
defaultValue: false,
|
|
37
|
+
label: operation.label
|
|
38
|
+
}));
|
|
39
|
+
return {
|
|
40
|
+
type: 'collapsible',
|
|
41
|
+
admin: {
|
|
42
|
+
position: 'sidebar'
|
|
43
|
+
},
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
name: toCamelCase(slug),
|
|
47
|
+
type: 'group',
|
|
48
|
+
fields: operationFields,
|
|
49
|
+
label: configType
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
label: `${slug.charAt(0).toUpperCase() + toCamelCase(slug).slice(1)}`
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=createApiKeyFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/createApiKeyFields.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport type { EntityConfig } from '../types.js'\n\nimport { adminEntitySettings } from './adminEntitySettings.js'\nimport { toCamelCase } from './camelCase.js'\nimport { getEnabledSlugs } from './getEnabledSlugs.js'\n/**\n * Creates MCP API key permission fields using collections or globals.\n * Generates collapsible field groups with checkboxes for each enabled operation.\n *\n * @param config - The collections or globals configuration object\n * @param configType - The type of configuration ('collection' or 'global')\n * @returns Array of fields for the MCP API Keys collection\n */\nexport const createApiKeyFields = ({\n config,\n configType,\n}: {\n config: EntityConfig | undefined\n configType: 'collection' | 'global'\n}): Field[] => {\n const operations = adminEntitySettings[configType]\n const enabledSlugs = getEnabledSlugs(config, configType)\n\n return enabledSlugs.map((slug) => {\n const entityConfig = config?.[slug]\n\n const enabledOperations = operations.filter((operation) => {\n // If fully enabled, all operations are available\n if (entityConfig?.enabled === true) {\n return true\n }\n\n // If partially enabled, check if this specific operation is enabled\n const enabled = entityConfig?.enabled\n if (typeof enabled !== 'boolean' && enabled) {\n const operationEnabled = enabled[operation.name as keyof typeof enabled]\n return typeof operationEnabled === 'boolean' && operationEnabled === true\n }\n\n return false\n })\n\n // Generate checkbox fields for each enabled operation\n const operationFields = enabledOperations.map((operation) => ({\n name: operation.name,\n type: 'checkbox' as const,\n admin: {\n description: operation.description(slug),\n },\n defaultValue: false,\n label: operation.label,\n }))\n\n return {\n type: 'collapsible' as const,\n admin: {\n position: 'sidebar' as const,\n },\n fields: [\n {\n name: toCamelCase(slug),\n type: 'group' as const,\n fields: operationFields,\n label: configType,\n },\n ],\n label: `${slug.charAt(0).toUpperCase() + toCamelCase(slug).slice(1)}`,\n }\n })\n}\n"],"names":["adminEntitySettings","toCamelCase","getEnabledSlugs","createApiKeyFields","config","configType","operations","enabledSlugs","map","slug","entityConfig","enabledOperations","filter","operation","enabled","operationEnabled","name","operationFields","type","admin","description","defaultValue","label","position","fields","charAt","toUpperCase","slice"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,WAAW,QAAQ,iBAAgB;AAC5C,SAASC,eAAe,QAAQ,uBAAsB;AACtD;;;;;;;CAOC,GACD,OAAO,MAAMC,qBAAqB,CAAC,EACjCC,MAAM,EACNC,UAAU,EAIX;IACC,MAAMC,aAAaN,mBAAmB,CAACK,WAAW;IAClD,MAAME,eAAeL,gBAAgBE,QAAQC;IAE7C,OAAOE,aAAaC,GAAG,CAAC,CAACC;QACvB,MAAMC,eAAeN,QAAQ,CAACK,KAAK;QAEnC,MAAME,oBAAoBL,WAAWM,MAAM,CAAC,CAACC;YAC3C,iDAAiD;YACjD,IAAIH,cAAcI,YAAY,MAAM;gBAClC,OAAO;YACT;YAEA,oEAAoE;YACpE,MAAMA,UAAUJ,cAAcI;YAC9B,IAAI,OAAOA,YAAY,aAAaA,SAAS;gBAC3C,MAAMC,mBAAmBD,OAAO,CAACD,UAAUG,IAAI,CAAyB;gBACxE,OAAO,OAAOD,qBAAqB,aAAaA,qBAAqB;YACvE;YAEA,OAAO;QACT;QAEA,sDAAsD;QACtD,MAAME,kBAAkBN,kBAAkBH,GAAG,CAAC,CAACK,YAAe,CAAA;gBAC5DG,MAAMH,UAAUG,IAAI;gBACpBE,MAAM;gBACNC,OAAO;oBACLC,aAAaP,UAAUO,WAAW,CAACX;gBACrC;gBACAY,cAAc;gBACdC,OAAOT,UAAUS,KAAK;YACxB,CAAA;QAEA,OAAO;YACLJ,MAAM;YACNC,OAAO;gBACLI,UAAU;YACZ;YACAC,QAAQ;gBACN;oBACER,MAAMf,YAAYQ;oBAClBS,MAAM;oBACNM,QAAQP;oBACRK,OAAOjB;gBACT;aACD;YACDiB,OAAO,GAAGb,KAAKgB,MAAM,CAAC,GAAGC,WAAW,KAAKzB,YAAYQ,MAAMkB,KAAK,CAAC,IAAI;QACvE;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EntityConfig } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts enabled slugs from collections or globals configuration.
|
|
4
|
+
* A slug is considered enabled if:
|
|
5
|
+
* 1. enabled is set to true (fully enabled)
|
|
6
|
+
* 2. enabled is an object with at least one operation set to true
|
|
7
|
+
*
|
|
8
|
+
* @param config - The collections or globals configuration object
|
|
9
|
+
* @param configType - The type of configuration ('collection' or 'global')
|
|
10
|
+
* @returns Array of enabled slugs
|
|
11
|
+
*/
|
|
12
|
+
export declare const getEnabledSlugs: (config: EntityConfig | undefined, configType: "collection" | "global") => string[];
|
|
13
|
+
//# sourceMappingURL=getEnabledSlugs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEnabledSlugs.d.ts","sourceRoot":"","sources":["../../src/utils/getEnabledSlugs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,WAClB,YAAY,GAAG,SAAS,cACpB,YAAY,GAAG,QAAQ,KAClC,MAAM,EAwBR,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { adminEntitySettings } from './adminEntitySettings.js';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts enabled slugs from collections or globals configuration.
|
|
4
|
+
* A slug is considered enabled if:
|
|
5
|
+
* 1. enabled is set to true (fully enabled)
|
|
6
|
+
* 2. enabled is an object with at least one operation set to true
|
|
7
|
+
*
|
|
8
|
+
* @param config - The collections or globals configuration object
|
|
9
|
+
* @param configType - The type of configuration ('collection' or 'global')
|
|
10
|
+
* @returns Array of enabled slugs
|
|
11
|
+
*/ export const getEnabledSlugs = (config, configType)=>{
|
|
12
|
+
return Object.keys(config || {}).filter((slug)=>{
|
|
13
|
+
const entityConfig = config?.[slug];
|
|
14
|
+
const operations = adminEntitySettings[configType];
|
|
15
|
+
// Check if fully enabled (boolean true)
|
|
16
|
+
const fullyEnabled = typeof entityConfig?.enabled === 'boolean' && entityConfig?.enabled === true;
|
|
17
|
+
if (fullyEnabled) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
// Check if partially enabled (at least one operation is enabled)
|
|
21
|
+
const enabled = entityConfig?.enabled;
|
|
22
|
+
if (typeof enabled !== 'boolean' && enabled) {
|
|
23
|
+
return operations.some((operation)=>{
|
|
24
|
+
const operationEnabled = enabled[operation.name];
|
|
25
|
+
return typeof operationEnabled === 'boolean' && operationEnabled === true;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=getEnabledSlugs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getEnabledSlugs.ts"],"sourcesContent":["import type { EntityConfig } from '../types.js'\n\nimport { adminEntitySettings } from './adminEntitySettings.js'\n\n/**\n * Extracts enabled slugs from collections or globals configuration.\n * A slug is considered enabled if:\n * 1. enabled is set to true (fully enabled)\n * 2. enabled is an object with at least one operation set to true\n *\n * @param config - The collections or globals configuration object\n * @param configType - The type of configuration ('collection' or 'global')\n * @returns Array of enabled slugs\n */\nexport const getEnabledSlugs = (\n config: EntityConfig | undefined,\n configType: 'collection' | 'global',\n): string[] => {\n return Object.keys(config || {}).filter((slug) => {\n const entityConfig = config?.[slug]\n const operations = adminEntitySettings[configType]\n\n // Check if fully enabled (boolean true)\n const fullyEnabled =\n typeof entityConfig?.enabled === 'boolean' && entityConfig?.enabled === true\n\n if (fullyEnabled) {\n return true\n }\n\n // Check if partially enabled (at least one operation is enabled)\n const enabled = entityConfig?.enabled\n if (typeof enabled !== 'boolean' && enabled) {\n return operations.some((operation) => {\n const operationEnabled = enabled[operation.name as keyof typeof enabled]\n return typeof operationEnabled === 'boolean' && operationEnabled === true\n })\n }\n\n return false\n })\n}\n"],"names":["adminEntitySettings","getEnabledSlugs","config","configType","Object","keys","filter","slug","entityConfig","operations","fullyEnabled","enabled","some","operation","operationEnabled","name"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,2BAA0B;AAE9D;;;;;;;;;CASC,GACD,OAAO,MAAMC,kBAAkB,CAC7BC,QACAC;IAEA,OAAOC,OAAOC,IAAI,CAACH,UAAU,CAAC,GAAGI,MAAM,CAAC,CAACC;QACvC,MAAMC,eAAeN,QAAQ,CAACK,KAAK;QACnC,MAAME,aAAaT,mBAAmB,CAACG,WAAW;QAElD,wCAAwC;QACxC,MAAMO,eACJ,OAAOF,cAAcG,YAAY,aAAaH,cAAcG,YAAY;QAE1E,IAAID,cAAc;YAChB,OAAO;QACT;QAEA,iEAAiE;QACjE,MAAMC,UAAUH,cAAcG;QAC9B,IAAI,OAAOA,YAAY,aAAaA,SAAS;YAC3C,OAAOF,WAAWG,IAAI,CAAC,CAACC;gBACtB,MAAMC,mBAAmBH,OAAO,CAACE,UAAUE,IAAI,CAAyB;gBACxE,OAAO,OAAOD,qBAAqB,aAAaA,qBAAqB;YACvE;QACF;QAEA,OAAO;IACT;AACF,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.71.0-canary.2",
|
|
4
4
|
"description": "MCP (Model Context Protocol) capabilities with Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plugin",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@modelcontextprotocol/sdk": "
|
|
40
|
+
"@modelcontextprotocol/sdk": "~1.24.0",
|
|
41
41
|
"@types/json-schema": "7.0.15",
|
|
42
42
|
"@vercel/mcp-adapter": "^1.0.0",
|
|
43
43
|
"json-schema-to-zod": "2.6.1",
|
|
44
44
|
"zod": "^3.25.50"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"payload": "3.71.0-canary.2",
|
|
48
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"payload": "3.
|
|
51
|
+
"payload": "3.71.0-canary.2"
|
|
52
52
|
},
|
|
53
53
|
"homepage:": "https://payloadcms.com",
|
|
54
54
|
"scripts": {
|