Skip to main content
MCP server CX Codex

LeanToken — Claude Code MCP server: token-bounded repo context

Narrows a repository down to the files and code an agent actually needs, and keeps every response inside a token budget.

Open on GitHub

What LeanToken does

LeanToken indexes your source into a local database on your machine and acts as a read-only discovery and retrieval layer. The agent asks it for context; edits, builds and tests stay with the host's normal tools.

Every response carries an explicit token limit, so one large file can't swallow the request. The toolset covers file lookup, code search, structure outlines, exact range reads, history, JSON queries and token accounting. To avoid paying twice for the same evidence, the next context call accepts the previous receipt_id or returned fragment hashes as known_hashes.

Setup runs through npx leantoken setup: the wizard preselects the clients it detects, shows the config paths and asks for a separate confirmation. If a host starts LeanToken from the home directory or a filesystem root, it refuses to index that broad root by default. Verify the connection and a first retrieval with npx leantoken doctor.

What it helps with

  • find the relevant code in a large repo without reading all of it
  • keep an agent's output inside a token limit
  • continue a task without resending the same source
  • trace an observed failure from its traces and paths
  • inspect a module's structure before editing

Example prompts for the agent

  • Investigate this failure: here are the traces, paths and symbols.
  • Review the change from BASE..HEAD, changed paths only.

How to install LeanToken

Install

The MCP registry has no launch command for it: see the repository README

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

How do I install LeanToken in Claude Code?

Run npx leantoken setup, pick Claude in the wizard and confirm the config write. Restart the client, then check the connection with npx leantoken doctor.

What does LeanToken do?

It indexes the repository locally and returns only the files and code ranges the agent needs, within a set token limit. It is a search and read layer and does not edit files.

Where does LeanToken store its data?

The index lives in a local database on your machine. The server itself is read-only, and a global setup does not remember the repository where setup ran.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor