diff --git a/.changeset/ctx7-1604-prompts-resources-handlers.md b/.changeset/ctx7-1604-prompts-resources-handlers.md new file mode 100644 index 00000000..a2e337fb --- /dev/null +++ b/.changeset/ctx7-1604-prompts-resources-handlers.md @@ -0,0 +1,5 @@ +--- +"@upstash/context7-mcp": patch +--- + +Advertise empty `prompts` and `resources` capabilities with no-op `prompts/list` and `resources/list` handlers. Some MCP clients (e.g. opencode) call these unconditionally and treat `-32601 Method not found` as a fatal connection error rather than honoring the negotiated capabilities, which previously prevented the server from loading. diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts index cc0d9f78..7fbac41e 100644 --- a/packages/mcp/src/index.ts +++ b/packages/mcp/src/index.ts @@ -2,6 +2,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { + ListPromptsRequestSchema, + ListResourcesRequestSchema, +} from "@modelcontextprotocol/sdk/types.js"; import { z } from "zod"; import { searchLibraries, fetchLibraryContext } from "./lib/api.js"; import { ClientContext } from "./lib/encryption.js"; @@ -316,6 +320,12 @@ Workflow: call first without researchMode. If that doesn't answer the question, } ); + server.server.registerCapabilities({ prompts: {}, resources: {} }); + server.server.setRequestHandler(ListPromptsRequestSchema, async () => ({ prompts: [] })); + server.server.setRequestHandler(ListResourcesRequestSchema, async () => ({ + resources: [], + })); + return server; }