ExplainExceptionMCP 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global ExplainExceptionMCP --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local ExplainExceptionMCP --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ExplainExceptionMCP&version=1.0.0
                    
nuke :add-package ExplainExceptionMCP --version 1.0.0
                    

explain-exception-mcp

一个用于解释 C#/.NET 异常的 stdio MCP server。

它主要做三件事:

  1. 从异常文本或 stack trace 中解析源码文件、行号和方法名。
  2. 在本地工作区读取对应源码上下文。
  3. 构建异常分析提示词,交给支持 MCP 的客户端继续调用 LLM 分析。

Tools

  • ParseStackTrace: 从异常文本或 stack trace 解析源码文件、行号和方法名。
  • GetCodeContext: 读取目标文件目标行附近的代码上下文。
  • AnalyzeException: 将异常和代码上下文组装成分析提示词,不直接调用 LLM。
  • ExplainException: 端到端执行解析 stack trace、读取代码上下文、构建分析提示词。

Installation

Install from NuGet as a .NET global tool:

dotnet tool install -g ExplainExceptionMCP

Update an existing installation:

dotnet tool update -g ExplainExceptionMCP

Verify the command is available:

explain-exception-mcp

This is a stdio MCP server, so it will wait for MCP JSON-RPC messages on standard input. It is normal for the process to keep running without printing an HTTP URL.

MCP Client Configuration

After installing the NuGet global tool, configure your MCP client to run the tool command directly.

{
  "mcpServers": {
    "explain-exception-mcp": {
      "command": "explain-exception-mcp"
    }
  }
}

If your MCP client cannot find .NET global tools from PATH, use the full path to the generated shim.

Windows example:

{
  "mcpServers": {
    "explain-exception-mcp": {
      "command": "C:\\Users\\YOUR_USER_NAME\\.dotnet\\tools\\explain-exception-mcp.exe"
    }
  }
}

macOS/Linux example:

{
  "mcpServers": {
    "explain-exception-mcp": {
      "command": "/home/YOUR_USER_NAME/.dotnet/tools/explain-exception-mcp"
    }
  }
}

Usage Example

Ask your MCP client to call ExplainException with a .NET stack trace and, when useful, the local workspace root:

Use explain-exception-mcp to analyze this exception.
workspaceRoot: C:\path\to\your\repo

System.NullReferenceException: Object reference not set to an instance of an object.
   at Demo.Services.OrderService.CalculateTotal() in C:\path\to\your\repo\Services\OrderService.cs:line 42

Local Development

For contributors working from source:

dotnet run --project .\ExplainExceptionMCP\ExplainExceptionMCP.csproj

Run tests:

dotnet test .\ExplainExceptionMCP.Tests\ExplainExceptionMCP.Tests.csproj
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.1 87 5/7/2026
1.0.0 79 5/7/2026