# Codecov MCP for AI Agents MCP

> Codecov brings all your test coverage data and engineering metrics into natural conversation. Your AI client can check build health by retrieving aggregate totals for specific commits, list repository details across an organization, or audit complex coverage reports using simple queries.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Tags:** test-coverage, code-quality, ci-cd-pipeline, software-testing, coverage-reports, automated-testing

## Description

Managing software quality often means staring at dashboards filled with graphs and percentages. This MCP changes that. You connect your Codecov account to any AI agent, and suddenly you can ask questions about your code quality the way you talk to a coworker. Instead of navigating multiple tabs—checking coverage for one repository, then switching to look up another commit's totals, and finally trying to map out a complex report structure—you just ask. Your agent handles all that complexity in plain language.

This setup lets developers monitor everything from branch-specific coverage metrics to the overall health of an entire codebase without ever leaving their chat window. It’s about getting immediate answers on build status and test completeness, letting you focus on writing code instead of clicking through reports across multiple repositories. You'll find that Vinkius makes connecting these deep technical workflows simple for any MCP-compatible client.

## Tools

### get_commit_coverage_totals
Pulls the combined test coverage metrics for a specific commit hash.

### get_my_codecov_profile
Retrieves metadata about your Codecov account and user profile.

### get_repository_coverage_details
Gathers detailed coverage information for a single, specified repository.

### get_coverage_report_tree
Builds and provides a hierarchical view that matches your project's folder structure.

### list_repository_branches
Lists all development branches tracked by Codecov for an organization.

### list_repository_commits
Shows a list of recent commits along with their associated coverage status.

### list_coverage_flags
Retrieves all custom flags used to categorize and monitor different coverage metrics.

### list_codecov_repositories
Lists every repository linked under a specified owner or organization.

## Prompt Examples

**Prompt:** 
```
What's the overall test coverage for all my microservice repos?
```

**Response:** 
```
**Codebase Overview** 

Here are the five repositories found:

| Repo Name | Coverage % |
| :--- | :---: |
| `core-api` | **85.4%** |
| `web-frontend` | 92.1% |
| `billing-service` | 68.0% |
| `auth-module` | 79.3% |
| `data-worker` | 88.9% |

The `billing-service` needs immediate attention. Would you like to see the report tree for that repo?
```

**Prompt:** 
```
Check the coverage totals for my latest commit in core-api.
```

**Response:** 
```
✅ **Commit Coverage Report** 

*   **SHA:** `abc1234` (Latest)
*   **Overall Coverage:** 85.4% (Target Met)
*   **Metrics Breakdown:**
    *   Total Lines: 1,500
    *   Lines Covered: 1,200
    *   Missed Lines: 300
    *   Partial Coverage: 50

This build looks healthy and meets your team's minimum threshold.
```

**Prompt:** 
```
How is the coverage organized in the web-frontend project?
```

**Response:** 
```
**Report Structure for `web-frontend`** 

The report follows this hierarchy:

1.  `/src/components` (95%):
    *   `Button.js`: 98%
    *   `CardLayout.jsx`: 92%
2.  `/src/utils` (88%):
    *   `dateFormatter.ts`: 75% <--- *Lower coverage area*
3.  `/src/hooks` (91%):
```

## Capabilities

### List all repositories
Gets a list of every repository associated with an owner, along with its current coverage percentage.

### Check build health by commit SHA
Retrieves the total test coverage metrics for any specific code commit hash you provide.

### Analyze report structure
Generates a detailed, hierarchical view of how your project's coverage reports match its file system layout.

### Compare branches and flags
Allows you to monitor and compare test coverage across multiple development branches or custom-defined monitoring flags.

## Use Cases

### The CI/CD pipeline passed, but was coverage adequate?
A DevOps engineer asks their agent: 'What's the overall coverage for this commit?' The agent uses `get_commit_coverage_totals` to confirm that SHA 'abc1234' achieved an 85.4% total coverage, confirming the build is ready to merge.

### The team needs a quick audit of all projects.
An Engineering Manager asks: 'Show me every repository in the organization and their current coverage.' The agent runs `list_codecov_repositories`, providing an immediate, high-level health check across the entire portfolio.

### Need to see how different features impact test quality.
A Software Engineer asks: 'Compare the coverage of the staging branch versus the main branch.' The agent uses `list_repository_branches` and then retrieves detailed comparisons, helping them prioritize testing efforts.

### Diagnosing a low-coverage area in the codebase.
A QA specialist asks: 'Where is coverage lowest in our utility folder?' The agent uses `get_coverage_report_tree` to return a file-system map, immediately pointing the user toward the weak spot.

## Benefits

- Instead of manually checking multiple tabs, you can ask your agent to list all associated repositories and their current coverage percentages instantly.
- Need proof of build health? Use the `get_commit_coverage_totals` function to check aggregate test totals for any specific commit SHA without opening a dashboard.
- Understand complex code structure by asking for the full report tree. The agent uses `get_coverage_report_tree` to map out coverage against your project’s file system.
- Comparing branches is easy. You can use `list_repository_branches` and then check metrics across them to see which development line needs more testing.
- Get a clean view of all projects by using the function that lists Codecov repositories, giving you oversight for entire organizations.

## How It Works

The bottom line is that you treat complex code metrics like simple chat requests.

1. Subscribe to this MCP and provide your unique Codecov Global API Token, which you get from your settings dashboard.
2. Connect the token to your preferred AI client (like Cursor or Claude).
3. Ask your agent a question like, 'What was the coverage percentage for the last commit in the core-api repo?' and get an instant answer.

## Frequently Asked Questions

**How can I use Codecov MCP to check my overall test coverage?**
You simply ask your agent, 'What is the coverage for this project?' It will pull data from all linked repositories and give you a clean list of their current coverage percentages at a glance.

**Can Codecov MCP tell me if a specific commit passed testing?**
Yes. You can ask your agent to check the coverage totals for any recent commit SHA. It gives you precise numbers on hits, misses, and overall percentage, confirming build health instantly.

**Does Codecov MCP help me compare different code branches?**
Absolutely. You can ask your agent to list all development branches and then compare coverage between any two of them. This is crucial for seeing if a feature branch dropped below the main branch's quality standard.

**What kind of file structure information does Codecov MCP give me?**
The agent can retrieve a full, hierarchical report tree that mirrors your project's actual folder system. This allows you to pinpoint exactly which module or utility file needs more test coverage.

**Is Codecov MCP only useful for big organizations?**
No. While great for large codebases, it works just as well for small projects. You can list all your repositories and get a quick overview of where you stand on testing coverage.

**What if I want to track metrics based on specific criteria?**
You can use Codecov MCP to list defined coverage flags. This lets you monitor test completeness across custom categories, ensuring certain critical parts of the code are never overlooked.