dev/tools
Profiler

MCP Context-Cost Profiler

A Python command-line tool that audits how many context tokens your MCP servers burn across Claude Code, Cursor, Claude Desktop and generic mcp.json configs.

$19 USD, one-time

What it does
  • Reports tokens per server and per tool, with each server's share of the total and the largest tools called out.
  • Finds duplicated or overlapping tools across servers (same name, or very similar descriptions) and the tokens you would save by dropping one.
  • Simulates three fixes: deferred loading, disabling low-use servers (from a usage file you supply), and minifying descriptions to a length you choose. It also reports the combined effect.
  • Outputs a terminal report, a Markdown report for issues and wikis, or JSON you can threshold on in CI.
  • Optional --verify checks the estimates against Anthropic's count_tokens API and shows estimated versus actual per server.

It is Python 3.8+, standard library only. mcp_profile.py contains no networking code and makes no network calls. The only network code is in the separate mcp_verify.py, loaded only when you pass --verify.

How it works

MCP config files list servers, not tools, so the tool definitions have to come from somewhere. In order of precedence: an inline tools array in the config; a snapshot file (--tools FILE or mcp-tools.json); or --probe, which starts each configured stdio server on your machine, runs initialize and tools/list, and stops it. Servers with no tool data are listed as unmeasured and left out of totals. The tool never guesses a size.

By default each tool is serialized to compact JSON and the character count divided by 4, rounded up. That is a rule of thumb and no error bound is claimed. --verify measures the actual error for your setup. It sends only tool names, descriptions and input schemas, one request per server, minus a one-stub-tool baseline. Your config file, env values, arguments and paths are never sent.

Real output from the built-in demo (python3 mcp_profile.py --demo), from the README. Summary line:

Context overhead: 3,451 tokens (estimated) across 3 servers / 20 tools
That is 1.7% of a 200,000-token context window, paid on every request.
Per-server breakdown, same demo output (bar column omitted)
ServerTransportToolsTokensShare
githubstdio122,62175.9%
filesystemstdio658216.9%
ripgrep-searchstdio22487.2%

Not sure it is worth installing? Try the free calculator first.

Free vs paid

Free on GitHub

The repository contains the full working tool. Nothing is crippled, locked or time-limited. Clone it and use it.

Supporter tier, $19

Same code, plus the packaged release (the mcp-context-profiler-v1.1.0.zip install below), priority fixes, workflow docs, and a license key (TIMO_...) that carries update entitlements. It funds development. The tools work fully without a key.

Install

Packaged release, from the README:

unzip mcp-context-profiler-v1.1.0.zip -d mcp-context-profiler
cd mcp-context-profiler
python3 mcp_profile.py --demo

Free, from the repository (the same mcp_profile.py is in it):

git clone https://github.com/timoranjes/mcp-context-profiler.git
cd mcp-context-profiler
python3 mcp_profile.py --demo

There is no install step beyond Python 3.8 or newer. Tests: python3 -m unittest discover -s tests. Windows is untested; the development machine was Linux.