Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 97
  • 47 stars
  • 18k a week
  • Apache-2.0
  • Updated

Install TokenSafe

Built from the published package, never by AI.

claude mcp add tokensafe -- npx -y tokensafe

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install TokenSafe in Claude Code

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
SettingNeededWhat it is
AuthorizationHeader, secretOptionalNot 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 →

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.

TokenSafe Install

Add to stack

Loading.