# rpg-encoder

Builds a semantic graph of your repo with Tree-sitter and hands the agent a whole-project map in one call. Useful when code search drowns in grep and file reads.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 31
- Author: userFRM
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/userFRM/rpg-encoder
- Updated: 2026-05-29
- HTML: https://affpapa.org/en/nevibecode/mcp/rpg-encoder

## What it does

\`rpg-encoder` parses a repository with Tree-sitter and pulls out functions, classes and methods along with the edges between them: imports, calls, inheritance. An LLM then reads each entity and writes verb-object features — things like validating JWT tokens or serializing config to disk. Those features cluster into a three-level hierarchy (area → category → subcategory) that follows what the code does rather than the folder tree.

The finished graph compresses into a snapshot of roughly 25K tokens: the hierarchy, entities with their features, a condensed dependency skeleton, and the ten most-connected nodes. The agent reads it once and can then answer questions such as what handles authentication, even when nothing in the code is named auth. The server watches the working tree and re-syncs the graph before the next query, so you never refresh it by hand.

Lifting features runs two ways. Agent lifting spends tokens from your Claude or Cursor subscription. Autonomous `auto_lift` calls an external model directly and needs an API key in an environment variable, for example `ANTHROPIC_API_KEY`. On large repos `lifting_status` tells the agent to hand the loop to a sub-agent or a cheaper model, since feature extraction is pattern matching rather than reasoning. No sub-agent mechanism in your runtime? Run `rpg-encoder lift --provider anthropic|openai` from the terminal, then call `reload_rpg` to load the updated graph.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add rpg-encoder -- npx -y rpg-encoder
```

### Codex

**Platform CLI**
```bash
codex mcp add rpg-encoder -- npx -y rpg-encoder
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "rpg-encoder": {
            "command": "npx",
            "args": [
                "-y",
                "rpg-encoder"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "rpg-encoder": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "rpg-encoder"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add rpg-encoder npx -y rpg-encoder
```

## When to use it
- find code by intent when function names reveal nothing
- get a whole-repo map in one call instead of chained greps
- see what breaks when a given entity changes
- plan a safe refactor of one area
- cut token spend on reading files for context

## Example prompts
- Build and lift the RPG for this repo
- What handles authentication in this project?
- Show everything that depends on the database connection

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
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
