mcp-diet
v0.2.0
Published
Know where your context goes. Control what loads.
Downloads
208
Maintainers
Readme
mcp-diet
Know where your context goes. Control what loads.
mcp-diet analyzes the context window overhead of your MCP server configurations and lets you switch between lean and full setups with one command.
The Problem
MCP servers inject tool definitions into every API turn. With 4+ servers connected, you can lose 50,000-70,000 tokens (25-35% of a 200K context window) before typing a single message.
mcp-diet shows you exactly where those tokens go and lets you manage it.
Quick Start
npm install -g mcp-diet
mcp-diet analyzeWhat You Get
mcp-diet v0.1.0 — Context Window Analysis
Claude Code (user)
Server Tools Tokens % of Budget
─────────────────────────────────────────────────────────
Notion 21 12,450 6.2%
Google Calendar 11 6,230 3.1%
Claude Preview 14 5,100 2.6%
MemPalace 19 2,047 1.0%
scheduled-tasks 3 1,100 0.6%
─────────────────────────────────────────────────────────
TOTAL 68 26,927 13.5% of 200KCommands
Free
| Command | Description |
|---------|-------------|
| mcp-diet analyze | Scan all MCP clients, show token costs |
| mcp-diet analyze --json | Machine-readable output |
| mcp-diet analyze --sort name | Sort by name, tokens, or tools |
| mcp-diet analyze --client claude | Filter to specific client |
| mcp-diet doctor | Check all servers are reachable |
| mcp-diet backup | Backup all MCP configs |
| mcp-diet restore | List and restore from backups |
Pro ($9/month)
| Command | Description |
|---------|-------------|
| mcp-diet profile create coding --only mempalace,github | Create a lean profile |
| mcp-diet profile list | List all profiles |
| mcp-diet use coding | Switch to a profile |
| mcp-diet use full | Restore all servers |
| mcp-diet use coding --dry-run | Preview changes |
| mcp-diet history | Token usage trends |
| mcp-diet history --last 7d | Last 7 days |
Supported Clients
- Claude Code (project, user, and local configs)
- Claude Desktop (Windows and macOS)
- Cursor (global and project)
- Cline (Windows, macOS, Linux)
- VS Code (native MCP support)
Auto-discovery — no configuration needed.
Accurate Token Counting
Set your Anthropic API key for exact token counts (uses the free count_tokens endpoint):
export ANTHROPIC_API_KEY=sk-ant-...
mcp-diet analyzeWithout an API key, mcp-diet uses character-based estimation (~15-20% accuracy).
How It Works
- Discovers MCP configs across all known client locations
- Connects to each server via stdio and calls
tools/list - Converts MCP tool schemas to Claude API format
- Counts tokens via the Anthropic API (or estimates)
- Displays a ranked table with token costs and budget percentages
vs. Other Tools
| Tool | What it does | How mcp-diet differs | |------|-------------|---------------------| | mcp-slim | Reduces tool schemas by grouping | We don't optimize — we analyze and manage | | trimcp | Compresses schemas via proxy | We're not a proxy — zero runtime overhead | | MCPProxy | Dynamic tool loading | We're a CLI, not a runtime component |
mcp-diet is complementary to these tools. Use them to optimize, use mcp-diet to understand and manage.
License
MIT
