mcp-netcoredbg
An MCP server that enables AI agents to debug .NET applications using netcoredbg. It supports core debugging tasks like setting breakpoints, stepping through code, and inspecting variables or stack traces.
README
mcp-netcoredbg
MCP server for .NET debugging via netcoredbg.
Enables AI agents (Claude, etc.) to set breakpoints, step through code, and inspect variables in .NET applications.
Architecture
┌─────────┐ MCP ┌─────────────────┐ DAP ┌─────────────┐
│ Claude │ ──────────► │ mcp-netcoredbg │ ──────────► │ netcoredbg │
│ │ (tools) │ (this repo) │ (stdio) │ (Samsung) │
└─────────┘ └─────────────────┘ └──────┬──────┘
│
▼
┌─────────────┐
│ .NET App │
└─────────────┘
Tools
| Tool | Description |
|---|---|
launch |
Start debugging a .NET application (DLL path) |
attach |
Attach to a running .NET process |
invoke |
Invoke a specific method in an assembly (with optional debugging) |
set_breakpoint |
Set breakpoint at file:line (supports conditions) |
remove_breakpoint |
Remove a breakpoint |
list_breakpoints |
List all active breakpoints |
continue |
Continue execution |
pause |
Pause execution |
step_over |
Step over current line |
step_into |
Step into function call |
step_out |
Step out of current function |
stack_trace |
Get current call stack |
scopes |
Get variable scopes for a stack frame |
variables |
Get variables from a scope |
evaluate |
Evaluate expression in debug context |
threads |
List all threads |
output |
Get recent program output |
status |
Get debugger status |
terminate |
Stop debugging session |
Method Invocation (invoke)
The invoke tool lets you run a specific method from a .NET assembly without launching the full application. This is useful for:
- Testing individual methods in isolation
- Running utility functions
- Debugging specific code paths without going through the whole app
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
assembly |
string | Yes | Path to the .NET DLL |
type |
string | Yes | Fully qualified type name (e.g., MyApp.Services.Calculator) |
method |
string | Yes | Method name to invoke |
args |
array | No | Method arguments as JSON array |
ctorArgs |
array | No | Constructor arguments (for instance methods) |
debug |
boolean | No | Launch under debugger for breakpoint support (default: false) |
cwd |
string | No | Working directory |
Examples
Static method:
{
"assembly": "/path/to/MyApp.dll",
"type": "MyApp.StringUtils",
"method": "FormatName",
"args": ["John", "Doe"]
}
Instance method with constructor arguments:
{
"assembly": "/path/to/MyApp.dll",
"type": "MyApp.Calculator",
"method": "Add",
"args": [5],
"ctorArgs": [10]
}
With debugging (breakpoints supported):
{
"assembly": "/path/to/MyApp.dll",
"type": "MyApp.Calculator",
"method": "Add",
"args": [5],
"debug": true
}
Features
- Static methods: Just provide type, method, and args
- Instance methods: Automatically constructs the type (provide
ctorArgsif needed) - Auto ILogger injection:
ILogger<T>parameters are automatically resolved - Async support: Automatically awaits Task-returning methods
- Console capture: Captures
Console.WriteLineoutput - Log capture: Captures
ILoggercalls made during execution - Rich errors: On failure, shows available constructors/methods to help you fix the call
Output Format
The tool returns a structured JSON result:
{
"success": true,
"method": "MyApp.StringUtils.FormatName",
"args": ["John", "Doe"],
"returnType": "string",
"returnValue": "Doe, John",
"durationMs": 2.5,
"logs": [
{"level": "Information", "message": "Processing..."}
],
"stdout": ""
}
On error, it provides helpful diagnostics:
{
"success": false,
"error": "Method not found",
"errorDetails": {
"type": "MyApp.StringUtils",
"reason": "Method 'DoSomething' not found",
"methods": [
{"name": "FormatName", "params": ["string firstName", "string lastName"], "returnType": "string", "isStatic": true}
]
}
}
Prerequisites
- netcoredbg installed and in PATH
- Node.js 18+
- .NET SDK 8.0+ (for building the harness and target applications)
Installation
# Install netcoredbg (example for Linux x64)
curl -sLO https://github.com/Samsung/netcoredbg/releases/download/3.1.3-1062/netcoredbg-linux-amd64.tar.gz
tar xzf netcoredbg-linux-amd64.tar.gz
sudo mv netcoredbg /opt/netcoredbg
sudo ln -sf /opt/netcoredbg/netcoredbg /usr/local/bin/netcoredbg
# Build this MCP server
npm install
npm run build
# The method invocation harness is auto-built on first use
Usage with Claude Code
Quick install:
# Clone and build
git clone https://github.com/AerialByte/mcp-netcoredbg.git
cd mcp-netcoredbg && npm install && npm run build
# Add to Claude Code
claude mcp add netcoredbg -- node $(pwd)/dist/index.js
Or manually add to your Claude Code MCP settings:
{
"mcpServers": {
"netcoredbg": {
"command": "node",
"args": ["/path/to/mcp-netcoredbg/dist/index.js"]
}
}
}
Security
This tool launches and controls a debugger. By design, it can:
- Execute arbitrary .NET applications
- Evaluate expressions within the debugged process
- Inspect memory and variables
Only use this with code you trust. Do not debug untrusted applications.
Example Session
Full Application Debugging
- Build your .NET app with debug symbols:
dotnet build --configuration Debug - Launch debugger:
launchwith the DLL path - Set breakpoints:
set_breakpointat file:line - Continue/step through code
- Inspect variables with
scopesandvariables - Evaluate expressions with
evaluate - Terminate when done
Method Invocation (Quick Testing)
- Build the target assembly:
dotnet build - Use
invokewith the type and method name - If it fails, check the error for available constructors/methods
- For debugging: set breakpoints first, then use
invokewithdebug: true
Agent Guidelines
When using this MCP server as an AI agent:
Choosing Between launch and invoke
- Use
invokewhen you want to test a specific method in isolation - Use
launchwhen you need to run the full application or debug complex scenarios
Using invoke Effectively
-
Start simple: Try without
ctorArgsfirst - the harness will use parameterless constructors or auto-injectILogger<T> -
Handle errors iteratively: If invocation fails, the error response includes available methods/constructors. Use this to correct your call.
-
For debugging specific methods:
1. Set breakpoints in the source files first 2. Call invoke with debug: true 3. Use continue/step_over/step_into to navigate 4. Use output to see the final result -
Arguments are JSON: Pass args as a JSON array. The harness handles type conversion:
- Strings:
"hello" - Numbers:
42,3.14 - Booleans:
true,false - Null:
null - Objects:
{"name": "Alice", "age": 30}
- Strings:
Common Patterns
Testing a utility method:
invoke assembly=/path/to.dll type=MyApp.Utils method=Parse args=["input"]
Testing with constructor injection:
invoke assembly=/path/to.dll type=MyApp.Service method=Process ctorArgs=[100] args=["data"]
Debugging a failing method:
1. set_breakpoint file=/path/to/Service.cs line=42
2. invoke assembly=/path/to.dll type=MyApp.Service method=Process args=["bad-input"] debug=true
3. (breakpoint hits)
4. variables variablesReference=1
5. continue
6. output
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。