Skip to content

imskull/VSDebuggerMCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VSDebuggerMCP

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.

Requirements

  • Windows
  • Visual Studio 2022 (any edition)
  • .NET 8 SDK (to build) / .NET 8 Desktop Runtime (to run)

Build

dotnet build VSDebuggerMCP.sln -c Debug

The server executable is produced at src\VSDebuggerMCP\bin\Debug\net8.0-windows\VSDebuggerMCP.exe.

Register with Claude Code

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"

How it works

  • All COM access runs on one dedicated STA thread with a WPF Dispatcher, which also pumps the messages that let Visual Studio's DebuggerEvents fire.
  • An IOleMessageFilter retries 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.

Tools

Connectionlist_vs_instances, connect, disconnect, get_status

Breakpointsset_breakpoint, set_function_breakpoint, list_breakpoints, remove_breakpoint, remove_all_breakpoints, enable_breakpoint

Executionstart_debugging, attach_to_process, continue, break_all, stop_debugging, step_into, step_over, step_out, run_to_cursor, wait_for_break

Inspectionlist_threads, select_thread, select_frame, get_call_stack, get_locals, evaluate, set_variable

Typical Unreal Engine workflow

  1. Open your .sln (e.g. MiniProject.sln) in Visual Studio 2022.
  2. list_vs_instancesconnect to it.
  3. set_breakpoint in a .cpp file.
  4. Either start_debugging (F5), or — if UnrealEditor.exe is already running — attach_to_process("UnrealEditor.exe") (attaches with the Native engine).
  5. Trigger the code path; wait_for_break reports where execution stopped.
  6. Inspect with get_call_stack, get_locals, evaluate (Unreal .natvis visualizers such as FString / TArray are applied automatically).
  7. step_over / continue to advance; stop_debugging when done.

Notes & limitations

  • Visual Studio expression evaluation only works while the debugger is in break mode; the inspection tools report a clear error otherwise.
  • EnvDTE.StackFrame exposes no file/line, so get_call_stack returns function, module and language per frame. The current stop location (file/line) comes from get_status / wait_for_break.
  • Breakpoint ids are 1-based collection indexes and are reassigned after any removal — call list_breakpoints again before removing another.
  • Large Unreal solutions load symbols slowly; give attach_to_process and wait_for_break generous timeouts.

About

A Model Context Protocol (MCP) tool for debugging C++ projects in Visual Studio.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages