Dotnet Coverage MCP logo

Dotnet Coverage MCP

Runs .NET tests, analyzes Cobertura coverage, finds gaps, compares runs, and appends C# tests through MCP.

Install Dotnet Coverage MCP

Pick your client, then add it in one click or paste the config.

No confirmed install command yet

We only publish a config when the install details come from the project itself — its README, its docs, or a verified owner. We haven’t found those for dotnet-coverage-mcp, and we’d rather show nothing than a guess you’d paste into your client.

Open setup steps on GitHub

Overview

dotnet-coverage-mcp MCP server connects MCP clients to .NET test and coverage workflows over stdio. It discovers source files, runs dotnet test with coverage, reads Cobertura XML, reports uncovered lines and branches, and compares coverage between runs. It can also inspect test environments and append validated C# test members to existing files. Reach for it when an agent needs to identify coverage gaps and iteratively add tests without manually parsing reports.

Use cases

  • Discover C# source files and divide large projects into coverage batches
  • Run .NET tests and collect Cobertura coverage for analysis
  • Find uncovered branches and the smallest methods needed to close gaps
  • Append generated test members and verify coverage improvements
  • Compare coverage changes between test runs

Key features

  • Cobertura-based line, method, class, and branch coverage analysis
  • Coverage gap reports with source context and uncovered branches
  • Test environment detection for major .NET frameworks and runners
  • Validated C# test-member insertion with atomic writes
  • Session isolation and cleanup for concurrent coverage workflows
  • Method-level coverage diffs including added and removed methods

Tools11

What Dotnet Coverage MCP lets your agent do. Expand a tool for its parameters.

Self-reported~214 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

16/16 checks healthy over the last 117d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
Last commit5d agoMost recent push to the default branch.
Tools exposed11Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Dotnet Coverage MCP works

What dotnet-coverage-mcp does

dotnet-coverage-mcp exposes .NET testing and coverage operations as MCP tools for clients such as Claude Code and Gemini CLI. It works with source files, folders, and .csproj scopes, while filtering out common non-test targets such as generated code, entry points, data-only models, dependency-injection registration, and test projects.

The server supports a coverage-driven test workflow: discover source files, run the test suite, inspect coverage gaps, add test members, run again, and compare the result with a previous run. Coverage analysis uses Cobertura XML, which is also the report path returned by the test tool.

How it works

The server runs as a console process and communicates with an MCP client over standard input and output. The client launches it and invokes tools, while the server calls dotnet test through the shell when a test run is requested.

run_tests_with_coverage uses coverlet with VSTest. When global.json selects Microsoft.Testing.Platform, it uses Microsoft's CodeCoverage extension instead. Results include test counts and coverage output. Failed tests retain coverage data, while an aborted test host does not produce coverage for that run.

For larger projects, get_source_files can create smart batches based on a line budget. Coverage gaps can then be examined per batch without rerunning tests for every file. Session IDs provide isolation for concurrent workflows, and cleanup removes artifacts created for a session.

Setup and configuration

Configure an MCP-compatible client to launch the dotnet-coverage-mcp console process over stdio. The server operates against the .NET projects and test files available to that process.

Coverage checks use a default target rate of 0.8 for both line and branch coverage. Tools that evaluate coverage accept a target rate or filtering options where supported. A sessionId can be passed to test, query, diff, and cleanup operations when separate workflows need isolated state.

The test-environment inspection tool reads obj/project.assets.json when the project has been restored. It identifies the test framework, runner, coverage collector, mocking and assertion libraries, and integration-test packages.

Tools and capabilities

  • get_source_files discovers C# files, reports exclusions and reasons, returns file metadata, and provides paginated batches.
  • run_tests_with_coverage runs tests, collects coverage, reports pass/fail/skip counts, and distinguishes failures, build errors, unmatched tests, busy projects, and aborted test hosts.
  • get_coverage_summary ranks classes and methods by branch coverage and can limit results to items below a target.
  • get_file_coverage evaluates one source file and reports whether its classes meet both line and branch targets.
  • get_coverage_gaps identifies deficient files, uncovered line ranges, uncovered branches, relevant source, and a small set of methods to test.
  • get_uncovered_branches finds uncovered conditions for methods by exact or partial name matching.
  • get_coverage_diff compares method-level coverage with a baseline, including added and removed methods.
  • describe_test_target summarizes constructor dependencies, methods, decision points, uncontrollable calls, suggested test types, and existing test files using syntax-only analysis.
  • append_test_code inserts or appends C# members with duplicate detection, syntax checks, anchor matching, formatting preservation, and atomic writes.
  • cleanup_session removes generated session state and tool-created TestResults-* directories without deleting the bare TestResults directory used by dotnet test and Visual Studio.

Limitations and notes

Coverage artifacts and session state remain until cleanup_session is called. A run covering multiple target frameworks produces reports that are merged so coverage from any framework counts as covered.

append_test_code accepts member syntax rather than arbitrary C# source. Invalid members, duplicate signatures, and unsafe fallback insertions are rejected without changing the file. describe_test_target provides syntax-based guidance rather than executing code.

Only the test-running operation can reach NuGet during a restore. Tool results report failures as structured MCP errors with stable error types, and read-only query operations are annotated as read-only and idempotent.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Dotnet Coverage MCP

dotnet-coverage-mcp is an MCP server that connects AI clients to .NET projects, dotnet test, and Cobertura coverage reports. Its main tools discover C# sources, run tests with coverage, summarize gaps, find uncovered branches, compare coverage runs, inspect test targets, and append C# test members over stdio.

Configure an MCP-compatible client to launch the dotnet-coverage-mcp console process over stdio. The client starts the process and calls its tools against the .NET projects and test files available to that process.

It runs `dotnet test` with coverlet under VSTest, or Microsoft's CodeCoverage extension when `global.json` selects Microsoft.Testing.Platform. The resulting Cobertura XML is returned for the other coverage tools to read.

Call `get_uncovered_branches` with a method name to receive matching methods and their uncovered branch conditions. Partial method-name matching is supported, and a `sessionId` can isolate the lookup.

Yes. It communicates over standard MCP stdio, so it can be launched by MCP-compatible clients that support stdio servers, including Cursor.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewDotnet Coverage MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/dotnet-coverage-mcp?style=directory)](https://allmcps.com/mcp/dotnet-coverage-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/dotnet-coverage-mcp"><img src="https://allmcps.com/api/badge/dotnet-coverage-mcp?style=directory" alt="Dotnet Coverage MCP on AllMCPs" /></a>