token-diet
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@token-dietInitialize the repo map and enable diff-only mode for this project."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ctx — token-saving context engine
Local middleware between your AI coding tool (Claude Code, Cowork, Codex, any MCP host) and the model. It shapes every request to be minimal but intelligent: a graph-ranked repo map instead of whole files, an append-only decision log instead of replayed history, a stable cached prefix, and diff-only output. Saving tokens and keeping the model sharp are the same goal — see ARCHITECTURE.md.
Install
pipx install token-diet # core (runs with graceful fallbacks)
pipx install 'token-diet[all]' # full: MCP + proxy + tree-sitter + tiktoken + docsNot on PyPI yet? Install straight from GitHub:
pipx install 'git+https://github.com/aryxnsdfs/token-diet'From source:
pip install -e '.[all,dev]'The core works with zero heavy deps via fallbacks (regex parser, char-based
token estimate, heuristic distillation). Install extras to upgrade each piece;
ctx doctor shows what's active.
Related MCP server: token-pilot
Quick start
cd your-project
ctx init # build index, register with host, write command files
ctx doctor # verify wiring + see which optional deps are activeIn Claude Code, press / and pick a command. First run /init (or
/ctx start) to warm the chat — injects the repo map, enables diff mode.
Commands
Command | Does |
| Build index, inject map, enable diff-only output |
| Inject the graph-ranked repo map |
| Pin full detail of a file or symbol |
| Pull just one symbol's body |
| Force diff-only (SEARCH/REPLACE) output |
| Distill old history into the decision log |
| Token + cache telemetry |
| Force a model tier (frontier|cheap_cloud|local) |
Two front-ends, one engine
Mode A — MCP server.
ctx serveexposes every command as an MCP prompt (you type/name) and tool (the model calls it). The native path for MCP-aware hosts.Mode B — local proxy.
ctx proxyruns alocalhost:8000server you point a client at; it optimizes every request and parses/textfor non-MCP tools.
Layout
ctx/
cli.py init · index · serve · doctor · proxy
registry.py single source of truth for commands
server.py FastMCP: prompts + tools + resources
proxy.py Mode B FastAPI proxy
init/ per-host registration adapters
engine/ index · repomap · assembler · budget · memory · docs · patch · router · telemetry
tests/ unit + eval harness (the guardrail)The guardrail
tests/evals/ holds representative tasks with automatic checks. Token
reduction only counts as saving intelligence if task success holds. Run
pytest on every engine change.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/aryxnsdfs/token-diet'
If you have feedback or need assistance with the MCP directory API, please join our Discord server