
Codecov
io.github.egulatee由 GitHub 帳號 egulatee 發布v1.1.0更新於 Oct 24, 2026
MCP server for querying Codecov coverage data with configurable URL support
概覽
讓助理讀取 GitHub 儲存庫的 Codecov 覆蓋率資料,包括檔案、提交、儲存庫與拉取請求覆蓋率。
- 可以做什麼
- 透過 Codecov API v2 提供查詢覆蓋率的工具:單一檔案的逐行覆蓋率、某次提交的覆蓋率、儲存庫整體覆蓋率、含檔案層級影響的拉取請求覆蓋率,以及兩個 git 參照之間的覆蓋率比較。支援 codecov.io 以及透過可設定基礎 URL 存取的自架 Codecov 執行個體。目前僅支援 GitHub 儲存庫。
- 適用情境
- 適合在審查拉取請求時檢查覆蓋率門檻、查看哪些檔案缺少覆蓋,或在不離開助理的情況下比較分支、提交或標籤之間的覆蓋率。也適合追蹤開發週期中的覆蓋率趨勢。
- 執行需求
- 透過 stdio 在本機執行,通常使用 npm 套件搭配 npx,或使用 Docker 映像。npm 方式需要 Node.js,Docker 可作為替代。需要在 CODECOV_TOKEN 中提供 Codecov API 權杖(不是上傳權杖),自架執行個體可選設定 CODECOV_BASE_URL,且必須使用 https。需要能存取 Codecov 執行個體的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Codecov,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
MCP Server for Codecov
[npm version] [npm downloads] [codecov] [Test and Coverage] [Security Policy] [License: MIT] [Node.js Version] [TypeScript] [MCP]
A Model Context Protocol (MCP) server that provides tools for querying Codecov coverage data. Supports both codecov.io and self-hosted Codecov instances with configurable URL endpoints.
📦 Published on npm: @egulatee/mcp-codecov 🐳 Docker image: ghcr.io/egulatee/mcp-server-codecov
📖 Learn More: Read about building this MCP server with AI in just 2 hours.
Quick Start (Claude Code)
Get started in under 2 minutes:
1. Get your Codecov API token
Create an API token (not an upload token) from your Codecov account:
- Go to codecov.io (or your self-hosted URL)
- Click your avatar → Settings → Access tab
- Click "Generate Token" and name it "MCP Server API Access"
- Copy the token value
2. Set your environment variable
Add to your shell profile (~/.zshrc or ~/.bashrc):
Then reload: source ~/.zshrc
3. Install the MCP server
4. Verify installation
Expected output: codecov: @egulatee/mcp-codecov - ✓ Connected
That's it! You can now use Codecov tools in Claude Code. See Available Tools below.
Features
- File-level coverage: Get detailed line-by-line coverage data for specific files
- Commit coverage: Retrieve coverage statistics for individual commits
- Repository coverage: Get overall coverage metrics for repositories
- Pull request coverage: Analyze coverage changes and impact for pull requests
- Coverage comparison: Compare coverage between branches, commits, or tags
- Configurable URL: Point to any Codecov instance (codecov.io or self-hosted)
- Token authentication: API token support for accessing coverage data
Token Types
Important: Codecov has two different types of tokens:
- Upload Token: Used for pushing coverage reports TO Codecov during CI/CD. Found on your repository's Settings → General page.
- API Token: Used for reading coverage data FROM Codecov via the API. Created in your Codecov Settings → Access tab.
This MCP server requires an API token, not an upload token.
Available Tools
get_file_coverage
Get line-by-line coverage data for a specific file.
Parameters:
owner(required): Repository owner (username or organization)repo(required): Repository namefile_path(required): Path to the file within the repository (e.g., 'src/index.ts')ref(optional): Git reference (branch, tag, or commit SHA)
Example:
get_commit_coverage
Get coverage data for a specific commit.
Parameters:
owner(required): Repository ownerrepo(required): Repository namecommit_sha(required): Commit SHA
Example:
get_repo_coverage
Get overall coverage statistics for a repository.
Parameters:
owner(required): Repository ownerrepo(required): Repository namebranch(optional): Branch name (defaults to repository's default branch)
Example:
get_pull_request_coverage
Get coverage data for a specific pull request, including coverage changes and file-level impact.
Parameters:
owner(required): Repository owner (username or organization)repo(required): Repository namepull_number(required): Pull request number
Example:
Use Cases:
- Check if PR meets coverage thresholds before approving
- Alert when PR decreases overall coverage
- Identify which files in a PR lack coverage
- Implement quality gates that block merges if coverage drops
compare_coverage
Compare coverage between two git references (branches, commits, or tags).
Parameters:
owner(required): Repository owner (username or organization)repo(required): Repository namebase(required): Base reference (e.g., 'main', commit SHA)head(required): Head reference to compare against base
Example:
Use Cases:
- Compare coverage between release branches
- Analyze coverage changes between any two commits
- Track coverage trends across development cycles
- Validate coverage improvements in feature branches
Repository Activation
Important Note: Before a repository can receive coverage uploads, it must be activated in Codecov. This is a one-time setup step that cannot be automated via API.
Manual Activation Process
To activate a repository for coverage tracking:
- Log in to your Codecov instance (e.g., codecov.io)
- Navigate to your organization/user account
- Find the repository you want to activate
- Click the "Activate" button to enable coverage tracking
- Once activated, you can upload coverage reports from your CI/CD pipeline
Why manual activation is required: The Codecov API v2 does not provide a /activate endpoint. Repository activation must be done through the web UI or happens automatically on first coverage upload (depending on your Codecov configuration).
Verification and Troubleshooting
Common Issues
1. 401 Unauthorized Error
- Check token type: Ensure you're using an API token (from Settings → Access), not an upload token
- Verify the token is valid and has access to the repository
- For self-hosted instances, confirm you're using the correct
CODECOV_BASE_URL
2. Environment Variable Not Expanding
- Make sure the variable is exported in your shell (check
~/.zshrcor~/.bashrc) - Restart Claude Code after setting environment variables
- Verify the variable exists:
echo $CODECOV_TOKEN
3. Connection Failed
- Restart Claude Code or Claude Desktop
- Verify environment variables are set correctly:
echo $CODECOV_TOKEN - Check the configuration:
claude mcp get codecov
4. HTTP vs HTTPS
Always use https:// for the CODECOV_BASE_URL, not http://:
- Correct:
https://your-codecov-instance.com - Incorrect:
http://your-codecov-instance.com
Advanced Configuration
Self-Hosted Codecov
For self-hosted Codecov instances, use your instance URL:
Claude Desktop Setup
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Manual Configuration (Claude Code)
Add to ~/.claude.json:
Notes:
- Environment variable expansion is supported using
${VAR}syntax - Variables like
${CODECOV_TOKEN}will be read from your shell environment - The
-yflag for npx automatically accepts the package installation prompt
Docker (no Node.js required)
Pull and run the official multi-platform image from GitHub Container Registry:
Platforms: linux/amd64 and linux/arm64 (Apple Silicon, AWS Graviton)
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
With self-hosted Codecov:
Available tags: latest, 2, 2.1, 2.1.0 (full semver)
stdio bridge with socat:
The Docker image includes socat, which allows MCP clients that communicate over stdio to connect to the server running inside a container via a TCP socket:
Note:
socatmust also be installed on the host machine running the bridge command. Install withbrew install socat(macOS),apt install socat(Debian/Ubuntu), orapk add socat(Alpine).
Installing from npm Globally
Benefits:
- Simple one-command installation
- Automatic updates with
npm update -g @egulatee/mcp-codecov - No manual build steps required
- Works across all projects
Verify installation:
Development Installation (Source)
Only use this method if you're contributing to the project:
Then configure with the built path:
Claude Code CLI:
Manual (~/.claude.json):
Claude Desktop:
Testing
This project maintains 97%+ code coverage with comprehensive unit tests using Vitest.
For detailed testing documentation, including how to run tests, coverage requirements, CI integration, and writing tests, see TESTING.md.
Development
Release Process
This project uses an automated release workflow via GitHub Actions. Releases are published to npm automatically when you push a version tag.
For detailed release instructions, including prerequisites, creating releases, manual releases, and version numbering, see RELEASE.md.
API Compatibility
This server uses Codecov's API v2. The API endpoints follow this pattern:
- File coverage:
/api/v2/gh/{owner}/repos/{repo}/file_report/{file_path} - Commit coverage:
/api/v2/gh/{owner}/repos/{repo}/commits/{commit_sha} - Repository coverage:
/api/v2/gh/{owner}/repos/{repo} - Pull request coverage:
/api/v2/gh/{owner}/repos/{repo}/pulls/{pull_number} - Coverage comparison:
/api/v2/gh/{owner}/repos/{repo}/compare/{base}...{head}
Currently supports GitHub repositories (gh). Support for other providers (GitLab, Bitbucket) can be added by modifying the API paths.
Resources
- 📝 Building the Codecov MCP Server in 2 Hours - A detailed walkthrough of developing this server using AI-augmented development techniques
License
MIT
來源:README.md,提交 e5049d1
工具
0版本歷史
1- v1.1.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分