MCPDiet Documentation
1. Quickstart (Free CLI)
Run MCPDiet directly via npx without modifying any files:
# Auto-discover Claude Code, Cursor, VS Code, Windsurf, and Claude Desktop
npx mcpdiet audit
# Audit a specific file with custom daily tool-turn volume
npx mcpdiet audit ./mcp.json --calls-per-day 200
# Live-probe stdio or HTTP MCP servers via tools/list for exact schema size
npx mcpdiet audit ./mcp.json --live
# Emit JSON for scripts
npx mcpdiet audit --json
2. Activating MCPDiet Pro
After purchasing a lifetime license via Creem.io ($15) or Afdian (¥79), activate your key once per machine (up to 3 machines):
npx mcpdiet activate YOUR-LICENSE-KEY
npx mcpdiet status
Your local license state and 30-day signed offline grace token are stored at ~/.mcpdiet/license.json.
3. Canonical mcp.profiles.yaml Schema (Pro)
Generate a starter file automatically from your existing IDE configs (hardcoded secrets are automatically converted into ${env:VAR} references):
npx mcpdiet init
version: 1
active: minimal
targets:
- claude-code
- cursor
- vscode
- windsurf
- claude-desktop
servers:
filesystem:
command: npx
args: ["-y", "@modelcontextprotocol/[email protected]", "."]
postgres:
command: npx
args: ["-y", "@modelcontextprotocol/[email protected]", "${env:DATABASE_URL}"]
github:
command: npx
args: ["-y", "@modelcontextprotocol/[email protected]"]
env:
GITHUB_PERSONAL_ACCESS_TOKEN: "${env:GITHUB_TOKEN}"
profiles:
minimal:
description: "Lean everyday coding (~4.6k tokens)"
servers: [filesystem]
coding:
description: "Code + Database + GitHub (~21.8k tokens)"
servers: [filesystem, postgres, github]
4. Switching Profiles, Syncing & Restoring (Pro)
# Switch active profile and sync immediately to all configured IDEs
npx mcpdiet use minimal --sync
# Sync to specific IDE targets only (creates atomic timestamped backup first)
npx mcpdiet sync --ide cursor,vscode,claude-code
# Preview changes without writing to disk
npx mcpdiet sync --dry-run
# List or restore prior atomic backups
npx mcpdiet restore --list
npx mcpdiet restore
Secret-Safe Guarantee: mcpdiet sync validates that referenced ${env:VAR} values exist in .env.local or your environment while keeping placeholders intact on disk. It refuses to write raw plaintext API keys into mcp.json.
5. Security Rules & GitHub Actions SARIF Gate (Pro)
- MCP001 (Critical) — Hardcoded plaintext secrets (Anthropic, OpenAI, GitHub, Slack, Google, AWS, Stripe, Bearer tokens, DB URIs with passwords).
- MCP002 (High/Medium) — Unpinned
npx -y pkg@latest, unpinneduvx/dockertags, or cleartext remotehttp://endpoints. - MCP003 (Medium/Low) — Duplicate or conflicting MCP server definitions drifted across IDEs.
- MCP004 (Critical/High) — Invisible Unicode Tag smuggling (
U+E0000–U+E007F), Trojan Source BiDi overrides, zero-width chars, and prompt-injection tool poisoning. - MCP005 (High/Medium/Low) — Context token bloat alerts (>10k per server, >20k or >45k workspace total).
# Export valid SARIF 2.1.0 and fail CI if any high or critical finding is present
npx mcpdiet scan --sarif mcpdiet.sarif --fail-on high
6. VS Code & Cursor Extension
Install MCPDiet from the VS Code / Open VSX Marketplace to display your active profile and live token overhead right in the status bar. Open Command Palette (Ctrl/Cmd+Shift+P) for:
MCPDiet: Audit Workspace MCPMCPDiet: Switch ProfileMCPDiet: Activate Pro License