TokenSafe
MCP server by tokensafe-dev Verified · tokensafe.dev
Adds context reduction, secret protection and runtime checks to AI coding agents through one local install. Built for developers and teams that use Cursor, Claude Code, Codex and similar agents.
Install TokenSafe
Built from the published package, never by AI.
claude mcp add tokensafe -- npx -y tokensafeRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"tokensafe": {
"args": [
"-y",
"tokensafe"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"tokensafe": {
"args": [
"-y",
"tokensafe"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"tokensafe": {
"args": [
"-y",
"tokensafe"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add tokensafe -- npx -y tokensafe{
"mcpServers": {
"tokensafe": {
"args": [
"-y",
"tokensafe"
],
"command": "npx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add tokensafe npx -y tokensafeGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the tokensafe block.
About
TokenSafe is a local MCP server and CLI for AI coding agents. It reduces how much code an agent reads, using AST slicing, a SQLite full-text code index, image downscaling and pruning of superseded tool output. It also strips ANSI codes from tool output, redacts local keys and PII, and reports measured token savings in a terminal dashboard and a loopback-only browser panel.
One install connects TokenSafe to agents such as Cursor, Claude Code, Codex, Windsurf, Google Antigravity, Kimi Code and ChatGPT. The installer detects the agents on a machine, registers the MCP server, injects project rules and wires lifecycle hooks where the agent supports them. It is aimed at teams whose agents read too much code, expose secrets or hit usage limits. Cloud features such as team metrics and a shared team cache need a license key.
Written from the project's README and checked against it.
Tools it gives your assistant
scoped_searchSearches the repository with SQLite FTS5 BM25 ranking and trigram tokenization.optimize_imageScales down screenshots, diagrams and mockups larger than 1024px, keeping originals intact.get_mistakesLists failed hypotheses, loop guard trips and git reverts recorded for the project.prune_supersededPrunes obsolete intermediate tool reads that later edits or re-reads replaced.expand_refRecovers a folded code block using its 8-character hash anchor.
What you need
- Python 3.10 or newer, or the npm launcher, which can download a pinned CPython 3.12
- A supported AI coding agent such as Cursor, Claude Code or Codex
- A TS2 license key for cloud features such as team metrics and shared cache
| Setting | Needed | What it is |
|---|---|---|
AuthorizationHeader, secret | Optional | Not described |
From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.
Try asking
- Use scoped_search to find where token validation is implemented in this repo.
- Run optimize_image on this screenshot before you analyze it.
- Check get_mistakes before retrying the failed fix for this test.
Good to know
- Cloud features such as team metrics and shared team cache need a TS2 license key.
- Image downscaling uses Pillow, or macOS sips as a fallback.
- Without the optional tree-sitter grammars, the slicer falls back to stdlib heuristics.
Security check
C- Downloads a script from the internet and runs itIn
README.md:curl -fsSL https://tokensafe.dev/install.sh | bash
Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to TokenSafe
All alternatives →Turns GitHub repositories into architecture diagrams, written explanations, Mermaid source and narrated explainer videos. Built for developers who want to understand a codebase, and for AI agents that need to read one.
Mocks, records, and chaos-tests HTTP(S) dependencies for development and testing. One port serves many protocols, including gRPC, WebSockets, and LLM chat APIs. Built for developers and testers who need stand-in services during tests.
Provides MCP server and CLI tools that let AI coding agents build, test and manage iOS and macOS projects with Xcode and simulators. It is aimed at developers working on Apple platform apps.
Creates editable draw.io diagrams in AI chat from Mermaid, PlantUML, CSV or draw.io XML. Built for people who want diagrams from text prompts that stay editable in draw.io.
Indexes your code, git history, tests and decisions on your machine so AI coding agents can query the index instead of re-reading files. Built for developers who want fewer files opened and clearer answers about change risk and code health.
Gives your AI assistant hosted codebase intelligence for repos indexed on repowise.dev. Use it to ask how code works, what a change may break, and which tests to run.
Compare with GitDiagram, mockserver or XcodeBuildMCP
TokenSafe: common questions
Which AI agents does TokenSafe work with?
The source lists Cursor, Claude Code, Codex, Windsurf, Google Antigravity, Kimi Code and ChatGPT as supported. It also lists Claude Desktop, Cline, Roo Code, GitHub Copilot and Z.ai Code with MCP registration.
Does TokenSafe need a license key?
Local features work without one. Cloud features such as team metrics, managed distillation and shared team cache need a TS2 license key, and four public tools work without a key.
Does TokenSafe need Python installed?
It needs CPython 3.10 or newer. If none is found, the npm launcher downloads a pinned, SHA-256-verified CPython 3.12 into ~/.tokensafe/runtime, unless TOKENSAFE_NO_DOWNLOAD=1 is set.
How do I install TokenSafe?
In Claude Code run claude mcp add tokensafe -- npx -y tokensafe. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is TokenSafe the official server?
TokenSafe is published by tokensafe.dev from its verified domain in the official MCP Registry.
Is TokenSafe free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is TokenSafe safe to use?
It scores 97 of 100. Grades: maintenance A, licence A, quality C. Security check: grade C (downloads a script from the internet and runs it). Review the code before you install. How grades work.
What are alternatives to TokenSafe?
Similar MCP servers: GitDiagram, mockserver, XcodeBuildMCP, draw.io.
Does TokenSafe work with ChatGPT?
Yes. Add its server URL in ChatGPT as a custom connector. See MCP in ChatGPT.
