VSCode Debug MCP
VSCode Debug MCP
一个将 VS Code 的调试适配器协议 (DAP) 作为 MCP 工具暴露的 VS Code 扩展和 CLI,使 AI 编码代理能够在真实的调试会话中设置断点、单步执行代码、检查变量和读取异常。
致谢
本项目是从头重写的,最初是对 Hwanyong Yoo 的 mcp-debug-tools 进行分析并受其启发。除少数几个功能上微不足道的实用工具文件外,没有逐字复制任何源代码;VS Code 集成点(激活、命令、贡献)以及 CLI/发现方法被用作参考,同时从头重新设计了 DAP 跟踪、会话处理和服务器安全性。采用 GPL-3.0 许可,与原项目相同。
Related MCP server: Debug-MCP
为什么重写
对原始工具的分析发现了一些不值得原地修补的问题:
DAP 消息跟踪是一个存根,对于
get-dap-log、get-debug-console和get-exception-info始终返回预设的占位符——从未返回真实数据。单个共享的
McpServer实例处理每个客户端会话,导致第二个并发连接无限挂起。HTTP 服务器没有身份验证,并且禁用了 DNS 重新绑定保护。
logMessage(日志点)被接受但从未实际应用。通过命令停止/重启服务器会使磁盘上的配置文件指向一个过时的端口。
两个
package.json文件在每次构建前被互换,这正是导致每个已发布版本中都存在一个未声明的运行时依赖项的原因。
所有这些问题都已在此修复;变更列表请参见 CHANGELOG.md。
开发
npm install
npm run build # esbuild -> out/extension.js, out/cli.js
npm run typecheck # tsc --noEmit
npm run lint运行扩展:在 VS Code 中打开此文件夹并按 F5(扩展开发主机)。
独立运行 CLI:node out/cli.js <command> [args]——完整命令/工具参考请参见 resources/skills/dap-cli-debugging.md。
打包与安装
要创建可安装的 VS Code .vsix 包:
npx @vscode/vsce package这将在仓库根目录生成一个 vscode-mcp-dap-debugger-X.Y.Z.vsix 文件。你可以通过 VS Code 的 UI(扩展 -> ... -> 从 VSIX 安装...)或命令行进行安装:
code --install-extension vscode-mcp-dap-debugger-*.vsix安全模型
HTTP 服务器仅绑定到 127.0.0.1,保持 DNS 重新绑定保护启用,并且每次请求都需要一个每个实例的认证令牌(启动时生成,写入工作区的 .vscode-mcp-dap-debugger/config.json 和 ~/.vscode-mcp-dap-debugger/active-configs.json)。CLI 发现令牌的方式与发现端口相同。这并非作为强身份验证——它是一个防护措施,防止其他本地进程或用户偶然发现端口并驱动调试器(包括通过 evaluate-expression 运行任意表达式),而他们原本没有对此工作区的文件系统访问权限。
This server cannot be deployed
Maintenance
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
Agent Replay Debugger MCP — record every agent step + deterministic replay. Step-debugger for
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
MCP server exposing the Backtest360 engine API as tools for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA VSCode extension that enables AI agents to programmatically control VSCode's debugging features through the Model Context Protocol (MCP).-
- AlicenseAqualityDmaintenanceEnables AI assistants to perform interactive Python debugging with breakpoints, step execution, and variable inspection using the Debug Adapter Protocol (DAP) through an MCP server interface.81MIT
- AlicenseAqualityAmaintenanceEnables AI agents to perform step-through debugging of Python, JavaScript/Node.js, and Rust programs using the Debug Adapter Protocol, with support for breakpoints, variable inspection, and stack traces.28173MIT
- AlicenseNot gradedqualityDmaintenanceEnables coding agents to use a real debugger (Python via debugpy) for launching, attaching, setting breakpoints, stepping through code, inspecting stack frames, and evaluating expressions through MCP tools.27MIT