You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code中自定义HTTP-based MCP服务器及工具无法显示求助

自定义HTTP-based MCP服务器工具未在VS Code工具列表中显示

我在Visual Studio Code中接入了自主开发的HTTP-based MCP服务器,启动服务器后,它能正常返回工具列表,但这些工具既不显示在VS Code的工具列表中,使用/list命令也无法看到。此前连接Atlassian MCP服务器时,服务器及工具均能正常显示并使用。

相关日志如下:

2025-09-11 12:03:32.336 [info] Starting server testServer
2025-09-11 12:03:32.336 [info] Connection state: Starting
2025-09-11 12:03:32.342 [info] Starting server from LocalProcess extension host
2025-09-11 12:03:32.345 [info] Connection state: Running
2025-09-11 12:03:32.346 [debug] [editor -> server] {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{"roots":{"listChanged":true},"sampling":{},"elicitation":{}},"clientInfo":{"name":"Visual Studio Code","version":"1.103.2"}}}
2025-09-11 12:03:32.356 [debug] [server -> editor] {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26","capabilities":{"logging":{},"prompts":{"listChanged":true},"resources":{"subscribe":true,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"mcp-server-filesystem","version":"1.0.0"}}}
2025-09-11 12:03:32.356 [debug] [editor -> server] {"jsonrpc":"2.0","id":2,"method":"logging/setLevel","params":{"level":"debug"}}
2025-09-11 12:03:32.356 [debug] [editor -> server] {"method":"notifications/initialized","jsonrpc":"2.0"}
2025-09-11 12:03:32.356 [debug] [editor -> server] {"jsonrpc":"2.0","id":3,"method":"tools/list","params":{}}
2025-09-11 12:03:32.356 [debug] [editor -> server] {"jsonrpc":"2.0","id":4,"method":"prompts/list","params":{}}
2025-09-11 12:03:32.369 [warning] Unexpected 200 response for request: id: 64014869-2061-4e08-8b12-0f339428d1a8
event: message
data: {"jsonrpc":"2.0","id":3,"result":{"tools":[{"name":"find","description":"Start from the specified path and recursively search subitems.","inputSchema":{"type":"object","properties":{"start":{"type":"string","minLength":1,"maxLength":256,"description":"The starting path to search, required."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"The name of the target file or directory to search, supports fuzzy matching, required."}},"required":["start","name"]}},{"name":"JSONread","description":"Read a file or list directory contents non-recursively.","inputSchema":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":256,"description":"The path to read, can be a file or directory, required."}},"required":["path"]}},{"name":"JSONdelete","description":"Delete a file or directory from the filesystem.","inputSchema":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":256,"description":"The path to delete, can be a file or directory, required."}},"required":["path"]}}]}}


2025-09-11 12:03:32.369 [warning] Unexpected 200 response for request: id: 64014869-2061-4e08-8b12-0f339428d1a8
event: message
data: {"jsonrpc":"2.0","id":4,"result":{"prompts":[]}}


2025-09-11 12:03:32.391 [warning] Unexpected 200 response for request: id: 64014869-2061-4e08-8b12-0f339428d1a8
event: message
data: {"jsonrpc":"2.0","id":2,"result":{}}

问题分析

  1. 请求ID不匹配:日志中反复出现Unexpected 200 response for request: id: [UUID]警告,说明VS Code客户端接收到的服务器响应关联了一个未识别的请求ID(UUID),而非客户端实际发送的1、2、3、4。这会导致客户端无法将响应与对应请求关联,从而忽略工具列表数据。
  2. 协议版本不一致:初始化阶段,客户端使用的协议版本是2025-06-18,但服务器返回的是2025-03-26。版本不兼容可能导致VS Code拒绝处理服务器返回的能力和工具信息。

解决方案

  • 修复请求ID映射逻辑:检查MCP服务器的JSON-RPC响应处理代码,确保每个响应的id字段严格匹配对应请求的id。排查是否存在会话跟踪错误,导致响应被错误关联到无关请求ID。
  • 对齐协议版本:将服务器的protocolVersion升级至客户端使用的2025-06-18,或确认VS Code对2025-03-26版本的兼容性。协议版本一致是客户端正确识别服务器能力的前提。
  • 验证工具响应格式:确认服务器返回的工具列表JSON结构完全符合MCP协议规范,比如inputSchema的JSON Schema定义无语法错误,字段约束(如required、minLength)符合要求。

内容的提问来源于stack exchange,提问作者Sameer Kanikdale

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 09:13:17