# Codna MCP server

> Enables AI agents to triage issues, fix bugs, verify SARIF scanner reachability, and perform semantic code recall within a repository.

- Repository: https://github.com/thyn-ai/codna-cli
- Page: https://hostedmcp.org/servers/thyn-ai/codna-cli
- Transport: stdio
- Stars: 0
- License: Apache-2.0
- Latest version: 0.2.113

## Install

### Claude Code

```sh
claude mcp add --env ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_API_KEY> --env CODNA_API_KEY=<YOUR_CODNA_API_KEY> --env GEMINI_API_KEY=<YOUR_GEMINI_API_KEY> --env GITHUB_TOKEN=<YOUR_GITHUB_TOKEN> --env OPENAI_API_KEY=<YOUR_OPENAI_API_KEY> codna-cli -- uvx codna
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "codna-cli": {
      "command": "uvx",
      "args": [
        "codna"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>",
        "CODNA_API_KEY": "<YOUR_CODNA_API_KEY>",
        "GEMINI_API_KEY": "<YOUR_GEMINI_API_KEY>",
        "GITHUB_TOKEN": "<YOUR_GITHUB_TOKEN>",
        "OPENAI_API_KEY": "<YOUR_OPENAI_API_KEY>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "codna-cli": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "codna"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>",
        "CODNA_API_KEY": "<YOUR_CODNA_API_KEY>",
        "GEMINI_API_KEY": "<YOUR_GEMINI_API_KEY>",
        "GITHUB_TOKEN": "<YOUR_GITHUB_TOKEN>",
        "OPENAI_API_KEY": "<YOUR_OPENAI_API_KEY>"
      }
    }
  }
}
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "codna-cli": {
      "command": "uvx",
      "args": [
        "codna"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>",
        "CODNA_API_KEY": "<YOUR_CODNA_API_KEY>",
        "GEMINI_API_KEY": "<YOUR_GEMINI_API_KEY>",
        "GITHUB_TOKEN": "<YOUR_GITHUB_TOKEN>",
        "OPENAI_API_KEY": "<YOUR_OPENAI_API_KEY>"
      }
    }
  }
}
```

### Codex (`~/.codex/config.toml`)

```toml
[mcp_servers.codna-cli]
command = "uvx"
args = ["codna"]

[mcp_servers.codna-cli.env]
ANTHROPIC_API_KEY = "<YOUR_ANTHROPIC_API_KEY>"
CODNA_API_KEY = "<YOUR_CODNA_API_KEY>"
GEMINI_API_KEY = "<YOUR_GEMINI_API_KEY>"
GITHUB_TOKEN = "<YOUR_GITHUB_TOKEN>"
OPENAI_API_KEY = "<YOUR_OPENAI_API_KEY>"
```

### Gemini CLI (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "codna-cli": {
      "command": "uvx",
      "args": [
        "codna"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>",
        "CODNA_API_KEY": "<YOUR_CODNA_API_KEY>",
        "GEMINI_API_KEY": "<YOUR_GEMINI_API_KEY>",
        "GITHUB_TOKEN": "<YOUR_GITHUB_TOKEN>",
        "OPENAI_API_KEY": "<YOUR_OPENAI_API_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `ANTHROPIC_API_KEY` | no | yes | Provider key for codna_fix's planner — any one of ANTHROPIC_API_KEY (Anthropic), OPENAI_API_KEY (OpenAI/ChatGPT), or GEMINI_API_KEY (Gemini) works (or store one with `codna key set <provider>`). Every tool also requires the one-time free `codna login` device authorization before executing; introspection (initialize/tools/list) needs no credentials. |
| `CODNA_API_KEY` | no | yes | Codna key from the one-time free `codna login` (device authorization, free community license). Required to execute any of the five tools; introspection (initialize/tools/list) needs none. |
| `GEMINI_API_KEY` | no | yes | Alternative provider key (Gemini) for codna_fix's planner — see ANTHROPIC_API_KEY. |
| `GITHUB_TOKEN` | no | yes | Write token, only for codna_fix with open_pr=true (opens a pull request) and codna_report_bug (files an issue). |
| `OPENAI_API_KEY` | no | yes | Alternative provider key (OpenAI/ChatGPT) for codna_fix's planner — see ANTHROPIC_API_KEY. |

## FAQ

### Does Codna send my entire repository to an LLM?

No, fix and review only send one issue-specific evidence bundle to your chosen provider under your key, not the entire repository.

### How do I use Codna with Cursor or Claude Desktop?

You can install the MCP server via pipx and use the install command to automatically write the client configuration for Cursor or Claude.

### Can I use Codna offline?

Yes, repository mapping, triage, recall, and impact tools run offline, and recall runs fully offline after a one-time login.

### What scanner findings can Codna analyze?

Codna can prove the reachability of findings from CodeQL, Semgrep, Snyk, Trivy, or any other scanner that provides SARIF 2.1.0.
