Article: MCP tools add, not cut, your Claude Code input-token bill; every prompt you send through a cleaning tool ends up costing more tokens, and therefore more money. Developers chasing lower API costs often reach for MCP-based cleaners, assuming they’ll shrink the prompt before the model sees it.

Why the token meter matters

Claude Code counts tokens the instant your text reaches the model’s context window. The model starts reading the raw prompt, then decides whether to invoke an MCP tool. The cleaning tool runs after the original text is already part of the conversation, so the meter has already logged those tokens.

A typical flow looks like this:

  1. Your raw prompt is submitted – the token counter ticks.
  2. The model reads the prompt and decides to call the cleaning tool.
  3. The tool returns a trimmed version.
  4. The context now holds three things: the original prompt, the tool-call metadata, and the cleaned prompt.

You are billed for all three entries. The “clean” version does not replace the original; it merely sits alongside it.

When MCP cleaning does help

An MCP tool saves tokens only when the raw text never enters the main Claude Code context. That occurs for downstream calls such as:

  • Retrieval-augmented generation (RAG) queries that the model forwards to a search engine or database.
  • Instructions sent to sub-agents that act independently of the primary conversation.

In those cases the model forwards the cleaned payload directly to the external system, keeping the original user text out of the primary token count.

How to actually shrink your input tokens

If you want to reduce the number of tokens you feed Claude Code, clean the text before it touches the model. Here are three practical approaches that work today:

  • System-level hotkeys – On Windows script AutoHotkey; on macOS use Automator. The script selects the text you’re about to send, pipes it to an external API that returns a cleaned version, and then replaces the text in the editor. Because the raw version never leaves your machine, only the cleaned version is ever submitted.
  • CLI piping – Launch Claude Code from a terminal and pre-process your prompt with a bash filter (e.g., a sed or Python script) that strips unnecessary whitespace, comments, or duplicated phrases. The filtered output is what gets fed to the model.
  • MCP for downstream calls only – Reserve MCP tools for the RAG or sub-agent steps described earlier. Let the model handle the initial user prompt directly, and let the cleaning tool act only on the payload that leaves the main conversation.

Common pitfalls to avoid

  • Assuming MCP tools trim the original prompt – They add a tool-call token block and preserve the raw text, inflating the total count.
  • Relying on Claude Code hooks – Hooks can inject extra context or block prompts, but they cannot overwrite the text already in the conversation.
  • Using slash commands with inline cleaning – Even if a command runs a cleaning script, the raw arguments remain part of the command line that the model records, so you pay for them too.

The token meter starts the instant your characters hit the model’s API endpoint. Anything that cleans after that point only adds overhead.

What this means for developers

Token pricing appears as a line item on most AI-service bills. Over-paying because a “cleaner” adds hidden tokens can quickly erode any savings you hoped to capture. Move the cleaning step to the client side to keep the token count honest and your budget predictable.

Takeaway: MCP tools are useful for downstream payloads, but they cannot trim the tokens of the prompt you type. Clean before you send, or restrict cleaning to calls that never appear in the main context, if you want a genuine reduction in Claude Code token costs.