Bug with MCP context provider resource reading #3647
Labels
area:context-providers
Relates to context providers
area:mcp
Relates to Model Context Protocol (MCP)
area:tools
Relates to tool usage
kind:bug
Indicates an unexpected problem or unintended behavior
Before submitting your bug report
Relevant environment info
Description
I found a bug related to mcp context provider, the source code pieces are below
continue/core/context/providers/MCPContextProvider.ts
Lines 73 to 78 in 5a1437a
continue/core/context/providers/MCPContextProvider.ts
Line 42 in 5a1437a
continue/core/context/providers/MCPContextProvider.ts
Lines 27 to 32 in 5a1437a
To make it concise, the main problem is the mcp server uri, which exposed by the mcp server, will be directly used as the mcp context provider's
options.submenuItems.id
, and when you input @mcp and select the resource, the query is actually a uri string, but not a json string, which will then fail inJSON.parse
and the error appears (in the right bottom of vscode, as the image below shows).Since the mcpId is allocated innerly, so change the mcp server's code is useless. Currently, a simple way to fix the problem is to make the
loadSubmenuItems
return right id string. I have tested the change and confirmed the code could work in this case, but I haven't tested it thoroughly.Glad if this can help.
To reproduce
Make your mcp config is right, and the select a mcp context, chat
Log output
No response
The text was updated successfully, but these errors were encountered: