Skip to content

Commit c852d85

Browse files
jhb-devpaulpopus
andauthored
feat(plugin-mcp): add support for server instructions (#15858)
### What? Adds an `instructions` option to the MCP plugin's `MCPServerOptions` type. ### Why? The MCP protocol supports an `instructions` field that is sent to clients during initialization. The Payload MCP plugin currently doesn't expose this option, so users have no way to provide instructions describing how to use the server and its features. ### How? - Added `instructions` field to `MCPServerOptions` in `types.ts` - Pass `instructions` through to the MCP SDK via `createMcpHandler` in `getMcpHandler.ts` ```ts mcpPlugin({ collections: { ... }, mcp: { serverOptions: { instructions: 'This server manages blog posts and pages.', }, }, }) ``` --------- Co-authored-by: Paul Popus <paul@payloadcms.com>
1 parent 7ca8b05 commit c852d85

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

packages/plugin-mcp/src/mcp/getMcpHandler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ export const getMCPHandler = (
527527
}
528528
},
529529
{
530+
instructions: serverOptions.instructions,
530531
serverInfo: serverOptions.serverInfo,
531532
},
532533
{

packages/plugin-mcp/src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ export type MCPHandlerOptions = {
373373
* MCP Server options.
374374
*/
375375
export type MCPServerOptions = {
376+
/**
377+
* Optional instructions describing how to use the server and its features.
378+
*/
379+
instructions?: string
376380
/**
377381
* Set the server info of the MCP server.
378382
*/

0 commit comments

Comments
 (0)