# rag-rat MCP server

> Provides coding agents with repository intelligence, including code graphs, git history, and durable, source-anchored memories.

- Repository: https://github.com/cq27-dev/rag-rat
- Page: https://hostedmcp.org/servers/cq27-dev/rag-rat
- Transport: stdio
- Stars: 27
- License: MIT
- Latest version: 0.24.1

## Install

### Claude Code

```sh
claude mcp add rag-rat -- npx -y @rag-rat/bin
```

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

```json
{
  "mcpServers": {
    "rag-rat": {
      "command": "npx",
      "args": [
        "-y",
        "@rag-rat/bin"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "rag-rat": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@rag-rat/bin"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"rag-rat","type":"stdio","command":"npx","args":["-y","@rag-rat/bin"]}'
```

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

```json
{
  "mcpServers": {
    "rag-rat": {
      "command": "npx",
      "args": [
        "-y",
        "@rag-rat/bin"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add rag-rat -- npx -y @rag-rat/bin
```

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

```toml
[mcp_servers.rag-rat]
command = "npx"
args = ["-y", "@rag-rat/bin"]
```

### Gemini CLI

```sh
gemini mcp add -s user rag-rat npx -- -y @rag-rat/bin
```

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

```json
{
  "mcpServers": {
    "rag-rat": {
      "command": "npx",
      "args": [
        "-y",
        "@rag-rat/bin"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `LENS_TOKEN` | no | no |  |

## Tools (6)

- `impact_surface`
- `semantic_search`
- `symbol_lookup`
- `important_symbols`
- `find_clones`
- `memory_create`

## FAQ

### What makes rag-rat different from standard grep or file reads?

It adds a layer of source-anchored rationale, connecting code to its callers, callees, tests, git/GitHub history, and prior decisions with confidence labels.

### What are repo memories?

They are typed, source-anchored notes like Invariants, Decisions, or Risks that persist across sessions and agents to provide context that survives refactors.

### Does rag-rat modify my source code?

No, it keeps source files read-only and only writes to its own SQLite database.

### How can I prevent an agent from writing duplicate code?

The PreToolUse hook fingerprints functions during Write/Edit operations and warns if they are exact or near-duplicates of existing code.
