dotnet-coverage-mcp
An MCP (Model Context Protocol) server that exposes .NET code coverage tooling as callable tools for AI assistants
Install / Use
claude mcp add Hyeonu-Cha -- npx -y github:Hyeonu-Cha/dotnet-coverage-mcpIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
Development & EngineeringSupported Platforms
Our assessment of dotnet-coverage-mcp
dotnet-coverage-mcp scores 71/100 on our quality scale, 3868th of 4,721 Development & Engineering skills we index.
Its MCP Server is 25 KB long, well organised into 37 sections with 10 code examples: a thorough specification that gives an agent plenty to work with.
It has 3 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated 8 days ago, so dotnet-coverage-mcp is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 92/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
dotnet-coverage-mcp compared with similar skills
All 4 of these similar skills score higher than dotnet-coverage-mcp; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| dotnet-coverage-mcp (this skill)by Hyeonu-Cha | 71 | 3 | 8d ago | MCP Server |
| taste-skillby Leonxlnx | 100 | 122.4k | 1d ago | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 115.5k | 3d ago | CLAUDE.md |
| hyperframesby heygen-com | 100 | 91.7k | today | CLAUDE.md |
| rufloby ruvnet | 100 | 82.6k | today | CLAUDE.md |
Frequently asked questions
- How do I install dotnet-coverage-mcp?
- Run
claude mcp add Hyeonu-Cha -- npx -y github:Hyeonu-Cha/dotnet-coverage-mcp. The install tabs above show the steps for each supported agent. - Which AI agents does dotnet-coverage-mcp work with?
- It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
- Is dotnet-coverage-mcp safe to use?
- It is MIT-licensed and scores 92/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is dotnet-coverage-mcp still maintained?
- The repository was last updated 8 days ago, so dotnet-coverage-mcp is actively maintained.
Skill content
View source on GitHubdotnet-coverage-mcp
<!-- mcp-name: io.github.Hyeonu-Cha/dotnet-coverage-mcp -->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
This server lets an AI assistant run unit tests, collect coverage data, and analyse results — all without leaving the chat. Instead of manually running dotnet test and parsing reports, the AI can call the server's tools directly to:
- Discover source files and build smart batches by line budget
- Run a filtered set of tests and collect coverage
- Read compact, AI-optimised coverage summaries (method-level line/branch rates)
- Check per-file coverage against a configurable target rate (default 80%)
- Identify uncovered branches as structured JSON
- Diff coverage between runs to see only what changed
- Append new test code to an existing test file with atomic writes
How It Works
The server starts as a console process and communicates over stdio using the MCP protocol. An MCP-compatible client (Claude Code, Gemini CLI, etc.) launches the process and calls its tools as if they were functions.
AI Client <--stdio/MCP--> dotnet-coverage-mcp <--shell--> dotnet test
Available Tools
Tools are named here as MCP clients list and call them.
| Tool | Description |
|------|-------------|
| get_source_files | Discover .cs files from a file, folder, or .csproj project. For a folder or project, files that are not test targets (entry points, DI registration, generated code, data-only models, test projects) are left out, counted per kind in excludedByKind and sampled under excluded with the reason; a .csproj scope also stops at nested projects. Returns file metadata (lines, method count) and smart batches grouped by lineBudget, 10 batches per call (moreBatches counts the rest, skipBatches gets them). |
| run_tests_with_coverage | Run dotnet test with code coverage (coverlet on VSTest; Microsoft's CodeCoverage extension when global.json selects Microsoft.Testing.Platform). Returns pass/fail/skip counts and the path to the Cobertura XML that every other coverage tool reads. Distinguishes testsFailed (with each failure's message and stack, coverage kept), noTestsMatched, buildError (compiler errors only), projectBusy (the build's output files were held by another build, IDE or test host; run again) and testRunAborted (a test crashed or hung the test host: the reason, the crash's message and frames, and the tests that had not finished; no coverage is offered for such a run). A test project with several target frameworks writes one report per framework; they are merged into one, where code covered on any framework counts as covered. Supports forceRestore and sessionId for concurrent isolation. |
| get_coverage_summary | Summarise class/method coverage from the Cobertura XML, sorted worst-first by branch coverage: totalClasses, the 25 worst classes (or topN), and in moreClasses how many were left out. Optional belowTarget/topN/methodsPerClass filters trim the response to what still needs work. |
| get_file_coverage | 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) and the file's path on this machine. Supports sessionId. |
| describe_test_target | For a source file, per class: constructor dependencies with how to provide each in a test (mock, NullLogger, Options.Create, real instance for sealed/concrete classes, SQLite for a DbContext), public/internal methods with signatures and decision points, calls a test can't control (DateTime.Now, File.*, Guid.NewGuid()...) with the usual seam, a suggested test type with reasons, and existing test files. Syntax-only. |
| get_test_environment | Detect a test project's stack: framework (xUnit v2/v3, NUnit, MSTest) with the attributes to use, runner (VSTest or Microsoft.Testing.Platform), coverage collector, mocking and assertion libraries, integration-test packages, plus warnings such as a missing coverage collector. Reads obj/project.assets.json when restored. |
| get_coverage_gaps | For a scope (file, folder, .csproj or list), report per file whether it meets targetRate on lines and branches, and for each file below it the fewest methods that close its gap, with uncovered line ranges, uncovered branches and the source around them. One call per test cycle. Non-target files are skipped as in get_source_files. |
| get_uncovered_branches | Find uncovered branch conditions for methods matching a given name. Returns all matching methods with partial name support. Supports sessionId. |
| get_coverage_diff | Compare current Cobertura XML against baseline. Shows method-level changes including new and removed methods. Supports sessionId for concurrent isolation. |
| append_test_code | Insert or append C# test code into a test file. Rejects code that is not valid C# member syntax with syntaxError, and a member the class already declares (same name and parameter types) with duplicateMember, leaving the file unchanged; sending exactly the same code again inserts nothing. Supports anchor-based insertion with whitespace-tolerant fallback matching; a fallback insertion that would break a file that compiled is refused with insertFailed. The inserted code is laid out like the members around it (indentation, the file's line endings, one blank line between members). Uses atomic writes to prevent file corruption. |
| cleanup_session | Remove session state files and the TestResults-* directories the tool created (never the bare TestResults that dotnet test and Visual Studio use). Pass the sessionId you ran with to remove that session's artifacts; omit it to remove the single-agent ones (TestResults-mcp/, .coverage-state, .coverage-prev.xml) plus other sessions' artifacts older than maxAgeMinutes (default 120). |
Protocol details
- Tool annotations. The six query tools are marked
readOnlyHint+idempotentHint, so clients that auto-approve read-only tools won't prompt for them.run_tests_with_coverage,append_test_codeandget_coverage_diffwrite files but are not destructive. Onlycleanup_sessionisdestructiveHint: true. Onlyrun_tests_with_coverageisopenWorldHint: true, since a restore can reach NuGet. - Errors. A tool error comes back as
{"error": "...", "errorType": "..."}text in a result flaggedisError: true, so clients show it as a failed call.errorTypeis a stable name to branch on (fileNotFound,pathNotAllowed,testsFailed,buildError,duplicateMember, ...). - Server instructions. The
initializeresult carries a short workflow (environment → run → gaps → append → repeat) that clients put in the model's context. - Progress. When the client sends a progress token,
run_tests_with_coveragereports milestones whiledotnet testruns: restore, each project built, tests started, the result line.
Batch Workflow
For projects with many source files, the recommended workflow is:
- Discover — Call
get_source_fileson a folder or.csprojto get all files and smart batches - Run once — Call
run_tests_with_coveragewithout a filter (runs every test) to collect coverage across all files - Find the gaps — Call
get_coverage_gapsfor the batch: per file below target, the methods to test, with the uncovered branches and source around them (no test re-run) - Write tests — Use
append_test_codeto add test methods - Re-run and diff — Run tests once, call
get_coverage_diffto verify improvement - Repeat — Continue until batch files meet the target rate (default 80%) or 3 cycles with no improvement, then move to next batch
- Clean up — Once the goal is reached, call
cleanup_session(with the samesessionId, if you used one) to removeTestResults-mcp/orTestResults-{hash}/and the session state files. These are not deleted automatically — they persist untilcleanup_sessionis called.
This minimises dotnet test invocations (the main bottleneck) while still tracking per-file progress.
Concurrency
Multiple AI agents can run in parallel by passing a sessionId to each tool call, which isolates their coverage artifacts:
- Isolated output directories —
run_tests_with_coveragecreatesTestResults-{hash}/per session, preventing one agent from deleting another's XML mid-parse - Scoped state files — Coverage state is written to
.mcp-coverage/.coverage-state-{hash}, soResolveCoberturaPathresolves to the correct XML for each session - Scoped baselines —
get_coverage_diffstores baselines as.coverage-prev-{hash}.xmlper session - Atomic writes — All file writes (state files and test code) use write-to-temp-then-rename to prevent corruption from race conditions or process crashes
Limitation — build outputs are not session-scoped.
sessionIdisolates coverage artifacts, not the .NET build.dotnet testcompiles the target project into its sharedobj/andbin/, which are not per-session, so two agents runningrun_tests_with_coverageagainst the same test project at the same time collide on those outputs. The run that loses returnsprojectBusy(its build hitCS2012/MSB3027, "being used by another process"), notbuildError, and succeeds when run again after the other build finishes. Run parallel agents against different test projects, or on separate working copies of the repo. Multiple agents on one project are fine as long as theirdotnet testbuilds don't overlap.
Without sessionId, tools use shared defaults — safe for single-agent use.
Requirements
-
.NET 10 (or later) to run the tool — https://dotnet.microsoft.com/download. The projects it tests do not have to be .NET 10:
net8.0andnet9.0test projects work, including in a repository whoseglobal.jsonpins an older SDK, and so do test projects with several target frameworks (the end-to-end tests run one targetingnet8.0;net10.0). As with anydotnet test, the runtime the tests target must be installed. -
A coverage collector in the test project. On VSTest (the default),
coverlet.collector. On Microsoft.Testing.Platform,Microsoft.Testing.Extensions.CodeCoverage, plusMicrosoft.Testing.Extensions.TrxReportfor per-failure details. MTP is used when the repository'sglobal.jsonsets"test": { "runner": "Microsoft.Testing.Platform" }, which the .NET 10 SDK requires for MTP projects anyway.get_test_environmentreports what a project has and what is missing. -
An MCP-compatible client (Claude Code, Gemini CLI, etc.)
-
COVERAGE_MCP_ALLOWED_ROOT— recommended. Set to your repository root to restrict every tool's filesystem access to that subtree. Any path passed by the client outside this root is rejected withpathNotAllowed. When unset, the server logs a warning once and accepts any path (backward-compatible, but not recommended for shared environments).export COVERAGE_MCP_ALLOWED_ROOT=/path/to/your/repo
Optional s
Truncated for display — read the full file on GitHub.
Related Skills
taste-skill
122.4kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
Agent-Reach
115.5kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
hyperframes
91.7kOpen-source AI video editor: edit your own footage, or create and remake any video with Claude Code, Codex or the free Studio app. Write HTML, render MP4. By HeyGen.
ruflo
82.6k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
