The Problem: When AI Meets HTTP Limitations
I needed Claude Code to access our self-hosted Codecov instance. Simple enough, right? Just make some HTTP requests. But Claude Code was struggling with direct HTTP calls—the errors were messy, the context was getting polluted, and it wasn’t reliable.
I searched for an official Codecov MCP server. Nothing. Then I searched for any MCP server for Codecov and found exactly one third-party option: stedwick/codecov-mcp. It had one tool, basic functionality, and was already archived. Worse, it didn’t support self-hosted Codecov instances—a dealbreaker for my use case.
With nothing that would work for me, the choice was clear: build my own MCP server. And here’s the meta twist—I’d use Claude Code to build the tooling that extends Claude Code itself.
Time budget: 2 hours. The clock started.
The 30-Minute MVP: From Zero to Working Server
The beauty of MCP servers is their simplicity. The Model Context Protocol is essentially a JSON-RPC interface that lets Claude access external tools. With Claude Code writing the implementation and me providing guidance, we banged out a working server in 30 minutes flat.
The first local commit was a functioning MCP server with three tools—already better than the discontinued one.
Architecture at a Glance
Here’s the core structure (265 lines total):
| |
The CodecovClient class handles API communication:
| |
Three tools, clean API, configurable endpoints. Done.
The Authentication Stumble: Upload Token vs. API Token
After the initial euphoria wore off, reality hit: 401 Unauthorized.
Here’s what I learned the hard way: Codecov has two completely different token types:
- Upload Token: For pushing coverage reports during CI/CD (found in repo Settings → General)
- API Token: For reading coverage data via the API (created in Settings → Access)
I was using an upload token. Classic mistake. Once I generated a proper API token from the Codecov Settings → Access tab, authentication worked perfectly.
This became a critical part of the README—no one else should waste time on this gotcha:
| |
Self-Hosted Support: Why It Mattered
The discontinued server only supported codecov.io. I use a self-hosted Codecov instance for my business, so cloud-only wasn’t an option.
The fix was trivial—make the base URL configurable:
| |
One environment variable unlocked both cloud and enterprise use cases. This kind of flexibility is why building your own tooling matters.
Testing: 100% Coverage on an MCP Server
Here’s where things got interesting. Most MCP servers I’ve seen have zero tests. I wanted production-grade quality.
Claude Code helped implement comprehensive Vitest tests:
| |
Final coverage stats:
- Statements: 100%
- Branches: 100%
- Functions: 100%
- Lines: 100%
We even set up GitHub Actions to run tests on every push and upload coverage reports to… Codecov. Using the MCP server to check coverage on itself. The recursion is beautiful.
Making It Presentable: The Final Polish
The last hour was spent on developer experience:
Comprehensive Documentation
The README grew to 350 lines with:
- Clear installation instructions for both Claude Desktop and Claude Code
- Configuration examples for self-hosted instances
- Troubleshooting guide (especially for the token confusion)
- API compatibility notes
Badges (Because Why Not?)
| |
CLI Installation Support
Claude Code has a built-in MCP management CLI:
| |
One command to install. No manual JSON editing required.
Real-World Usage: It Works Beautifully
Now comes the payoff. Here’s how I actually use this in my daily workflow:
Example 1: PR Review Coverage Check
| |
Example 2: Finding Coverage Gaps
| |
Example 3: Repository Health Check
| |
No more fumbling with Codecov’s web UI. No more copying coverage numbers. Claude has direct access to the data and can reason about it.
Key Learnings: What This Project Taught Me
1. MCP Servers Are Simpler Than You Think
The entire working server is 265 lines. The protocol is straightforward JSON-RPC. If you can write a function that calls an API, you can write an MCP server.
2. Configuration Flexibility Matters
The difference between “works for me” and “works for everyone” is often just one environment variable. CODECOV_BASE_URL made this server useful for both cloud and enterprise users.
3. Tests on Infrastructure Code Are Worth It
Even “simple” integration code benefits from tests. Mocking the Codecov API helped catch edge cases (null refs, missing tokens, encoding issues) before they became production problems.
4. AI Pair Programming Accelerates Everything
Claude Code wrote 100% of the implementation code. My role was:
- Architectural decisions (“three tools, not one”)
- API exploration (“check the Codecov v2 docs”)
- Review and refinement (“add better error messages”)
- Testing strategy (“we need 100% coverage”)
This is what AI-augmented development looks like in practice. Human judgment, AI execution.
5. Documentation Is Half the Product
A working server without docs is useless. The token types section, troubleshooting guide, and configuration examples probably saved future users hours of frustration.
What’s Next?
Now that the MCP server is working beautifully, I’m going back to my current development efforts with a significantly improved workflow. Claude Code now has direct access to coverage data, which means:
- No more context switching to check coverage reports
- Coverage-aware code reviews happen naturally in conversation
- Test gap identification is instant
- Coverage trends inform architectural decisions
The 2-hour investment in building this tool has already paid dividends. This is the compounding effect of AI-augmented development—tooling that makes the AI more capable, which in turn helps you build better tooling.
The Meta Conclusion
This project embodies what “AI Augmented Software Development” means to me:
- Human identifies the need: “Claude needs better Codecov access”
- AI implements the solution: Claude Code writes the MCP server
- Human provides oversight: Architecture, testing, polish
- AI uses the result: Claude Code uses the MCP server to analyze coverage
- Cycle repeats: Improvements feed back into the toolchain
We used Claude Code to build tooling that makes Claude Code more powerful. The snake eats its tail, and the result is better software, faster.
Total time: 2 hours. Total value: immeasurable.
About This Article
This post was written by Claude Code (Sonnet 4.5) with guidance and vision from Eric Gulatee. The MCP server project itself was also developed collaboratively—Claude Code wrote 100% of the implementation, while Eric provided architectural decisions, API exploration, code review, and testing strategy. This article is a real-world example of AI-augmented development in action.
GitHub Repository: egulatee/mcp-server-codecov
Package: npm install mcp-server-codecov (coming soon)
MCP Protocol: Model Context Protocol Documentation
Have you built custom MCP servers for your internal tools? What other integrations would make Claude Code more powerful in your workflow? Share your thoughts in the comments or reach out on Twitter.