# mcp-diet

CLI tool that analyzes MCP servers and shows how much of your AI agent's context window each tool consumes, then grades efficiency.

## Install

```bash
pip install mcp-diet
# or
uvx mcp-diet
```

## Usage

```bash
# Analyze a running MCP server via stdio
mcp-diet analyze -- npx @modelcontextprotocol/server-filesystem /tmp

# Analyze via SSE
mcp-diet analyze --sse http://localhost:3000/sse

# Auto-detect from Claude config (.mcp.json or ~/.claude/settings.json)
mcp-diet auto

# Output formats
mcp-diet analyze --format json -- npx @modelcontextprotocol/server-filesystem /tmp
mcp-diet analyze --format markdown -- npx @modelcontextprotocol/server-filesystem /tmp

# Optimization suggestions
mcp-diet suggest -- npx @modelcontextprotocol/server-filesystem /tmp
```

## What it shows

For each tool in the MCP server:

| Column | Description |
|--------|-------------|
| Tool name | The tool's registered name |
| Tokens | Estimated token count of the full tool definition |
| % of budget | Percentage of a configurable context budget (default: 200k) |
| Schema depth | Max nesting depth of the JSON schema |
| Desc length | Character count of the description |
| Grade | A-F rating based on token efficiency |

### Grading

| Grade | Tokens per tool |
|-------|----------------|
| A | < 200 |
| B | 200-500 |
| C | 500-1000 |
| D | 1000-2000 |
| F | > 2000 |
