modelcontextprotocol / modelcontextprotocol/typescript-sdk

Client#listPrompts results in MCP error -32601: Method not found

Open
#929 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug fix proposed P3 potentially close ready for work
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

Describe the bug

I've created an MCPServer instance connected to a Client via an InMemoryTransport. If the server has not has registerPrompt called on it, the client raises an error when calling listPrompts().

To Reproduce

Steps to reproduce the behavior:

  1. Make sure you're using the latest version of Bun. I don't know if this reproduces in other runtimes—I've only tested it in Bun.

  2. Install @modelcontextprotocol/sdk via bun add @modelcontextprotocol/sdk.

  3. Create a file named example.ts with the following content:

    import { Client } from "@modelcontextprotocol/sdk/client/index.js";
    import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    
    const server = new McpServer({
      name: "example",
      version: "0.0.0",
    });
    
    // Don't register any prompts
    
    const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
    
    const client = new Client({
      name: "example",
      version: "0.0.0",
    });
    
    await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
    
    console.log(await client.listPrompts());
    
  4. Run the file using Bun: bun run example.ts.

Expected behavior

The script should output []

Actual behavior

The script produces this error:

1300 |     CallToolResultSchema,
1301 |     ListToolsResultSchema,
1302 | ]);
1303 | export class McpError extends Error {
1304 |     constructor(code, message, data) {
1305 |         super(`MCP error ${code}: ${message}`);
               ^
McpError: MCP error -32601: Method not found
 code: -32601,
 data: undefined,

      at new McpError (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js:1305:9)
      at _onresponse (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:223:27)
      at <anonymous> (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:84:22)
      at send (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js:42:34)
      at send (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js:37:16)
      at _onrequest (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:133:101)
      at <anonymous> (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:87:22)
      at send (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js:42:34)
      at send (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js:37:16)
      at <anonymous> (/Users/landon/Development/mcp/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:308:29)

Bun v1.2.21 (macOS arm64)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Client.listPrompts() and the McpServer/registerPrompt behavior shown in example.ts, using InMemoryTransport.createLinkedPair() to reproduce the request. Check how an MCP server responds when no prompts are registered; done means the example returns [] instead of MCP error -32601, with coverage for the empty-prompt case.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.