TokenSafe · tokensafe-dev — Claude Code MCP server: features and setup
The TokenSafe MCP server for Claude Code trims irrelevant material from an AI agent’s working context. It narrows code snippets and cleans tool output during coding sessions.
MIT ★ 47 updated 2026-11-16
claude mcp add --transport http tokensafe https://api.tokensafe.dev/mcpWhat TokenSafe does
TokenSafe uses Tree-sitter to select code fragments, searches the repository, and removes outdated tool results from long transcripts. It also strips terminal control sequences and resizes images before they reach the model. Image handling uses Pillow or macOS sips.
The local npx setup runs basic tools without a key. Cloud features such as team metrics, a shared team cache, and managed distillation connect to https://api.tokensafe.dev/mcp and require a TS2 license key. The Claude Code HTTP setup registers the cloud server; a separate local command runs TokenSafe through npx.
What it helps with
- trim lockfiles and build output from an agent’s context
- locate API calls and their corresponding server routes
- remove superseded tool results from long session transcripts
- strip ANSI control codes from command output
Example prompts for the agent
- Keep only the code fragments relevant to this session.
- Find the client API calls and matching server routes in this repository.
- Remove terminal control sequences from the test output.
How to install TokenSafe
1Platform CLI: remote server
claude mcp add --transport http tokensafe https://api.tokensafe.dev/mcp2Platform CLI
claude mcp add tokensafe-dev-tokensafe -- npx -y tokensafe1Platform CLI: remote server
codex mcp add tokensafe-dev-tokensafe --url https://api.tokensafe.dev/mcp2Platform CLI
codex mcp add tokensafe-dev-tokensafe -- npx -y tokensafeConfig file
{
"mcpServers": {
"tokensafe-dev-tokensafe": {
"url": "https://api.tokensafe.dev/mcp"
}
}
}{
"mcpServers": {
"tokensafe-dev-tokensafe": {
"command": "npx",
"args": [
"-y",
"tokensafe"
]
}
}
}Config file
{
"servers": {
"tokensafe-dev-tokensafe": {
"type": "http",
"url": "https://api.tokensafe.dev/mcp"
}
}
}{
"servers": {
"tokensafe-dev-tokensafe": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"tokensafe"
]
}
}
}1Platform CLI: remote server
gemini mcp add -t http tokensafe-dev-tokensafe https://api.tokensafe.dev/mcp2Platform CLI
gemini mcp add tokensafe-dev-tokensafe npx -y tokensafeStep 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 TokenSafe
How do I install TokenSafe in Claude Code?
For a local setup, run claude mcp add tokensafe-dev-tokensafe -- npx -y tokensafe. This is one installation method.
What does TokenSafe do?
It narrows code context, searches repositories, and prunes outdated tool output from agent transcripts. It can also process images and clean terminal output.
What does TokenSafe need for its cloud features?
Cloud features require a TS2 license key and connect through https://api.tokensafe.dev/mcp. The basic local tools run without a key.
Similar MCP servers
All MCP servers for Agent setup: memory, context, orchestration →TokenSafe by other authors comes first.