-
Notifications
You must be signed in to change notification settings - Fork 267
Open
Labels
breaking changeenhancementNew feature or requestNew feature or requestmcpIssues related to MCP functionalityIssues related to MCP functionality
Description
When we need to access the underlying server implementation this is what we have to do:
import { McpAgent } from "agents/mcp";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
export class MyMCP extends McpAgent {
server = new McpServer({/* ... */});
async init() {
// server.server echo is annoying and confusing
this.server.server.setRequestHandler(
SetLevelRequestSchema,
async (request, extra) => {
// ... handler logic
},
);
}
}
It's kind of annoying (and it's the MCP SKD's fault). I would rather it be this.mcp.server.setRequestHandler
:
import { McpAgent } from "agents/mcp";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
export class MyMCP extends McpAgent {
mcp = new McpServer({/* ... */});
async init() {
this.mcp.server.setRequestHandler(
SetLevelRequestSchema,
async (request, extra) => {
// ... handler logic
},
);
}
}
However, McpAgent
requires the server to be set to the server
property.
This is just a small quality of life thing, but I think it should be easy enough to un-document the server
name, document the mcp
name, and support both.
cliffhall, whoiskatrin and PedroAlvarado
Metadata
Metadata
Assignees
Labels
breaking changeenhancementNew feature or requestNew feature or requestmcpIssues related to MCP functionalityIssues related to MCP functionality