Edit Template

Using MCP for Debugging, Reversing, and Threat Analysis

Earlier this year, Sven Scharmentke wrote an article entitled The Future of Crash Analysis: AI Meets WinDBG, documenting a fascinating project using AI to analyze Windows crash dumps. Specifically, it uses Model Context Protocol (MCP) as an interface between an LLM, GitHub Copilot within Visual Studio Code, and a crashdump file to query and explain root cause of an application crash. I found this article fascinating, as it’s yet another step in democratizing both the creation and triage of bad code, with applications in debugging, reverse engineering and threat analysis. What this means is that it’s now possible for people of less experience to interact with complex tools in natural language to do malware research; and subject matter experts to easily get an “AI Assist” in performing the above.

Why is this important? As I covered in my webinar Advanced Threat Analysis and Reverse Engineering using AI, IDA, and the SourcePoint JTAG Debugger, AI, when used properly, allows engineers to increase their productivity and output. It can abstract away the complexity of some tools that can take months or even years to master; and one example of that is Microsoft’s WinDbg application. Although it does support a GUI, it originated as a Command Line Interface (CLI) tool, and most of its raw power is not available within the visual interface. This applies in particular to its Language-Integrated Query (LINQ) syntax support, to query debugger objects; here’s an example:

dx -g Debugger.Sessions.First().Processes.Select(p => new { Name = p.Name, ThreadCount = p.Threads.Count() }).OrderByDescending(p => p.ThreadCount),5

Although it might not be obvious to the uninitiated, the above identifies the top 5 processes with the most threads in a debug session. Easy, right? 😊

As Sven has said, and I quote:

Let’s face it – while the rest of software development has evolved at warp speed, crash dump analysis feels like it’s been preserved in digital amber for decades. We’ve got self-driving cars and pocket-sized supercomputers, yet here we are, still pecking away at command prompts like it’s the dawn of the internet. Why is debugging the only area where we cling to tools that look like they belong in a computer history museum?

Picture this: You, a professional software engineer in 2025, hunched over a terminal, manually typing arcane commands like !analyze -v and .ecxr, squinting at hexadecimal memory addresses, and mentally translating stack traces. All while your friends in other industries are delegating their work to AI assistants that can write entire documents, create art, or automate complex workflows.

Something’s wrong with this picture, right?

And Sven’s article just touches the tip of the iceberg; this technology has a huge potential to extend beyond simple Windows crash dump analysis, as I’ll write about in a later edition in this series.  

But first, some background: the essence of this project was to develop a tool that enables AI to interact with WinDbg for both crash dump analysis and live debugging, using Model Context Protocol (MCP). MCP is an open standard, developed by Anthropic, that allows AI systems like large language models (LLMs) to efficiently interact with external tools and data sources. It connects many tools together and allows for a natural language interface to them: for example, for a marketer, a simple prompt like “please generate my weekly performance report for last week” could allow instant read/write connections to a company’s HubSpot, Google Analytics, Salesforce, LinkedIn, and other accounts to gather and update data. But MCP is new, with documented vulnerabilities in authentication and authorization, supply chain risks, exposure to malicious prompt injections, and many more risks.

If you’re interested in these topics, an excellent reference is in the Git repository Model Context Protocol Servers, where the different categories of MCP servers are listed, with some caveats:

Reference Servers
These servers aim to demonstrate MCP features and the official SDKs.

Third-Party Servers
Official integrations are maintained by companies building production-ready MCP servers for their platforms.

Community Servers
A growing set of community-developed and maintained servers demonstrates various applications of MCP across different domains.
Note:
Community servers are untested and should be used at your own risk. They are not affiliated with or endorsed by Anthropic.

Quick note: if you are interested in extending GitHub Copilot with MCP to other IDEs other than VS Code, this is an excellent reference: https://docs.github.com/en/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp.

Sven’s project is clearly in a development stage, and is documented in his Git repository, complete with source code and examples: https://github.com/svnscha/mcp-windbg. The README, although well-written, assumes a level of knowledge that some non-programmers and those new to WinDbg might not have. As such, I’ve created a tutorial below to help newcomers get started. Note that I have a brand-new PC, so I started everything from scratch, perhaps making it more helpful for novices. I want to help mass adoption of this technology – even for those who might not be developers themselves. So, here comes the tutorial, so anyone with a modicum of experience can follow:

  • Install Visual Studio Code and the Python extension. Run VS Code.

The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the About Execution Policies help topic mentioned above. You’ll be prompted to confirm that you want to change the execution policy.

But I do trust Sven.  😊

  • From within the VS Code Terminal window, clone the repository, and change directories into it:

Just as an aside, for future developments, integrating the MCP server with VS Code is accomplished by placing an mcp.json file with the below contents into the .vscode directory (it should be already there):

  • At the bottom right of the GitHub Copilot Chat window, select “Agent” (from the choice of Agent, Ask and Edit) and the model you want (I used Claude Sonnet 3.5 at this time of writing, but there are other choices available, including Manage Models and Add Premium Models – wow).
  • From here on in, it should be smooth sailing. You can use GitHub Copilot to help you ensure that WinDbg (actually, it’s CLI foundation, which is CDB, short for Console Debugger) is installed, Windows SDK is present, the demo crashdump file is available, etc. etc. Here’s the unabridged Chat window (where I made a bunch of mistakes, so you won’t have to) from Copilot within VS Code, for those who might want to follow along:

You can see that I ran the open_windbg_dump to automatically find and analyze the DemoCrash1.exe.7088.dmp. That is extremely cool. After a few missteps on my part, it did a great job of providing root cause insight into the crash.

I wanted to point something out to those who might wonder about using both GitHub Copilot AND Claude Sonnet 3.5 in the example above…aren’t they both LLMs and chatbots? And the answer is emphatically no in this instance: Copilot is the front end service within the VS Code UI, and Claude is the back end LLM. In other words, Copilot is just a VS Code extension that uses the Claude LLM behind the scenes. So, when I asked for help in setting up the environment variables, it was Claude that gave the answer, and Copilot relayed it to me.

And one other thing: I’m often asked about how many tokens these researches take, and if all of this can be done via the free versions of the LLMs and applications, or if we have to upgrade to the paid versions. For myself, I upgraded to ChatGPT Pro ($20/month) quite some time ago, as I wanted the largest token context window I could get (within my budget, of course); which appears to be 32K tokens for the Plus plan, and 8K tokens for the Free plan. I did this to process large Intel Processor Trace files per my prior blog: Microsoft WinDbg Time Travel Debugging versus Intel Processor Trace. And early in the work for this blog, Microsoft paused my questions for a period of time, asking for the upgrade to GitHub Copilot Pro ($10/month). I did this upgrade as well, and haven’t run into any pauses since. Yes, it’s an expense, but in my mind, very much worth it.

If you want to see the whole MCP/WinDbg configuration process visually, check out my video here:

Setting up VS Code, MCP Server, and WinDbg crashdump analysis

Where do we go from here? I believe that this is a new and emerging technology approach that will play a huge role in the future of offensive security engagements. In a previous White Knight Labs blog post, Understanding Null Pointer Dereference in Windows Kernel Drivers, we explored similar access violations, but within the Windows kernel. We’ll see how MCP is used to triage Windows kernel driver vulnerabilities in a future post.

Edit Template