An MCP server that drives the Visual Studio debugger, so an AI agent can debug native C++ projects — including Unreal Engine projects — by setting breakpoints, attaching to processes, stepping, and inspecting runtime state.
It is a standalone .NET console app that connects to an already-running Visual
Studio 2022 instance over COM automation (EnvDTE) and exposes the debugger as
MCP tools over stdio.
- Windows
- Visual Studio 2022 (any edition)
- .NET 8 SDK (to build) / .NET 8 Desktop Runtime (to run)
dotnet build VSDebuggerMCP.sln -c DebugThe server executable is produced at
src\VSDebuggerMCP\bin\Debug\net8.0-windows\VSDebuggerMCP.exe.
A sample .mcp.json is included. Either copy it into your project,
or run:
claude mcp add vsdebugger -- "D:\Work\VSDebuggerMCP\src\VSDebuggerMCP\bin\Debug\net8.0-windows\VSDebuggerMCP.exe"- All COM access runs on one dedicated STA thread with a WPF
Dispatcher, which also pumps the messages that let Visual Studio'sDebuggerEventsfire. - An
IOleMessageFilterretries calls that Visual Studio rejects while it is busy (building, indexing, showing a dialog). - Running VS instances are found by walking the COM Running Object Table.
Connection — list_vs_instances, connect, disconnect, get_status
Breakpoints — set_breakpoint, set_function_breakpoint, list_breakpoints,
remove_breakpoint, remove_all_breakpoints, enable_breakpoint
Execution — start_debugging, attach_to_process, continue, break_all,
stop_debugging, step_into, step_over, step_out, run_to_cursor,
wait_for_break
Inspection — list_threads, select_thread, select_frame, get_call_stack,
get_locals, evaluate, set_variable
- Open your
.sln(e.g.MiniProject.sln) in Visual Studio 2022. list_vs_instances→connectto it.set_breakpointin a.cppfile.- Either
start_debugging(F5), or — ifUnrealEditor.exeis already running —attach_to_process("UnrealEditor.exe")(attaches with the Native engine). - Trigger the code path;
wait_for_breakreports where execution stopped. - Inspect with
get_call_stack,get_locals,evaluate(Unreal.natvisvisualizers such asFString/TArrayare applied automatically). step_over/continueto advance;stop_debuggingwhen done.
- Visual Studio expression evaluation only works while the debugger is in break mode; the inspection tools report a clear error otherwise.
EnvDTE.StackFrameexposes no file/line, soget_call_stackreturns function, module and language per frame. The current stop location (file/line) comes fromget_status/wait_for_break.- Breakpoint ids are 1-based collection indexes and are reassigned after any
removal — call
list_breakpointsagain before removing another. - Large Unreal solutions load symbols slowly; give
attach_to_processandwait_for_breakgenerous timeouts.