tokenmizer — Claude Code MCP server for session memory
Tokenmizer records session decisions, files, errors, and goals in a knowledge graph, then uses that record to restore context when a model’s window fills up.
claude mcp add --env TOKENMIZER_URL=<TOKENMIZER_URL> --env TOKENMIZER_API_KEY=<TOKENMIZER_API_KEY> --transport stdio tokenmizer -- uvx tokenmizerWhat tokenmizer does
Tokenmizer acts as an OpenAI-compatible proxy. It turns session information into a knowledge graph and draws on that graph when the model runs out of context. The stored links preserve why a decision was made, including reasons for rejecting an earlier option.
The server also provides session views, a graph, and a resume block for continuing work. In Claude Code, the install command starts uvx tokenmizer and passes TOKENMIZER_API_KEY; the alternative command also sets TOKENMIZER_URL. You’ll need an API key before connecting, or the server cannot access the API.
What it helps with
- keep decisions and their rationale from a long session
- restore context after the model window fills
- avoid revisiting an option that was rejected earlier
- inspect links between facts in a session graph
Example prompts for the agent
- Continue the project using the context from my earlier session.
- Show why we chose PostgreSQL over MongoDB.
- Prepare a resume block from the current session.
How to install tokenmizer
Platform CLI
claude mcp add --env TOKENMIZER_URL=<TOKENMIZER_URL> --env TOKENMIZER_API_KEY=<TOKENMIZER_API_KEY> --transport stdio tokenmizer -- uvx tokenmizerReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from tokenmizer <command>
Platform CLI
codex mcp add tokenmizer --env TOKENMIZER_URL=<TOKENMIZER_URL> --env TOKENMIZER_API_KEY=<TOKENMIZER_API_KEY> -- uvx tokenmizerReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from tokenmizer <command>
Config file
{
"mcpServers": {
"tokenmizer": {
"command": "uvx",
"args": [
"tokenmizer"
],
"env": {
"TOKENMIZER_URL": "<TOKENMIZER_URL>",
"TOKENMIZER_API_KEY": "<TOKENMIZER_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from tokenmizer <command>
Config file
{
"servers": {
"tokenmizer": {
"type": "stdio",
"command": "uvx",
"args": [
"tokenmizer"
],
"env": {
"TOKENMIZER_URL": "<TOKENMIZER_URL>",
"TOKENMIZER_API_KEY": "<TOKENMIZER_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from tokenmizer <command>
Platform CLI
gemini mcp add -e TOKENMIZER_URL=<TOKENMIZER_URL> -e TOKENMIZER_API_KEY=<TOKENMIZER_API_KEY> tokenmizer uvx tokenmizerReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from tokenmizer <command>
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 tokenmizer
How do I install tokenmizer in Claude Code?
Run claude mcp add tokenmizer -e TOKENMIZER_API_KEY=<TOKENMIZER_API_KEY> -- uvx tokenmizer. Replace the placeholder with your API key.
What does tokenmizer do?
It builds a knowledge graph from session details and uses it to restore context when the model window fills. The graph connects decisions with their rationale.
What key does tokenmizer need for Claude Code?
The install command sets TOKENMIZER_API_KEY. The alternative setup also passes TOKENMIZER_URL.