向VS Code添加MCP服务器时遇"Cannot read properties of undefined (reading 'inputs')"错误
解决VS Code安装MCP服务器时出现「Cannot read properties of undefined (reading 'inputs')」错误
问题场景
- 访问VS Code MCP服务器页面,选择任意一款服务器后在VS Code内打开对应页面
- 点击「安装」按钮,随即弹出错误提示:
Cannot read properties of undefined (reading 'inputs') - 官网提供的所有MCP服务器均存在此问题,且VS Code用户目录与工作区中的
mcp.json文件均为空
修复方案
1. 清理VS Code缓存
关闭VS Code,删除以下缓存目录后重启:
- Windows:
%APPDATA%\Code\Cache、%APPDATA%\Code\CachedData - macOS:
~/Library/Caches/Code、~/Library/Application Support/Code/CachedData - Linux:
~/.cache/Code、~/.config/Code/CachedData
2. 手动初始化mcp.json文件
在VS Code用户配置目录(Windows:%APPDATA%\Code\User;macOS:~/Library/Application Support/Code/User;Linux:~/.config/Code/User)或当前工作区根目录,创建/编辑mcp.json文件,写入基础结构:
{ "servers": [] }
保存后重启VS Code,再尝试安装MCP服务器。
3. 更新VS Code至最新版本
通过「帮助」-「检查更新」安装VS Code最新版本,旧版本可能存在MCP模块的兼容性问题。
4. 排查扩展冲突
临时禁用所有第三方扩展(扩展面板右上角选择「禁用所有已安装扩展」),重启VS Code后重试安装操作,确认是否是第三方扩展干扰导致的错误。
内容的提问来源于stack exchange,提问作者Ian Vaughan
相关产品推荐
相关产品推荐

