[RFC] MCP Plugin #14318
Replies: 13 comments 19 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.
-
|
One improvement that would significantly reduce token usage would be support for Payload’s Select API in the find resource tool. Currently, even when the model only needs to read a small subset of fields, such as the titles of all pages, the full document is queried and returned. This leads to unnecessary token consumption and can exhaust the available budget quickly. I have created a feature request for this. |
Beta Was this translation helpful? Give feedback.
-
|
Update: PR is merged and released in Payload 3.71. |
Beta Was this translation helpful? Give feedback.
-
|
Started using the MCP plugin ~3 days ago (had zero MCP experience before). The main value for me is solving content generation/preparation/sanitization issues — direct structured access to Payload from the website side is awesome. One problem I hit: MCP updated all records with the same description. I recovered thanks to versions, but I strongly suggest enabling versions by default for any create/update via MCP to avoid accidental mass overwrites. Also would be great to have more granular update actions (updateOne, updateMany, etc.) so we can restrict bulk operations for safety without complicating the interface. Overall: it’s great, it works, has bugs, but direction is excellent. I’m building a content planning plugin; if someone has done similar, please share. Last issue: GitHub Copilot Chat can see MCP tools but not prompts (MCP Inspector sees prompts fine). Might be VS Code related, but flagging here. Would also love to store prompt/tool metadata inside Payload instead of code in the future so non-devs can manage it. |
Beta Was this translation helpful? Give feedback.
-
|
While testing the MCP plugin with Payload v3.71, I noticed a couple of potential improvements:
|
Beta Was this translation helpful? Give feedback.
-
|
For us, token consumption is still the biggest challenge when working with the MCP. With larger documents, responses often become too large for the agent to read and process inline, which leads to inefficiencies. What impacts overall token usage across MCP operations is JSON pretty-printing. At the moment, responses are formatted using I opened a PR to address this here: #15598. I would appreciate your feedback! |
Beta Was this translation helpful? Give feedback.
-
|
I just opened two more feature requests as separate discussions:
Would appreciate an opinion form the team! |
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