One Server, Two Clients: TestPilot and Claude Code
Why This Matters
The real pay-off of MCP is reuse. The server you built for an unattended triage job can also help a developer who is fixing the failing test by hand, without changing a line.
Add the server to the project
Claude Code reads project MCP servers from .mcp.json in the repository root, shared with everyone who clones it:
{
"mcpServers": {
"testpilot": {
"command": "npx",
"args": ["tsx", "mcp/server.ts"],
"env": { "CI_API_URL": "${CI_API_URL}" }
}
}
}
Secrets come from each developer’s environment, never from the committed file. The first time, Claude Code asks you to approve the project’s server.
After approval, /mcp in Claude Code lists it under Project MCPs, connected, with its four read-only tools:
Project servers sit next to your personal (user) servers and any connectors from your account; only the project ones come from the repository.
Same tools, new use
Start Claude Code in the repository and ask:
Why did the search suggestions test fail last night, and is it the same problem as last week?
Claude Code calls get_test_history and read_log from your server, then reads the test file itself and proposes a fix: wait for the suggestions response instead of asserting immediately. The triage knowledge you packaged once now serves a developer at the keyboard.
In a real session on t-004, Claude Code called all four tools on your server, quoted the full log, and landed on a sharper verdict than the nightly job had:
The decisive line is in the full log: toHaveCount(5) timeout 0ms (test override). The test switched off Playwright’s own waiting, so it checks exactly once, 70 ms after typing. The verdict moves from flaky to a test bug that shows up as flakiness, with a one-line fix, and the existing ticket QA-118 should point at the override, not at staging. Same server, same tools as the nightly job; a person with the test in front of them takes it one step further. (It could not open tests/search.spec.ts, which belongs to the shop being tested, not to this repository, and it said so instead of guessing.)
Same tools, different risk
| Nightly TestPilot job | Developer in Claude Code | |
|---|---|---|
| Who watches | Nobody, until the morning | A person, live |
| Approvals | Proposals in the report | Asked on the spot |
| Write tools | Proposal only | Maybe allowed, with confirmation |
| Blast radius | Many failures at once | One task |
The server stays the same; the client’s permissions differ. In Claude Code you decide per tool whether it may run without asking (module 6).
Shared server or private tool?
Put a tool in the shared MCP server when:
- more than one client needs it
- it wraps a system with its own credentials
- you want one place to review what agents can reach
Keep it inside one application when it is specific to that application’s logic, such as submit_verdict, which only means something inside TestPilot’s loop.
Exercise
Add .mcp.json, start Claude Code in testpilot-ai and use the server to investigate t-004. Write down which tools Claude Code called and which permission prompts you saw.
Compare with solution/lesson-31-mcp-server, which covers lessons 24–31 (see docs/exercises.md, module 4).

