home / mcp / test coverage mcp server

Test Coverage MCP Server

Provides token-efficient, LCOV-based test-coverage data for any language via an MCP server.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "goldbergyoni-test-coverage-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "test-coverage-mcp"
      ]
    }
  }
}

You can equip your coding and testing agents with instant, token-efficient test coverage data for any programming language using an MCP server. It provides reliable LCOV-based coverage summaries, file-specific insights, and baseline tracking to measure progress within a session, helping you maintain or improve coverage while you code.

How to use

You will connect your MCP-enabled AI tool to the Test Coverage MCP server to query coverage data and track changes during a development session. Use the provided tool endpoints to fetch overall project coverage, file-specific coverage, and to establish a session baseline for incremental progress checks.

How to install

Prerequisites: ensure you have Node.js and npm installed on your machine.

Install the MCP server package globally using npm.

npm install -g test-coverage-mcp

Configuration

Configure your MCP client to connect to the Test Coverage MCP server. The examples below show a standard local setup using npx to start the MCP server for your AI coding tool:

{
  "mcpServers": {
    "test-coverage": {
      "command": "npx",
      "args": ["-y", "test-coverage-mcp"]
    }
  }
}

Usage notes

The server exposes four core tools you can call from your MCP client. Use them to check coverage, inspect specific files, start a session baseline, and compute changes against that baseline.

Troubleshooting

If coverage data cannot be found, verify your LCOV file path and that the coverage step ran before querying. If a baseline is missing, ensure you called the baseline start function before requesting differences.

Development

Install dependencies, build, and run tests to validate the MCP server in your environment.

Available tools

coverage_summary

Get overall project coverage from an LCOV file. Input: lcovPath (optional, defaults to ./coverage/lcov.info). Output: linesCoveragePercentage and branchesCoveragePercentage.

coverage_file_summary

Get coverage for a specific file. Input: lcovPath (optional, defaults to ./coverage/lcov.info), filePath (required). Output: path, linesCoveragePercentage, branchesCoveragePercentage.

start_recording

Record current coverage as a baseline. Input: lcovPath (required). Output: a confirmation string indicating recording started.

get_diff_since_start

Compare current coverage against the recorded baseline. Input: lcovPath (required). Output: linesPercentageImpact and branchesPercentageImpact indicating improvements or regressions.