mcp-windbg 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_windbg-0.2.1/LICENSE +21 -0
- mcp_windbg-0.2.1/PKG-INFO +232 -0
- mcp_windbg-0.2.1/README.md +212 -0
- mcp_windbg-0.2.1/pyproject.toml +38 -0
- mcp_windbg-0.2.1/setup.cfg +4 -0
- mcp_windbg-0.2.1/src/mcp_server_windbg/__init__.py +26 -0
- mcp_windbg-0.2.1/src/mcp_server_windbg/__main__.py +5 -0
- mcp_windbg-0.2.1/src/mcp_server_windbg/cdb_session.py +270 -0
- mcp_windbg-0.2.1/src/mcp_server_windbg/server.py +470 -0
- mcp_windbg-0.2.1/src/mcp_server_windbg/tests/test_cdb.py +124 -0
- mcp_windbg-0.2.1/src/mcp_server_windbg/tests/test_remote_debugging.py +234 -0
- mcp_windbg-0.2.1/src/mcp_windbg.egg-info/PKG-INFO +232 -0
- mcp_windbg-0.2.1/src/mcp_windbg.egg-info/SOURCES.txt +15 -0
- mcp_windbg-0.2.1/src/mcp_windbg.egg-info/dependency_links.txt +1 -0
- mcp_windbg-0.2.1/src/mcp_windbg.egg-info/entry_points.txt +2 -0
- mcp_windbg-0.2.1/src/mcp_windbg.egg-info/requires.txt +5 -0
- mcp_windbg-0.2.1/src/mcp_windbg.egg-info/top_level.txt +1 -0
mcp_windbg-0.2.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sven Scharmentke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-windbg
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: A Model Context Protocol server providing tools to analyze Windows crash dumps using WinDBG/CDB
|
|
5
|
+
Author: svnscha
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: windbg,cdb,mcp,llm,crash-analysis
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: mcp>=1.17.0
|
|
16
|
+
Requires-Dist: pydantic>=2.12.0
|
|
17
|
+
Provides-Extra: test
|
|
18
|
+
Requires-Dist: pytest>=8.4.0; extra == "test"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# MCP Server for WinDBG Crash Analysis
|
|
22
|
+
|
|
23
|
+
A Model Context Protocol server providing tools to analyze Windows crash dumps and connect to remote debugging sessions using WinDBG/CDB.
|
|
24
|
+
|
|
25
|
+
<!-- mcp-name: io.github.svnscha/mcp-windbg -->
|
|
26
|
+
|
|
27
|
+
## Overview
|
|
28
|
+
|
|
29
|
+
This MCP server integrates with [CDB](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/opening-a-crash-dump-file-using-cdb) to enable AI models to:
|
|
30
|
+
- Analyze Windows crash dumps
|
|
31
|
+
- Connect to remote debugging sessions
|
|
32
|
+
- Execute WinDBG commands on both dump files and live debugging targets
|
|
33
|
+
|
|
34
|
+
## TL;DR
|
|
35
|
+
|
|
36
|
+
### What is this?
|
|
37
|
+
|
|
38
|
+
- Primarily, a tool that enables AI to interact with WinDBG for both crash dump analysis and live debugging.
|
|
39
|
+
- The whole "magic" is giving LLMs the ability to execute debugger commands on crash dumps or remote debugging targets. Used creatively, this is quite powerful and a big productivity improvement.
|
|
40
|
+
|
|
41
|
+
This means, that this is:
|
|
42
|
+
|
|
43
|
+
- A bridge connecting LLMs (AI) with WinDBG (CDB) for assisted crash dump analysis and remote debugging.
|
|
44
|
+
- A way to get immediate first-level triage analysis, useful for categorizing crash dumps or auto-analyzing simple cases.
|
|
45
|
+
- A platform for natural language-based "vibe" analysis, allowing you to ask the LLM to inspect specific areas:
|
|
46
|
+
- Examples for **crash dump analysis**:
|
|
47
|
+
- "Show me the call stack with `k` and explain what might be causing this access violation"
|
|
48
|
+
- "Execute `!peb` and tell me if there are any environment variables that might affect this crash"
|
|
49
|
+
- "Examine frame 3 and analyze the parameters passed to this function"
|
|
50
|
+
- "Use `dx -r2` on this object and explain its state" (equivalent to `dx -r2 ((MyClass*)0x12345678)`)
|
|
51
|
+
- "Analyze this heap address with `!heap -p -a 0xABCD1234` and check for buffer overflow"
|
|
52
|
+
- "Run `.ecxr` followed by `k` and explain the exception's root cause"
|
|
53
|
+
- Examples for **remote debugging**:
|
|
54
|
+
- "Connect to tcp:Port=5005,Server=192.168.0.100 and show me the current thread state"
|
|
55
|
+
- "Set a breakpoint on function XYZ and continue execution"
|
|
56
|
+
- "Check for timing issues in the thread pool with `!runaway` and `!threads`"
|
|
57
|
+
- "Examine memory around this address with `db/dw/dd` to identify corruption patterns"
|
|
58
|
+
- "Show me all threads with `~*k` and identify which one is causing the hang"
|
|
59
|
+
- ...and many other analytical approaches based on your specific debugging scenario
|
|
60
|
+
|
|
61
|
+
### What is this not?
|
|
62
|
+
|
|
63
|
+
- A magical solution that automatically fixes all issues.
|
|
64
|
+
- A full-featured product with custom AI. Instead, it's a **simple Python wrapper around CDB** that **relies** on the **LLM's WinDBG** expertise, best complemented by your own domain knowledge.
|
|
65
|
+
|
|
66
|
+
## Blog
|
|
67
|
+
|
|
68
|
+
I've written about the whole journey in blog.
|
|
69
|
+
|
|
70
|
+
- [The Future of Crash Analysis: AI Meets WinDBG](https://svnscha.de/posts/ai-meets-windbg/)
|
|
71
|
+
|
|
72
|
+
## Prerequisites
|
|
73
|
+
|
|
74
|
+
- Python 3.10 or higher
|
|
75
|
+
- Windows operating system with **Debugging Tools for Windows** installed.
|
|
76
|
+
- This is part of the [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/).
|
|
77
|
+
- A LLM supporting Model Context Protocol.
|
|
78
|
+
- I have tested with Claude 3.7 Sonnet through GitHub Copilot and I am pretty statisfied with the results.
|
|
79
|
+
- For GitHub Copilot, requires Model Context Protocol in Chat feature enabled.
|
|
80
|
+
- See [Extending Copilot Chat with the Model Context Protocol (MCP)](https://docs.github.com/en/copilot/customizing-copilot/extending-copilot-chat-with-mcp).
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## Development Setup
|
|
84
|
+
|
|
85
|
+
1. Clone the repository:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/svnscha/mcp-windbg.git
|
|
89
|
+
cd mcp-windbg
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
2. Create and activate a virtual environment:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
python -m venv .venv
|
|
96
|
+
.\.venv\Scripts\activate
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
3. Install the package in development mode:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install -e .
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
4. Install test dependencies:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install -e ".[test]"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Usage
|
|
112
|
+
|
|
113
|
+
### Integrating with VS Code
|
|
114
|
+
|
|
115
|
+
To integrate this MCP server with Visual Studio Code:
|
|
116
|
+
|
|
117
|
+
1. Create a `.vscode/mcp.json` file in your workspace with the following configuration:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"servers": {
|
|
122
|
+
"mcp_server_windbg": {
|
|
123
|
+
"type": "stdio",
|
|
124
|
+
"command": "${workspaceFolder}/.venv/Scripts/python",
|
|
125
|
+
"args": [
|
|
126
|
+
"-m",
|
|
127
|
+
"mcp_server_windbg"
|
|
128
|
+
],
|
|
129
|
+
"env": {
|
|
130
|
+
"_NT_SYMBOL_PATH": "SRV*C:\\Symbols*https://msdl.microsoft.com/download/symbols"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Alternatively, edit your user settings to enable it globally (independent of workspace).
|
|
138
|
+
Once added and with Model Context Protocol in Chat feature enabled, the tools from this model context protocol server are available in Agent mode.
|
|
139
|
+
|
|
140
|
+
That's how it should look like:
|
|
141
|
+
|
|
142
|
+

|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Starting the MCP Server (optional)
|
|
146
|
+
|
|
147
|
+
If integrated through Copilot, you don't need this. The IDE will auto-start the MCP.
|
|
148
|
+
|
|
149
|
+
Start the server using the module command:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
python -m mcp_server_windbg
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Command Line Options
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
python -m mcp_server_windbg [options]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Available options:
|
|
162
|
+
|
|
163
|
+
- `--cdb-path CDB_PATH`: Custom path to cdb.exe
|
|
164
|
+
- `--symbols-path SYMBOLS_PATH`: Custom symbols path
|
|
165
|
+
- `--timeout TIMEOUT`: Command timeout in seconds (default: 30)
|
|
166
|
+
- `--verbose`: Enable verbose output
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
2. Customize the configuration as needed:
|
|
170
|
+
- Adjust the Python interpreter path if needed
|
|
171
|
+
- Set custom paths for CDB by adding `"--cdb-path": "C:\\path\\to\\cdb.exe"` to the `args` array
|
|
172
|
+
- Set the symbol path environment variable as shown above, or add `"--symbols-path"` to the args
|
|
173
|
+
|
|
174
|
+
### Integration with Copilot
|
|
175
|
+
|
|
176
|
+
Once the server is configured in VS Code:
|
|
177
|
+
|
|
178
|
+
1. Enable MCP in Chat feature in Copilot settings
|
|
179
|
+
2. The MCP server will appear in Copilot's available tools
|
|
180
|
+
3. The WinDBG analysis capabilities will be accessible through Copilot's interface
|
|
181
|
+
4. You can now analyze crash dumps directly through Copilot using natural language queries
|
|
182
|
+
|
|
183
|
+
## Tools
|
|
184
|
+
|
|
185
|
+
This server provides the following tools:
|
|
186
|
+
|
|
187
|
+
### Crash Dump Analysis
|
|
188
|
+
- `open_windbg_dump`: Analyze a Windows crash dump file using common WinDBG commands
|
|
189
|
+
- `close_windbg_dump`: Unload a crash dump and release resources
|
|
190
|
+
|
|
191
|
+
### Remote Debugging
|
|
192
|
+
- `open_windbg_remote`: Connect to a remote debugging session using a connection string (e.g., `tcp:Port=5005,Server=192.168.0.100`)
|
|
193
|
+
- `close_windbg_remote`: Disconnect from a remote debugging session and release resources
|
|
194
|
+
|
|
195
|
+
### General Commands
|
|
196
|
+
- `run_windbg_cmd`: Execute a specific WinDBG command on either a loaded crash dump or active remote session
|
|
197
|
+
- `list_windbg_dumps`: List Windows crash dump (.dmp) files in the specified directory
|
|
198
|
+
|
|
199
|
+
## Running Tests
|
|
200
|
+
|
|
201
|
+
To run the tests:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
pytest
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Troubleshooting
|
|
208
|
+
|
|
209
|
+
### CDB Not Found
|
|
210
|
+
|
|
211
|
+
If you get a "CDB executable not found" error, make sure:
|
|
212
|
+
|
|
213
|
+
1. WinDBG/CDB is installed on your system
|
|
214
|
+
2. The CDB executable is in your system PATH, or
|
|
215
|
+
3. You specify the path using the `--cdb-path` option
|
|
216
|
+
|
|
217
|
+
### Symbol Path Issues
|
|
218
|
+
|
|
219
|
+
For proper crash analysis, set up your symbol path:
|
|
220
|
+
|
|
221
|
+
1. Use the `--symbols-path` parameter, or
|
|
222
|
+
2. Set the `_NT_SYMBOL_PATH` environment variable
|
|
223
|
+
|
|
224
|
+
### Common Symbol Paths
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
SRV*C:\Symbols*https://msdl.microsoft.com/download/symbols
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
MIT
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# MCP Server for WinDBG Crash Analysis
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol server providing tools to analyze Windows crash dumps and connect to remote debugging sessions using WinDBG/CDB.
|
|
4
|
+
|
|
5
|
+
<!-- mcp-name: io.github.svnscha/mcp-windbg -->
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This MCP server integrates with [CDB](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/opening-a-crash-dump-file-using-cdb) to enable AI models to:
|
|
10
|
+
- Analyze Windows crash dumps
|
|
11
|
+
- Connect to remote debugging sessions
|
|
12
|
+
- Execute WinDBG commands on both dump files and live debugging targets
|
|
13
|
+
|
|
14
|
+
## TL;DR
|
|
15
|
+
|
|
16
|
+
### What is this?
|
|
17
|
+
|
|
18
|
+
- Primarily, a tool that enables AI to interact with WinDBG for both crash dump analysis and live debugging.
|
|
19
|
+
- The whole "magic" is giving LLMs the ability to execute debugger commands on crash dumps or remote debugging targets. Used creatively, this is quite powerful and a big productivity improvement.
|
|
20
|
+
|
|
21
|
+
This means, that this is:
|
|
22
|
+
|
|
23
|
+
- A bridge connecting LLMs (AI) with WinDBG (CDB) for assisted crash dump analysis and remote debugging.
|
|
24
|
+
- A way to get immediate first-level triage analysis, useful for categorizing crash dumps or auto-analyzing simple cases.
|
|
25
|
+
- A platform for natural language-based "vibe" analysis, allowing you to ask the LLM to inspect specific areas:
|
|
26
|
+
- Examples for **crash dump analysis**:
|
|
27
|
+
- "Show me the call stack with `k` and explain what might be causing this access violation"
|
|
28
|
+
- "Execute `!peb` and tell me if there are any environment variables that might affect this crash"
|
|
29
|
+
- "Examine frame 3 and analyze the parameters passed to this function"
|
|
30
|
+
- "Use `dx -r2` on this object and explain its state" (equivalent to `dx -r2 ((MyClass*)0x12345678)`)
|
|
31
|
+
- "Analyze this heap address with `!heap -p -a 0xABCD1234` and check for buffer overflow"
|
|
32
|
+
- "Run `.ecxr` followed by `k` and explain the exception's root cause"
|
|
33
|
+
- Examples for **remote debugging**:
|
|
34
|
+
- "Connect to tcp:Port=5005,Server=192.168.0.100 and show me the current thread state"
|
|
35
|
+
- "Set a breakpoint on function XYZ and continue execution"
|
|
36
|
+
- "Check for timing issues in the thread pool with `!runaway` and `!threads`"
|
|
37
|
+
- "Examine memory around this address with `db/dw/dd` to identify corruption patterns"
|
|
38
|
+
- "Show me all threads with `~*k` and identify which one is causing the hang"
|
|
39
|
+
- ...and many other analytical approaches based on your specific debugging scenario
|
|
40
|
+
|
|
41
|
+
### What is this not?
|
|
42
|
+
|
|
43
|
+
- A magical solution that automatically fixes all issues.
|
|
44
|
+
- A full-featured product with custom AI. Instead, it's a **simple Python wrapper around CDB** that **relies** on the **LLM's WinDBG** expertise, best complemented by your own domain knowledge.
|
|
45
|
+
|
|
46
|
+
## Blog
|
|
47
|
+
|
|
48
|
+
I've written about the whole journey in blog.
|
|
49
|
+
|
|
50
|
+
- [The Future of Crash Analysis: AI Meets WinDBG](https://svnscha.de/posts/ai-meets-windbg/)
|
|
51
|
+
|
|
52
|
+
## Prerequisites
|
|
53
|
+
|
|
54
|
+
- Python 3.10 or higher
|
|
55
|
+
- Windows operating system with **Debugging Tools for Windows** installed.
|
|
56
|
+
- This is part of the [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/).
|
|
57
|
+
- A LLM supporting Model Context Protocol.
|
|
58
|
+
- I have tested with Claude 3.7 Sonnet through GitHub Copilot and I am pretty statisfied with the results.
|
|
59
|
+
- For GitHub Copilot, requires Model Context Protocol in Chat feature enabled.
|
|
60
|
+
- See [Extending Copilot Chat with the Model Context Protocol (MCP)](https://docs.github.com/en/copilot/customizing-copilot/extending-copilot-chat-with-mcp).
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Development Setup
|
|
64
|
+
|
|
65
|
+
1. Clone the repository:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/svnscha/mcp-windbg.git
|
|
69
|
+
cd mcp-windbg
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. Create and activate a virtual environment:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python -m venv .venv
|
|
76
|
+
.\.venv\Scripts\activate
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. Install the package in development mode:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install -e .
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
4. Install test dependencies:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install -e ".[test]"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Usage
|
|
92
|
+
|
|
93
|
+
### Integrating with VS Code
|
|
94
|
+
|
|
95
|
+
To integrate this MCP server with Visual Studio Code:
|
|
96
|
+
|
|
97
|
+
1. Create a `.vscode/mcp.json` file in your workspace with the following configuration:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"servers": {
|
|
102
|
+
"mcp_server_windbg": {
|
|
103
|
+
"type": "stdio",
|
|
104
|
+
"command": "${workspaceFolder}/.venv/Scripts/python",
|
|
105
|
+
"args": [
|
|
106
|
+
"-m",
|
|
107
|
+
"mcp_server_windbg"
|
|
108
|
+
],
|
|
109
|
+
"env": {
|
|
110
|
+
"_NT_SYMBOL_PATH": "SRV*C:\\Symbols*https://msdl.microsoft.com/download/symbols"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Alternatively, edit your user settings to enable it globally (independent of workspace).
|
|
118
|
+
Once added and with Model Context Protocol in Chat feature enabled, the tools from this model context protocol server are available in Agent mode.
|
|
119
|
+
|
|
120
|
+
That's how it should look like:
|
|
121
|
+
|
|
122
|
+

|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Starting the MCP Server (optional)
|
|
126
|
+
|
|
127
|
+
If integrated through Copilot, you don't need this. The IDE will auto-start the MCP.
|
|
128
|
+
|
|
129
|
+
Start the server using the module command:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
python -m mcp_server_windbg
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Command Line Options
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
python -m mcp_server_windbg [options]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Available options:
|
|
142
|
+
|
|
143
|
+
- `--cdb-path CDB_PATH`: Custom path to cdb.exe
|
|
144
|
+
- `--symbols-path SYMBOLS_PATH`: Custom symbols path
|
|
145
|
+
- `--timeout TIMEOUT`: Command timeout in seconds (default: 30)
|
|
146
|
+
- `--verbose`: Enable verbose output
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
2. Customize the configuration as needed:
|
|
150
|
+
- Adjust the Python interpreter path if needed
|
|
151
|
+
- Set custom paths for CDB by adding `"--cdb-path": "C:\\path\\to\\cdb.exe"` to the `args` array
|
|
152
|
+
- Set the symbol path environment variable as shown above, or add `"--symbols-path"` to the args
|
|
153
|
+
|
|
154
|
+
### Integration with Copilot
|
|
155
|
+
|
|
156
|
+
Once the server is configured in VS Code:
|
|
157
|
+
|
|
158
|
+
1. Enable MCP in Chat feature in Copilot settings
|
|
159
|
+
2. The MCP server will appear in Copilot's available tools
|
|
160
|
+
3. The WinDBG analysis capabilities will be accessible through Copilot's interface
|
|
161
|
+
4. You can now analyze crash dumps directly through Copilot using natural language queries
|
|
162
|
+
|
|
163
|
+
## Tools
|
|
164
|
+
|
|
165
|
+
This server provides the following tools:
|
|
166
|
+
|
|
167
|
+
### Crash Dump Analysis
|
|
168
|
+
- `open_windbg_dump`: Analyze a Windows crash dump file using common WinDBG commands
|
|
169
|
+
- `close_windbg_dump`: Unload a crash dump and release resources
|
|
170
|
+
|
|
171
|
+
### Remote Debugging
|
|
172
|
+
- `open_windbg_remote`: Connect to a remote debugging session using a connection string (e.g., `tcp:Port=5005,Server=192.168.0.100`)
|
|
173
|
+
- `close_windbg_remote`: Disconnect from a remote debugging session and release resources
|
|
174
|
+
|
|
175
|
+
### General Commands
|
|
176
|
+
- `run_windbg_cmd`: Execute a specific WinDBG command on either a loaded crash dump or active remote session
|
|
177
|
+
- `list_windbg_dumps`: List Windows crash dump (.dmp) files in the specified directory
|
|
178
|
+
|
|
179
|
+
## Running Tests
|
|
180
|
+
|
|
181
|
+
To run the tests:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pytest
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Troubleshooting
|
|
188
|
+
|
|
189
|
+
### CDB Not Found
|
|
190
|
+
|
|
191
|
+
If you get a "CDB executable not found" error, make sure:
|
|
192
|
+
|
|
193
|
+
1. WinDBG/CDB is installed on your system
|
|
194
|
+
2. The CDB executable is in your system PATH, or
|
|
195
|
+
3. You specify the path using the `--cdb-path` option
|
|
196
|
+
|
|
197
|
+
### Symbol Path Issues
|
|
198
|
+
|
|
199
|
+
For proper crash analysis, set up your symbol path:
|
|
200
|
+
|
|
201
|
+
1. Use the `--symbols-path` parameter, or
|
|
202
|
+
2. Set the `_NT_SYMBOL_PATH` environment variable
|
|
203
|
+
|
|
204
|
+
### Common Symbol Paths
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
SRV*C:\Symbols*https://msdl.microsoft.com/download/symbols
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## License
|
|
211
|
+
|
|
212
|
+
MIT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-windbg"
|
|
3
|
+
version = "0.2.1"
|
|
4
|
+
description = "A Model Context Protocol server providing tools to analyze Windows crash dumps using WinDBG/CDB"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
authors = [{ name = "svnscha" }]
|
|
8
|
+
keywords = ["windbg", "cdb", "mcp", "llm", "crash-analysis"]
|
|
9
|
+
license = "MIT"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.10",
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"mcp>=1.17.0",
|
|
18
|
+
"pydantic>=2.12.0",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
mcp-windbg = "mcp_server_windbg:main"
|
|
23
|
+
|
|
24
|
+
[build-system]
|
|
25
|
+
requires = ["setuptools>=42", "wheel"]
|
|
26
|
+
build-backend = "setuptools.build_meta"
|
|
27
|
+
|
|
28
|
+
[dependency-groups]
|
|
29
|
+
dev = [
|
|
30
|
+
"pytest>=8.4.0",
|
|
31
|
+
"twine>=6.2.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[tool.pytest.ini_options]
|
|
35
|
+
testpaths = ["src/mcp_server_windbg/tests"]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
test = ["pytest>=8.4.0"]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .server import serve
|
|
2
|
+
|
|
3
|
+
def main():
|
|
4
|
+
"""MCP WinDBG Server - Windows crash dump analysis functionality for MCP"""
|
|
5
|
+
import argparse
|
|
6
|
+
import asyncio
|
|
7
|
+
|
|
8
|
+
parser = argparse.ArgumentParser(
|
|
9
|
+
description="Give a model the ability to analyze Windows crash dumps with WinDBG/CDB"
|
|
10
|
+
)
|
|
11
|
+
parser.add_argument("--cdb-path", type=str, help="Custom path to cdb.exe")
|
|
12
|
+
parser.add_argument("--symbols-path", type=str, help="Custom symbols path")
|
|
13
|
+
parser.add_argument("--timeout", type=int, default=30, help="Command timeout in seconds")
|
|
14
|
+
parser.add_argument("--verbose", action="store_true", help="Enable verbose output")
|
|
15
|
+
|
|
16
|
+
args = parser.parse_args()
|
|
17
|
+
asyncio.run(serve(
|
|
18
|
+
cdb_path=args.cdb_path,
|
|
19
|
+
symbols_path=args.symbols_path,
|
|
20
|
+
timeout=args.timeout,
|
|
21
|
+
verbose=args.verbose
|
|
22
|
+
))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == "__main__":
|
|
26
|
+
main()
|