Windbg-MCP
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Windbg-MCPanalyze the crash dump for bugcheck details"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Windbg-MCP
MCP (Model Context Protocol) server for WinDbg — 让 AI 驱动内核调试。
工作原理
MCP Client ──HTTP(MCP)──► Windbg-MCP Server ──TCP──► WinDbg (手动主控)
.server tcp:port=50000
双机内核已连VM、已断下用户 在 Windbg 中手动中断目标
Windbg 通过
.server tcp:port=XXXX暴露调试会话Windbg-MCP 作为远程客户端 (cdb.exe) 连入,收发命令
AI Agent 通过 MCP 协议发送调试指令,获取结果
Related MCP server: WinDbg GUI MCP Server
架构
Server 层 (HTTP/MCP) ← MCP 协议,不变
│
Command 层 (25 个工具) ← 不关心底层引擎,统一调用 execute()
│
Engine 层 ← 定义 execute(command) → str
└── SubprocessEngine ← 拉起 cdb.exe,管道通信,UTF-8 容错新增调试模式:实现 Engine 接口即可
新增工具:在
tools/下添加文件,注册到 Command 层更换传输:Server 层可独立替换,不影响调试引擎
快速开始
环境要求
Windows 10/11 x64
Windows SDK (含 Debugging Tools)
Python 3.10+
安装
cd Windbg-MCP
pip install -e .1. 目标 VM 配置
KDNET (推荐):
# VM 内管理员执行
bcdedit /debug on
bcdedit /dbgsettings net hostip:<宿主机IP> port:50005 key:1.2.3.4VM 网络设 Host-Only,确保宿主机与 VM 互通。
串口/Pipe:
# VM 内管理员执行
bcdedit /debug on
bcdedit /dbgsettings serial debugport:1 baudrate:115200VM 添加串口 → 命名管道 \\.\pipe\com_1。
2. Windbg 连接目标
WinDbg → File → Kernel Debug → Net (或 COM)连上后手动中断 (Ctrl+Break),然后暴露 TCP:
.server tcp:port=500003. 启动 MCP Server
python -m src.server --connect tcp:localhost:500004. 配置 MCP Client
{
"mcpServers": {
"windbg": {
"type": "remote",
"url": "http://localhost:8080/mcp"
}
}
}本地用户态调试
先启动 Windbg GUI → Open Executable / Attach Process / Open Dump → 中断后:
.server tcp:port=50000另开终端:
python -m src.server --connect tcp:localhost:50000Windbg GUI 和 AI Agent 共享同一调试会话,互不干扰。
数据传输约定
AI ↔ Server:所有参数均为字符串,
0x十六进制、寄存器名、符号名均可直接传入Server ↔ Windbg:Server 将字符串转为合法 Windbg 命令后执行
输出:文本原样返回 Agent
可用工具
执行控制
工具 | 参数 | 说明 |
| — | 继续运行 (g) |
| count (可选) | 单步进入 (t),默认 1 步 |
| count (可选) | 单步跳过 (p),默认 1 步 |
| — | 跳出函数 (gu) |
断点
工具 | 参数 | 说明 |
| address, condition (可选) | 设置断点,符号/地址/条件表达式 |
| — | 列出所有断点及命中次数 |
| id | 按 ID 清除, |
| id | 启用断点 |
| id | 禁用断点 |
内存 & 寄存器
工具 | 参数 | 说明 |
| address, size (可选), format (可选) | 读内存,format: byte/word/dword/qword/ascii |
| address, bytes | 写内存,空格分隔十六进制 |
| start, end, pattern | 搜索内存模式 |
| reg (可选) | 读寄存器,空则返回全部 |
| reg, value | 写寄存器 |
反汇编 & 栈帧
工具 | 参数 | 说明 |
| address, count (可选) | 反汇编,默认 8 条指令 |
| count (可选), params (可选) | 调用栈,Markdown 表格 (Frame / Call Site / Child-SP / RetAddr) |
| frame | 查看指定栈帧局部变量/参数 |
蓝屏 & 符号 & 类型
工具 | 参数 | 说明 |
| — | 自动化崩溃分析 (!analyze -v) |
| — | 获取 BugCheck 码及参数 |
| pattern, type (可选) | 按通配符搜索符号 |
| address | 地址 → 符号名 (ln) |
| type, address (可选), depth (可选) | 显示类型结构 (dt) |
| expression | 求值表达式 (? 或 ??) |
内核信息
工具 | 参数 | 说明 |
| — | 枚举所有进程 |
| address | 进程详细信息 (_EPROCESS 地址) |
| — | 枚举内核模块/驱动 |
| — | 调试器连接状态 |
透传
工具 | 参数 | 说明 |
| command | 执行任意 Windbg 命令,支持所有指令 |
CLI 参数
python -m src.server [options]
--connect tcp:HOST:PORT 连接到已有 Windbg (默认 localhost:50000)
--standalone 独立调试 (无 Windbg GUI)
--pid PID 附加进程 (--standalone)
--exe PATH 启动可执行文件 (--standalone)
--dump PATH 加载 dump (--standalone)
--http-port PORT HTTP 端口 (默认 8080)
--debug-json 打印原始 JSON 传输配置
环境变量 | 默认值 | 说明 |
| 8080 | HTTP 服务端口 |
| 50000 | Windbg TCP 端口 |
| 127.0.0.1 | Windbg TCP 地址 |
| 30 | 命令超时 (秒) |
| 3 | 自动重试次数 |
| — | 设为 1 开启 JSON 调试输出 |
常见问题
工具返回空 / 超时?
确认 Windbg 中目标已中断 (Ctrl+Break)
确认
.server tcp:port=50000仍在监听,可用.server查看换端口重开:
.server tcp:port=50001,然后--connect tcp:localhost:50001
编码错误 (read_loop died)?
cdb.exe 输出含非 GBK 字符时可能触发。引擎已内置 encoding="utf-8" + errors="replace" 容错。
端口被占用?
.endsrv 0 # 先关旧服务
.server tcp:port=50002 # 换端口重开多 VM 同时调试?
启动多个 MCP Server 实例,绑定不同端口。
开发
pip install -e ".[dev]"
pytest调试原始 JSON
python -m src.server --debug-json
# 或
WINDBG_MCP_DEBUG_JSON=1 python -m src.server输出格式:
=== REQUEST ===
{
"jsonrpc": "2.0",
"id": "1",
"method": "tools/call",
"params": {
"name": "windbg_mem_read",
"arguments": { "address": "0xfffff80012345678", "size": "0x40" }
}
}
=== RESPONSE ===
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"content": [{"type": "text", "text": "fffff800`12345678 00000000 ..."}]
}
}许可证
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chensiling/Windbg-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server