MCP调试服务器
MCP服务器,用于通过Winge/CDB调试Windows进程。
先决条件
- Python 3.10+
- Windows调试工具 (cdb.exe、dbgsrv.exe)
从Windows SDK安装中自动检测调试器路径。
安装
pip install -e .快速入门
# 1. Start the debug server
.\dbgsrv.exe -t tcp:port=5005
# 2. Add to your MCP client config and connect
# 3. Ask the LLM: "Attach to notepad.exe and show me loaded modules"MCP配置
{
"mcpServers": {
"mcp-debugserver": {
"type": "stdio",
"command": "python",
"args": ["
/mcp-debugserver/src/mcp_debugserver/server.py"],
"env": {
"arch": "x64"
}
}
}
}集 arch 到 x86 或 x64 以匹配您的目标流程架构。
用法
LLM可以访问所有调试工具。只需描述您要调试的内容:
- “附加到notepad.exe并在CreateFileW上设置断点”
- “显示调用堆栈和寄存器”
- “在当前指令指针处读取64字节的内存”
- “查找进程中所有对malloc的调用”
基本工作流程
start_debug_server-在端口上启动调试服务器connect_debugger-连接到服务器attach_process-通过PID或名称附加到目标- 根据需要使用检查/控制工具
detach_process/disconnect_debugger完成后
可用工具
| 类别 | 工具 |
|---|---|
| 生命周期 | start_debug_server, stop_debug_server, connect_debugger, disconnect_debugger |
| 过程 | attach_process, detach_process, get_process_info |
| 执行 | break_execution, resume_execution, step_into, step_over, step_out |
| 断点 | set_breakpoint, remove_breakpoint, list_breakpoints, enable_breakpoint, disable_breakpoint |
| 记忆 | read_memory, write_memory, search_memory |
| 寄存器 | read_registers, write_register |
| 检查 | get_callstack, list_threads, switch_thread, list_modules, module_info, disassemble |
| 符号 | evaluate_expression, display_symbol, reload_symbols, set_symbol_path |
| 异常 | get_exception_info, enable_exception_monitoring, get_last_exception_captured, set_exception_break, resume_with_monitoring, create_minidump |
| 硬件BP | set_hardware_breakpoint, remove_hardware_breakpoint, list_hardware_breakpoints, toggle_hardware_breakpoint |
| 原始 | execute_command -直接运行任何Winger命令 |
故障排除
| 问题 | 解决方案 |
|---|---|
| RPC错误0x80010007 | 体系结构不匹配-已设置 arch env变量与目标匹配 |
| 找不到cdb.exe | 从Windows SDK安装Windows调试工具 |
| 无法附加 | 以管理员权限运行;检查没有连接其他调试器 |
许可证
MIT许可证-版权所有(c)2025 MCP调试服务器
特此免费授予任何获得本软件和相关文档文件(“软件”)副本的人在不受限制的情况下处理软件的权限,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,以及允许获得软件的人这样做,但须符合以下条件:
上述版权声明和本许可声明应包含在软件的所有副本或实质部分中。
软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性的保证。在任何情况下,作者或版权持有人均不对因软件或软件的使用或其他交易而产生或与之相关的任何索赔、损害赔偿或其他责任承担责任,无论是在合同、侵权或其他诉讼中。
