Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCP Context Provider fails with filesystem server due to missing listResources() method #3225

Open
3 tasks done
casistack opened this issue Dec 6, 2024 · 1 comment
Open
3 tasks done
Assignees
Labels
area:context-providers Relates to context providers ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior

Comments

@casistack
Copy link

Before submitting your bug report

Relevant environment info

## Technical Details
- Error occurs in `MCPConnectionSingleton.modifyConfig()` in `core/context/mcp/index.ts`
- The filesystem server implements the MCP protocol correctly but doesn't include optional listing methods
- The error code -32601 is a standard JSON-RPC error for "Method not found"

## Environment
- Continue Version: 0.9.239
- VS Code Version: 1.95.3
- OS: Linux 
- Node.js: v18.20.5
- MCP Server: @modelcontextprotocol/server-filesystem@latest

Description

The MCP Context Provider in Continue.dev fails when using the official @modelcontextprotocol/server-filesystem because it assumes the server implements listResources(), listTools(), and listPrompts() methods. However, looking at the code in core/context/mcp/index.ts, these methods are called unconditionally in modifyConfig() without checking if they exist:

async modifyConfig(config: ContinueConfig): Promise<ContinueConfig> {
  // ... connection code ...

  // This fails with "Method not found" error
  const { resources } = await this.client.listResources();

  // These methods might also not exist
  const { tools } = await this.client.listTools();
  const { prompts } = await this.client.listPrompts();
}

To reproduce

  1. Install the filesystem server:
npm install -g @modelcontextprotocol/server-filesystem
  1. Configure MCP in ~/.continue/config.json:
{
  "experimental": {
    "modelContextProtocolServer": {
      "transport": {
        "type": "stdio",
        "command": "npx",
        "args": [
          "-y",
          "@modelcontextprotocol/server-filesystem",
          "/path/to/directory"
        ]
      }
    }
  }
}

Log output

[Extension Host] Secure MCP Filesystem Server running on stdio
[Extension Host] Allowed directories: [ '/home/m/m/m/claude-desktop-test' ]
[Extension Host] MCP connection error: Error: MCP error -32601: Method not found
at Client.onresponse (/home/m/.vscode/extensions/continue.continue-0.9.239-linux-x64/out/extension.js:105772:25)
at StdioClientTransport.transport.onmessage (/home/m/.vscode/extensions/continue.continue-0.9.239-linux-x64/out/extension.js:105675:18)
at StdioClientTransport.processReadBuffer (/home/m/.vscode/extensions/continue.continue-0.9.239-linux-x64/out/extension.js:106336:78)
at Socket.<anonymous> (/home/m/.vscode/extensions/continue.continue-0.9.239-linux-x64/out/extension.js:106311:18)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Socket.Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)
@dosubot dosubot bot added area:context-providers Relates to context providers ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior labels Dec 6, 2024
@Patrick-Erichsen
Copy link
Collaborator

Thanks for the thorough writeup here @casistack !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:context-providers Relates to context providers ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants