UnitTestMcp.Server 1.0.7

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global UnitTestMcp.Server --version 1.0.7
                    
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 UnitTestMcp.Server --version 1.0.7
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=UnitTestMcp.Server&version=1.0.7
                    
nuke :add-package UnitTestMcp.Server --version 1.0.7
                    

UnitTestMcp

An MCP (Model Context Protocol) server for analyzing code coverage from MTP (Microsoft Testing Platform) based .NET test projects. Parses Cobertura XML coverage reports and exposes coverage data through MCP tools for AI-assisted development workflows.

Features

  • Parse Cobertura XML coverage reports (the standard output from dotnet test with code coverage)
  • Query missed lines and branches for individual source files
  • Get overall coverage for classes, methods, projects, and entire solutions
  • Generate comprehensive missed coverage reports across a solution
  • Discover and merge multiple coverage reports automatically

Prerequisites

  • .NET 10 SDK or later
  • An MTP-compatible test framework (e.g., TUnit, MSTest, xUnit v3)
  • Code coverage collection configured (via testconfig.json or CLI flags)

Installation

dotnet tool install --global UnitTestMcp.Server

Or run directly from source:

cd src
dotnet run --project UnitTestMcp.Server

MCP Tools

Tool Description
GetMissedCoverageForFile Gets missed lines and branches for a specific source file
GetClassCoverage Gets overall coverage summary for a specific class
GetMethodCoverage Gets overall coverage summary for a specific method
GetProjectCoverage Gets overall coverage summary for a specific project/package
GetSolutionCoverage Gets overall coverage summary for an entire solution
GetSolutionMissedCoverage Gets a detailed report of ALL missed lines and branches across a solution

Usage

Generating Coverage Reports

With MTP, code coverage is configured via testconfig.json and the Microsoft.Testing.Extensions.CodeCoverage extension. Add the extension to your test project and configure it for Cobertura output:

{
    "extensions": [
        {
            "extensionId": "Microsoft.Testing.Extensions.CodeCoverage",
            "settings": {
                "format": "cobertura"
            }
        }
    ]
}

Then run your tests normally:

dotnet test

Configuring as an MCP Server

Add to your Claude Code MCP configuration (~/.claude/claude_desktop_config.json):

{
  "mcpServers": {
    "dotnet-mtp-coverage-mcp": {
      "command": "dotnet-mtp-coverage-mcp",
      "args": []
    }
  }
}

Cobertura XML Format

This tool expects Cobertura XML format, which is the standard output from the Microsoft.Testing.Extensions.CodeCoverage extension when configured with "format": "cobertura" in testconfig.json.

Building

cd src
dotnet build

Running Tests

cd src
dotnet test

Project Structure

src/
  UnitTestMcp.Core/         # Core library: models, parsers, services
    Models/                  # Coverage data models (records)
    Parsers/                 # Cobertura XML parser
    Services/                # Coverage query service
  UnitTestMcp.Server/        # MCP server executable
    Tools/                   # MCP tool definitions
  tests/
    UnitTestMcp.Tests/       # TUnit tests
      TestData/              # Sample Cobertura XML fixtures

Attribution

The Cobertura XML parsing logic and coverage data model concepts in this project are adapted from ReportGenerator by Daniel Palme, licensed under the Apache License 2.0. ReportGenerator is a comprehensive code coverage report generation tool that supports many input and output formats.

License

MIT License - Copyright (c) 2026 Glenn Watson. See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.11 72 3/8/2026
1.0.10 69 3/8/2026
1.0.7 65 3/8/2026