Trunk Flaky Tests — Claude Code MCP server: diagnose failing tests
Connects Trunk Flaky Tests data to your AI agent: it pinpoints unstable tests, explains the failure and suggests a fix.
claude mcp add --transport http mcp-server https://mcp.trunk.io/mcpWhat Trunk Flaky Tests does
The server exposes two tools to the agent. fix-flaky-test returns a breakdown of why a test failed plus suggested corrections, and setup-trunk-uploads builds a plan for sending test results to Trunk. Everything runs over the remote endpoint https://mcp.trunk.io/mcp, so there is no local process to start.
Authorization uses OAuth 2.0 with OpenID Connect. Your client will ask you to sign in to a Trunk account on connect. Skip that and the tools stay silent, so set up the account and make sure it can see the project whose tests you care about.
Setup differs per client. Claude takes a single command, Cursor and GitHub Copilot need a JSON settings entry, Gemini CLI has its own add command. Gemini Code Assist and Windsurf are absent from the supported list because their MCP handling is limited — expect the connection to fail there.
What it helps with
- find out why a test passes on one run and fails on the next
- get a concrete fix instead of rerunning the build until it goes green
- set up test result uploads to Trunk from a generated plan
- pull a test's failure history into the editor without opening a browser
Example prompts for the agent
- Show me the root cause for
checkout.spec.tsand suggest a fix - Why is
login_testflaky? Give me the fix options - Generate a plan to upload test results to Trunk
How to install Trunk Flaky Tests
Platform CLI: remote server
claude mcp add --transport http mcp-server https://mcp.trunk.io/mcpPlatform CLI: remote server
codex mcp add trunk-flaky-tests --url https://mcp.trunk.io/mcpConfig file
{
"mcpServers": {
"trunk-flaky-tests": {
"url": "https://mcp.trunk.io/mcp"
}
}
}Config file
{
"servers": {
"trunk-flaky-tests": {
"type": "http",
"url": "https://mcp.trunk.io/mcp"
}
}
}Platform CLI: remote server
gemini mcp add -t http trunk-flaky-tests https://mcp.trunk.io/mcpStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Trunk Flaky Tests
How do I install Trunk Flaky Tests in Claude Code?
Run claude mcp add --transport http mcp-server https://mcp.trunk.io/mcp. The client will then prompt you to authenticate with your Trunk account.
What does Trunk Flaky Tests do?
It gives the agent access to flaky test analysis: the cause of a failure, suggested corrections, and a plan for uploading results to Trunk.
Which clients are supported?
Cursor, Claude, GitHub Copilot and Gemini CLI. Gemini Code Assist and Windsurf are not supported because their MCP support is limited.