Docs / Commands
Wrap MCP servers
Updated
tokenade mcp-wrap puts Tokenade between your agent and each third-party MCP server. The server runs exactly as before; Tokenade only rewrites tool results that are too big, and screenshots that are larger than needed. tokenade install sets this up for every agent it configures, so you rarely run it by hand.
Usage
tokenade mcp-wrap uninstall [<server>] # restore original launch command (no name / --all = every wrapped)
tokenade mcp-wrap report # per-tool savings table (+ real $)
tokenade mcp-wrap -- <bin> [<args>…] # run as the proxy (agents do this)
tokenade mcp-wrap <bin> [<args>…] # leading `--` is optional
Aliases: mcp_wrap, mcp-proxy, mcp_proxy. mcp-proxy is the former name, kept because existing configs still launch it.
What happens to a tool call
- Your agent launches
tokenade mcp-wrap -- <original command>instead of the server. - Tokenade starts the real server and relays messages both ways, unchanged.
- Any text tool result larger than about 25k tokens (the file-read threshold,
TOKENADE_READ_DISCLOSE_THRESHOLD, since your agent asked for that content) is written to the stash and replaced with a summary. The agent can drill in withtokenade expand-ref <hash>. - Image results whose long edge is over the cap are resized and re-encoded. The payload is swapped only if it actually shrank, and a text item is appended saying the new size and how to turn it off.
One proxy runs per server per agent session, and it exits when the agent closes its stdin.
To keep screenshots at full resolution, set TOKENADE_IMAGE_MAX_EDGE=0 in the wrapped server's environment.
install and uninstall
install and uninstall edit your agents' MCP configuration in place: Claude, Cursor, Codex, Copilot, Windsurf, Cline and VS Code, on Linux, macOS and Windows paths. They write a timestamped .bak first, rewrite atomically, and are idempotent and fully reversible.
tokenade mcp-wrap install github # wrap one server by name
tokenade mcp-wrap uninstall github # restore that one
Servers that belong to an app's own installation (for example the browser and computer-use server the Codex desktop app adds) are left alone, because the app changes their path on every update.
Savings from desktop apps are credited to the app: each wrapped server carries the app's name, so Claude Desktop, the Codex app or Cursor show up under their own name in the dashboard.
Claude Desktop Chat
Chat in Claude Desktop runs no local commands or file reads, so MCP optimisation is the only part of Tokenade that applies to it. Run tokenade mcp-wrap install to wrap the servers in its config. The Code tab of Claude Desktop is Claude Code and gets the full hook set; see Claude Code.
report
No wrapped-MCP tool activity recorded yet. Wrap a server with `tokenade mcp-wrap install <server>` and use it, then re-run.
Once wrapped servers have been used, report prints savings per tool, priced at the same per-model rates as tokenade dashboard.
Check and undo
tokenade unwrap-mcps --dry-run # show which configs would be restored
tokenade unwrap-mcps # flip every wrapped entry back
unwrap-mcps walks every known agent config and rewrites each wrapped entry back to its original command and args. It is idempotent and leaves the rest of Tokenade (hooks, rules, binary) in place. tokenade uninstall runs the same pass first, then removes everything else.
To keep tokenade install from wrapping servers in the first place, pass --no-wrap-mcps.
Gotchas
healthcheckreports wrapped entries that point at an old binary path (wrapped_mcps). Re-runtokenade installortokenade mcp-wrap installto fix them.- Large results are replaced by a summary plus a hash, not dropped. If your agent needs a detail, it asks the stash with
expand-ref. - On Claude Code, MCP results are also folded by a PostToolUse hook, which you can turn off with
TOKENADE_NO_MCP_HOOK=1.