Skip to main content

Getting Started

Get debug-mcp running and perform your first debugging session in minutes.

See It in Action

Loading terminal recording...

Prerequisites

Install

The recommended way to run debug-mcp is via dnx:

dnx -y debug-mcp

Configure Your AI Agent

Claude Code / Claude Desktop

Add to your MCP configuration (settings.json or claude_desktop_config.json):

{
"mcpServers": {
"dotnet-debugger": {
"command": "dnx",
"args": ["-y", "debug-mcp"]
}
}
}

Other MCP Clients

debug-mcp communicates via MCP over stdio. Any MCP-compatible client can use it:

dnx -y debug-mcp

Verify It Works

Ask your AI agent:

"What debug-mcp tools are available?"

You should see a list of 34 tools including debug_launch, breakpoint_set, and evaluate.

Your First Debugging Session

Let's debug a simple .NET application step by step.

1. Launch the application

"Launch /path/to/MyApp.dll and stop at the entry point"

The process starts and pauses immediately at Main().

Tool call details

Request (debug_launch):

{
"program": "/path/to/MyApp.dll",
"stop_at_entry": true
}

2. Set a breakpoint

"Set a breakpoint at line 25 in Program.cs"

The agent maps the file and line to an IL offset and creates the breakpoint.

Tool call details

Request (breakpoint_set):

{
"file": "Program.cs",
"line": 25
}

3. Continue and wait

"Continue execution and wait for the breakpoint"

The agent calls debug_continue, then breakpoint_wait. Execution resumes until line 25 is hit.

4. Inspect variables

"Show me the local variables"

The agent retrieves all local variables, arguments, and this for the current frame.

Tool call details

Request (variables_get):

{
"scope": "all"
}

5. Evaluate an expression

"What is the value of items.Count?"

The agent evaluates the expression in the context of the stopped thread and returns the result.

Tool call details

Request (evaluate):

{
"expression": "items.Count"
}

6. Disconnect

"Stop debugging"

The agent terminates the process and ends the session.

Tool call details

Request (debug_disconnect):

{
"terminate": true
}

Static Code Analysis

debug-mcp also provides Roslyn-based code analysis tools that work without running the debugger.

Load a solution

"Load the solution at /path/to/MyApp.sln for code analysis"

Tool call details

Request (code_load):

{
"path": "/path/to/MyApp.sln"
}

Find all usages

"Find all usages of the UserService class"

Tool call details

Request (code_find_usages):

{
"name": "MyApp.Services.UserService",
"symbolKind": "Type"
}

Check for errors

"Are there any compilation errors?"

Tool call details

Request (code_get_diagnostics):

{
"minSeverity": "Error"
}

What's Next?