dap_mcp
by KashunCheng·★ 40·综合分 42
DAP-MCP 通过标准化 MCP 协议实现 LLM 与调试器的交互,提供断点和执行控制等调试功能。
概述
dap-mcp 是一个用 Python 实现的模型上下文协议(MCP)服务器,它连接大型语言模型与调试适配器。该服务器提供了一套控制调试会话的工具,包括设置和删除断点、控制执行流(继续、进入/跳出/下一步)、评估表达式、更改堆栈帧和查看源代码。通过灵活的 JSON 配置系统,该服务器支持多种调试适配器(如 debugpy 和 lldb),使其能够适应各种调试环境。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要 AI 辅助调试工作流且团队使用 Python (debugpy) 或 lldb 调试器时,选择 dap-mcp。
什么时候不要选它
如果您使用尚不支持的其他调试器,或需要超出 MCP 协议支持的更全面 IDE 集成,请避免使用。
此 server 暴露的工具
从 README 抽取出 12 个工具launchLaunch the debuggee program.
set_breakpointSet a breakpoint at a specified file and line (with an optional condition).
remove_breakpointRemove a breakpoint from a specified file and line.
list_all_breakpointsList all breakpoints currently set in the debugger.
continue_executionContinue program execution after hitting a breakpoint.
step_inStep into a function call.
step_outStep out of the current function.
nextStep over to the next line of code.
evaluateEvaluate an expression in the current debugging context.
change_frameSwitch to a different stack frame.
view_file_around_lineView source code around a specified line.
terminateTerminate the debugging session.
可对比工具
安装
安装
- 安装 dap-mcp 包:
``bash pip install dap-mcp ``
- 创建配置文件(如
config.json)并设置您的调试器参数
- 运行服务器:
``bash python -m dap_mcp --config config.json # 或使用 uv uvx dap-mcp@latest --config config.json ``
Claude Desktop 配置
添加到您的 claude_desktop_config.json 中:
{
"mcpServers": {
"dap-debugger": {
"command": "python",
"args": ["-m", "dap_mcp"],
"env": {
"DAP_MCP_CONFIG": "/path/to/config.json"
}
}
}
}FAQ
- dap-mcp 支持哪些调试器?
- 目前 dap-mcp 通过调试器适配器协议支持 debugpy 和 lldb。其架构设计可扩展,允许通过创建新的配置类来支持额外的调试器。
- 如何添加对新调试器的支持?
- 要添加对新 DAP 服务器的支持,请在 `dap_mcp/config.py` 中创建一个扩展基础 `DAPConfig` 类的新配置类。定义一个唯一的类型值和该调试器特有的任何附加设置,然后更新调试器特定配置的联合类型。
dap_mcp 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。