rpg-encoder — Claude Code MCP server: a code graph
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.
claude mcp add rpg-encoder -- npx -y rpg-encoderWhat rpg-encoder 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.
What it helps with
- 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 for the agent
- Build and lift the RPG for this repo
- What handles authentication in this project?
- Show everything that depends on the database connection
How to install rpg-encoder
Platform CLI
claude mcp add rpg-encoder -- npx -y rpg-encoderPlatform CLI
codex mcp add rpg-encoder -- npx -y rpg-encoderConfig file
{
"mcpServers": {
"rpg-encoder": {
"command": "npx",
"args": [
"-y",
"rpg-encoder"
]
}
}
}Config file
{
"servers": {
"rpg-encoder": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"rpg-encoder"
]
}
}
}Platform CLI
gemini mcp add rpg-encoder npx -y rpg-encoderStep 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 rpg-encoder
How do I install rpg-encoder in Claude Code?
With one command: claude mcp add rpg-encoder -- npx -y rpg-encoder. No Rust toolchain and no build step — npx fetches a pre-built binary for your platform.
What does rpg-encoder do?
It parses code with Tree-sitter, attaches intent-level features to each entity, and assembles a semantic graph. Over MCP the agent gets a snapshot of the repo and can answer questions about structure and behavior.
How is agent lifting different from auto_lift?
Agent lifting runs on tokens from your Claude or Cursor subscription. auto_lift talks to an external model directly and needs an API key in an environment variable.