[RFC] MCP Plugin #14318
Replies: 7 comments 17 replies
-
|
We have a client who is using PayloadCMS for educational institute, i.e for school & college. I'm guessing this is exactly what we are building, right? |
Beta Was this translation helpful? Give feedback.
-
|
Hi! Thanks for the great implementation! mcpPlugin({
mcp: {
prompts: [
{
name: 'summaryContent',
title: 'Content Summary Prompt',
description: 'Creates a prompt for summarize content',
argsSchema: {
content: z.string().describe('The content to review'),
},
handler: ({ content }) => {
console.log('Custom prompt run')
return {
messages: [
{
content: {
type: 'text',
text: `Please summarize the following content.: ${content}`,
},
role: 'user',
},
],
}
},
},
],
},
collections: {
posts: {
enabled: {
find: true,
create: false,
update: false,
delete: false,
},
description:
'Announcement article collection. Can be used to search articles containing information such as title, content, publication date and time, category, and more.',
},
},
}),And what version of zod it' supporting ? I keep getting this type error ( Using zod v4 ) |
Beta Was this translation helpful? Give feedback.
-
|
this is great. is there any plan to add oauth so we can avoid static API Keys? |
Beta Was this translation helpful? Give feedback.
-
|
Awesome stuff! 🎉 Also Strapi’s official MCP extension is just around the corner too. Super excited to play with this one! |
Beta Was this translation helpful? Give feedback.
-
|
Adding a few of my thoughts from the Discord to this so they don't get lost. Also, a few notes from when I was messing with it again yesterday.
Overall, I really like this new plugin and think it will make using AI to develop with Payload much easier. |
Beta Was this translation helpful? Give feedback.
-
|
Updated admin to include example config: mcpPlugin({
collections: {},
mcp: {
tools: [
{
name: 'diceRoll',
description: 'Rolls a virtual dice with a specified number of sides',
// ...
},
],
prompts: [
{
name: 'echo',
description: 'Creates a prompt to process a message',
// ...
},
],
resources: [
{
name: 'data',
description: 'Data is a resource that contains special data.',
// ...
},
{
name: 'dataByID',
description: 'Data is a resource that contains special data.',
// ...
},
],
}, |
Beta Was this translation helpful? Give feedback.
-
|
What is the expected behavior of
But I get a 405 error for each. Visiting each route (in order) gives me a Next.js 404, Payload CMS 404, and a response that says API key is required. I'm using the website template on the latest version. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
📝 Plugin Documentation
Background
This plugin adds MCP server capabilities to Payload. By using this plugin, Payload can be used as a Connector by MCP clients to interact with the data in your collections. It can also return prompts to use in a model's context, and run functions defined as Tools. You can also create your own Resources to further extend the capabilities of your server.
⭐ Yes, this means chat agents can reference data in your collections, use your prompts to guide their responses, and run custom functions to perform actions you define. This plugin gives models the ability to access content, however you can manage access to that content in real-time using the API or the Admin panel.
How does it work?
Collections
You control which collections can be modified by MCP clients and create custom Tools, Prompts and Resources.
In this example, the "Posts" collection is enabled. A model will be able to perform
find,create,update, anddeleteoperations on thepostscollection.You can restrict operations a model can perform on a collection. Here is an example of a config that only allows
findandcreateoperations on the "Posts" collection.You can add a description to help a model understand your collection.
Tools
These are the Payload tools that LLMs use to interact with collection documents.
Resources
findResourcescreateResourceupdateResourcedeleteResourceYou can create your own Tools to extend the capabilities of your server.
Here is an example of a basic tool that rolls a virtual dice with a specified number of sides.
Prompts
You can also create your own Prompts to extend the capabilities of your server.
Here is an example of a basic reusable prompt that echoes a message.
Resources
You can also create your own Resources to extend the capabilities of your server.
Here is an example of a basic resource that contains static data.
Security
Using the Admin or the API you create API Keys that control MCP access to resources. MCP Clients must must include the API Key in the request headers when making MCP requests. If the API Key is not included, the request will be rejected.
Example MCP Client request to list tools:
🚨 Collections must be

allowedby Admins or the API to be accessible by MCP clients.🚨 Tools, prompts, and resources are initially allowed.

Capabilities
We are currently implementing these capabilities from the MCP specification.
Transports
Currently Implemented Transports in Payload MCP Plugin:
Basic Usage
In the
pluginsarray of your Payload ConfigConnectors
Connectors are MCP clients that can use MCP servers like Payload with the plugin installed.
Visual Studio Code
{ "mcp.servers": { "Payload": { "url": "http://127.0.0.1:3000/api/mcp", "headers": { "Authorization": "Bearer API-KEY-HERE" } } } }Cursor
{ "mcpServers": { "Payload": { "command": "npx", "args": [ "-y", "mcp-remote", "http://127.0.0.1:3000/api/mcp", "--header", "Authorization: Bearer API-KEY-HERE" ] }, } }Claude Code
claude mcp add --transport http Payload http://127.0.0.1:3000/api/mcp --header "Authorization: Bearer API-KEY-HERE"Testing your MCP endpoint
I highly recommend using
npx @modelcontextprotocol/inspectorto test your MCP server.Your default MCP endpoint is:
http://127.0.0.1:3000/api/mcpOpen Questions
Beta Was this translation helpful? Give feedback.
All reactions