Skip to main content
Glama

mcp-diet (@framy2/mcp-diet)

Zero-dependency stdio MCP proxy & runtime context firewall for Claude Code, OpenAI Codex CLI, and Cursor.

Wrap any stdio MCP server in .mcp.json, ~/.claude.json, or .codex/config.toml to tree-shake bloated tools/list schemas, prevent oversized tools/call stdio crashes (anthropics/claude-code#105703), and redact leaked secrets before they enter the model's context window.

Companion runtime proxy to FramY2/ctxwise (@framy2/ctxwise).


⚑ Why mcp-diet?

  1. Deterministic tools/list Tree-Shaking (--allow, --deny, --read-only, --max-desc):

    • Filters tools/list responses before the agent sees them and deterministically sorts tools by name so prompt prefix caching never invalidates.

    • --read-only keeps only tools with annotations.readOnlyHint === true or safe read-only names (get_*, list_*, read_*, search_*).

    • --max-desc <chars> compacts verbose tool and parameter descriptions without mutating JSON schema types.

  2. Oversized tools/call Crash & Context-Blowout Guard (--max-result-kb 512):

    • Prevents Claude Code's >= 8 MiB stdio buffer disconnect crash (anthropics/claude-code#105703) and 100k-token single-turn blowouts by spilling oversized tools/call outputs to a local file and returning a structured preview + file path.

  3. Live tools/call Secret Redaction (--redact-secrets):

    • Masks leaked credentials (sk-ant-*, sk-proj-*, ghp_*, AKIA*, ://user:pass@, AccountKey=..., Bearer ..., private keys) in tool call responses before they enter your LLM transcript.


Related MCP server: safe-mcp-bridge-v2

πŸš€ Quickstart (Drop-In .mcp.json Wrapper)

Replace your MCP server command in .mcp.json or ~/.claude.json:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@framy2/mcp-diet",
        "--read-only",
        "--max-desc",
        "160",
        "--max-result-kb",
        "512",
        "--redact-secrets",
        "--",
        "npx",
        "-y",
        "@modelcontextprotocol/server-github"
      ]
    }
  }
}

πŸ› οΈ CLI Options

Usage:
  mcp-diet [options] -- <server-command> [server-args...]
  mcp-diet [options] --self-test-server

Options:
  --allow <t1,t2>         Allow only matching tool names or wildcard patterns (e.g. get_*,list_*)
  --deny <t1,t2>          Remove matching tool names or wildcard patterns (e.g. delete_*,drop_*)
  --read-only             Keep only read-only tools (annotations.readOnlyHint or read-only heuristic)
  --max-desc <chars>      Deterministically truncate tool and property descriptions
  --max-result-kb <kb>    Spill oversized tools/call results to a temp file (default: 512)
  --redact-secrets        Redact leaked API keys, PATs, and credentials in tools/call output
  --spill-dir <dir>       Custom directory for spilled oversized tool outputs
  --self-test-server      Run standalone diagnostic MCP server over stdio (for introspection/Glama)
  -v, --version           Print version
  -h, --help              Print help

πŸ“¦ Programmatic API

import {
  filterToolsList,
  guardToolCallResult,
  redactSecretsInText,
  startStandaloneMcpServer,
  startStdioMcpProxy,
} from "@framy2/mcp-diet";

🧩 Companion Tools / Ecosystem

  • FramY2/ctxwise (@framy2/ctxwise): Local-first AI Context Firewall, MCP Schema Tree-Shaker (mcp-xray, mcp-prune), multi-agent rule sync (CLAUDE.md ↔ AGENTS.md ↔ Cursor), Codex 32 KiB doctor, and SARIF 2.1.0 Secret Shield.

  • FramY2/agent-wire-tap (@framy2/agent-wire-tap): Zero-cost local loopback HTTP interceptor & CI context contract tester for codex and claude β€” verifies outbound system prompt markers, tool counts, and byte budgets with $0.00 API cost.

  • Interactive Context & MCP Token Tax Calculator: 100% client-side web calculator for MCP schema token tax, 50-turn session costs, and secret scanning.


License

MIT Β© Christian Frascogna (@FramY2)

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A task-scoped MCP stdio proxy that learns candidate least-privilege policies from labeled successful runs, requires human review, enforces exact decisions, detects tool-definition drift, and emits privacy-minimized JSONL events for Wazuh.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      A fail-closed policy boundary that translates local stdio MCP clients to authenticated Streamable HTTP servers, enforcing allowlists or read-only modes and redacting credentials from audit trails.
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A local-first stdio proxy for MCP servers that traps destructive tool calls and holds them for manual commit or discard, preventing accidental mutations.
      AGPL 3.0
    • A
      license
      A
      quality
      A
      maintenance
      Dependency-free, locally sandboxed MCP stdio server. Tools run as WASM inside a capability-based WASI sandbox (wasmtime); every tools/call is attested with cost/policy and signed manifests fail-closed.
      3
      67 PyPI
      48
      Business Source 1.1