# Trunk Flaky Tests

Connects Trunk Flaky Tests data to your AI agent: it pinpoints unstable tests, explains the failure and suggests a fix.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI
- Author: trunk-io
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/trunk-io/mcp-server
- Updated: 2026-03-13
- HTML: https://affpapa.org/en/nevibecode/mcp/trunk-flaky-tests

## What it 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.

## Requirements
- Remote server: `https://mcp.trunk.io/mcp`

## Install

### Claude Code (native platform)

**Platform CLI: remote server**
```bash
claude mcp add --transport http mcp-server https://mcp.trunk.io/mcp
```

### Codex

**Platform CLI: remote server**
```bash
codex mcp add trunk-flaky-tests --url https://mcp.trunk.io/mcp
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "trunk-flaky-tests": {
            "url": "https://mcp.trunk.io/mcp"
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "trunk-flaky-tests": {
            "type": "http",
            "url": "https://mcp.trunk.io/mcp"
        }
    }
}
```

### Gemini CLI

**Platform CLI: remote server**
```bash
gemini mcp add -t http trunk-flaky-tests https://mcp.trunk.io/mcp
```

## When to use it
- 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
- Show me the root cause for `checkout.spec.ts` and suggest a fix
- Why is `login_test` flaky? Give me the fix options
- Generate a plan to upload test results to Trunk

## Similar
- [fix-flaky-tests](https://affpapa.org/en/nevibecode/skills/fix-flaky-tests.md) — skill · 503 installs
- [test-reliability](https://affpapa.org/en/nevibecode/skills/test-reliability.md) — skill · 1100 installs
- [debugging](https://affpapa.org/en/nevibecode/skills/akillness-debugging.md) — skill · 361 installs
- [test-strategy](https://affpapa.org/en/nevibecode/skills/avelikiy-test-strategy.md) — skill · ★ 107
- [fix](https://affpapa.org/en/nevibecode/skills/fix.md) — skill · 1638 installs
- [testing-strategies](https://affpapa.org/en/nevibecode/skills/akillness-testing-strategies.md) — skill · 368 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
