A Model Context Protocol (MCP) server that extracts and analyzes code coverage data from your test reports.
npm install coverage-lens

An MCP (Model Context Protocol) server that reads test coverage reports and provides coverage data to AI assistants like Claude.
1. The server reads Clover XML coverage reports using stream parsing for greater efficiency
2. Retrieving only data about the specified file, without loading the entire coverage report into the context window.
3. When you ask about a specific file's coverage, it extracts and returns the relevant tag
4. The AI assistant can then interpret the coverage data (line hits, branch coverage, etc.)
- Reads Clover XML coverage reports (commonly generated by Istanbul/nyc, PHPUnit, and other testing tools)
- Provides file-specific coverage data on demand
- Integrates seamlessly with MCP-compatible AI clients
- Lightweight and fast with streaming XML parsing
The easiest way to add Coverage Lens to Claude Code:
``bash`
claude mcp add coverage-lens -- npx -y coverage-lens
Add the following to your MCP configuration file:
`json`
{
"mcpServers": {
"coverage-lens": {
"command": "npx",
"args": ["-y", "coverage-lens"]
}
}
}
| Variable | Description | Default |
| --------------------------- | -------------------------------------------- | ----------------------- |
| COVERAGE_REPORT_FILE_PATH | Optional custom path to your clover.xml file | ./coverage/clover.xml |
Returns coverage data for a specific file from the test report.
Parameters:
- targetFile (string, required): File name or partial path to search for
Example usage in Claude:
`
What is the test coverage for the file "UserService.ts"?
or without extension file
What is the test coverage for the file "UserController"?
`
Coverage Lens reads Clover XML format. Here's how to generate compatible reports:
`json`
// package.json
{
"scripts": {
"test:coverage": "jest --coverage"
}
}
Jest generates clover.xml by default in the coverage/ directory.
`bashClone the repository
git clone https://github.com/denisonamaral/mcp-coverage-lens.git
cd mcp-coverage-lens
$3
`
mcp-coverage-lens/
├── src/
│ └── index.ts # Main MCP server implementation
├── build/ # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md
``- TypeScript (ES2022)
- MCP SDK for server implementation
- Zod for input validation
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.