hyeonu-cha avatar

Dotnet Coverage Mcp

hyeonu-cha/dotnet-coverage-mcp

Wraps the .NET test coverage toolchain so Claude can run dotnet test, parse Cobertura XML, and identify untested branches without you leaving the chat. Exposes eight tools: GetSourceFiles to discover code and batch by line budget, RunTestsWithCoverage to collect XPlat coverage, GetCoverageSummary for method level stats, GetFileCoverage to check per file targets, GetUncoveredBranches to find missing conditionals, GetCoverageDiff to compare runs, AppendTestCode to insert new test methods atomically, and CleanupSession to remove artifacts. Supports concurrent sessions via sessionId isolation and filesystem sandboxing through COVERAGE_MCP_ALLOWED_ROOT. Requires .NET 9 SDK and the reportgenerator global tool. Designed for batch workflows where you run tests once then parse coverage for many files to minimize test overhead.

tools
8
transport
STDIO
env vars
2
last updated
May 5, 2026

Tools

8 tools

Public tool metadata for what this MCP can expose to an agent.

GetSourceFilesDiscover .cs files from a file, folder, or .csproj project. Returns file metadata (lines, method count) and smart batches grouped by lineBudget.

Discover .cs files from a file, folder, or .csproj project. Returns file metadata (lines, method count) and smart batches grouped by lineBudget.

No parameter schema in public metadata yet.

RunTestsWithCoverageRun dotnet test with XPlat Code Coverage, generate a JSON summary via reportgenerator. Returns paths to Summary.json and coverage.cobertura.xml.

Run dotnet test with XPlat Code Coverage, generate a JSON summary via reportgenerator. Returns paths to Summary.json and coverage.cobertura.xml.

No parameter schema in public metadata yet.

GetCoverageSummaryParse Summary.json into structured class/method coverage data sorted worst-first by branch coverage.

Parse Summary.json into structured class/method coverage data sorted worst-first by branch coverage.

No parameter schema in public metadata yet.

GetFileCoverageGet coverage for a single source file from Cobertura XML. Returns allMeetTarget (true when all classes meet the configured targetRate for both line and branch coverage; default 0.8).

Get coverage for a single source file from Cobertura XML. Returns allMeetTarget (true when all classes meet the configured targetRate for both line and branch coverage; default 0.8).

No parameter schema in public metadata yet.

GetUncoveredBranchesFind uncovered branch conditions for methods matching a given name. Returns all matching methods with partial name support.

Find uncovered branch conditions for methods matching a given name. Returns all matching methods with partial name support.

No parameter schema in public metadata yet.

GetCoverageDiffCompare current Cobertura XML against baseline. Shows method-level changes including new and removed methods.

Compare current Cobertura XML against baseline. Shows method-level changes including new and removed methods.

No parameter schema in public metadata yet.

AppendTestCodeInsert or append C# test code into a test file. Supports anchor-based insertion with whitespace-tolerant fallback matching. Uses atomic writes to prevent file corruption.

Insert or append C# test code into a test file. Supports anchor-based insertion with whitespace-tolerant fallback matching. Uses atomic writes to prevent file corruption.

No parameter schema in public metadata yet.

CleanupSessionRemove session state files and TestResults/coveragereport directories. Pass sessionId to scope, or omit to clean artifacts older than maxAgeMinutes (default 120).

Remove session state files and TestResults/coveragereport directories. Pass sessionId to scope, or omit to clean artifacts older than maxAgeMinutes (default 120).

No parameter schema in public metadata yet.

Sponsors

Configuration

COVERAGE_MCP_ALLOWED_ROOT

Restrict every tool's filesystem access to this subtree. Recommended for shared environments. When unset, the server logs a warning and accepts any path.

COVERAGE_MCP_DOTNET_TEST_TIMEOUT_MS

Override the dotnet test timeout in milliseconds. Default: 600000 (10 minutes).

Readme

dotnet-coverage-mcp

build tests NuGet License: MIT

An MCP (Model Context Protocol) server that gives AI assistants — Claude Code, Gemini CLI, and others — direct access to .NET test-coverage tooling. Run dotnet test, parse Cobertura XML, identify uncovered branches, diff coverage between runs, and append test code — all over stdio.

Purpose


View the full README on GitHub

Details

Repository
github.com/hyeonu-cha/dotnet-coverage-mcp
Website
github.com/Hyeonu-Cha/dotnet-coverage-mcp
Package
dotnet-coverage-mcp
Transport
STDIO
Registry
MCP registry, active