Skip to main content
Glama

Tests Zero Dependencies Node.js >= 22.5 License MIT

Lazy MCP meta-proxy, response trimmer with spillover cache, and token-tax auditor.

Works with Claude Code, Cursor, Windsurf, Codex CLI, and Antigravity.

Every MCP server you enable dumps its full tool schemas into the prompt before turn one. Connect three or four servers (GitHub, Postgres, browser automation, Sentry) and an agent starts the session with 10,000 to 35,000 tokens already spent on JSON parameter definitions it may never call. Then one list_issues or SQL dump adds another 10,000 tokens of raw JSON.

mcp-diet sits in front of your existing stdio MCP servers and exposes four small tools costing 516 tokens total: search_tools, describe_tool, call_tool, and read_cached_output. Upstream servers stay stopped until an agent actually calls one of their tools, and oversized outputs are trimmed into a local LRU spillover cache that supports JSON dot/bracket path reads.

Measured benchmark

Reproduce these numbers on your machine with node ./bin/mcp-diet.mjs benchmark --markdown (3 mock stdio servers exposing 60 realistic tools, estimated at bytes / 3.8 chars per token):

Server

Tools

Startup Tokens

Status

github

20

3,824 tok

ok

browser

20

3,083 tok

ok

postgres

20

3,015 tok

ok

Direct total (3 servers)

60

9,922 tok

zero-turn context cost

With mcp-diet

4

516 tok

-94.8% saved

Measurement

Before

After mcp-diet

Reduction

Startup schemas (60 tools across 3 MCPs)

9,922 tok

516 tok

-94.8%

Large tool output (github:list_issues_large (60 issues))

9,576 tok

609 tok

-93.6%

Related MCP server: veriloop

Quick start

Requires Node.js >= 22.5.0 with zero npm packages to install.

1. Audit your current MCP token tax

mcp-diet audit discovers MCP configs from mcp-diet.json, .mcp.json, .cursor/mcp.json, Antigravity, Codex, and Claude Desktop, then measures the schema cost of every server:

npx -y github:keenfolk1-lgtm/mcp-diet audit

2. Wrap your config

Generate a standalone mcp-diet.json backend file and a wrapped editor config pointing to mcp-diet:

npx -y github:keenfolk1-lgtm/mcp-diet wrap --from ./.mcp.json --write

Or run mcp-diet directly in any client (claude mcp add mcp-diet -- npx -y github:keenfolk1-lgtm/mcp-diet serve --config ./mcp-diet.json) or with mcp.json:

{
  "mcpServers": {
    "mcp-diet": {
      "command": "npx",
      "args": ["-y", "github:keenfolk1-lgtm/mcp-diet", "serve", "--config", "./mcp-diet.json"]
    }
  }
}

3. Verify the local setup

node ./bin/mcp-diet.mjs doctor

Proxy tools

Tool

Purpose

search_tools

BM25 search across upstream tool names, descriptions, and argument keys.

describe_tool

Returns the full inputSchema for a single server:tool id on demand.

call_tool

Spawns the target upstream server lazily, executes the call, and trims large payloads.

read_cached_output

Reads a specific JSON path (such as items[12].title) or text slice from the spillover cache.

Protocol and config details

mcp-diet supports both newline-delimited JSON-RPC and Content-Length framed stdio servers, expanding ${ENV_VAR} placeholders in configured server env blocks at spawn time. Responses above trimThresholdChars (default 6000 characters) are stored in an in-memory 50-slot LRU cache and summarized in place (JSON arrays collapse to total count, item keys, first 2 items, and last item). Pass raw: true to call_tool when you need an untrimmed response.

Limitations

mcp-diet manages stdio MCP servers (command + args) and skips remote SSE or Streamable HTTP server entries during config discovery. The spillover cache lives in process memory for the lifetime of the proxy session, so cacheId handles expire when the proxy restarts. Indexing upstream catalogs on the first search_tools call starts each enabled server once to fetch tools/list, then closes idle connections until call_tool invokes one.

License

MIT

Related tools: skill-guard · blast-radius-mcp · flight-recorder-mcp · agent-undo · dotagents

Available Tools

4 tools
call_toolB

Execute an upstream MCP tool lazily and trim oversized JSON or log payloads with an automatic spillover cacheId.

Inputs: tool (required), raw, arguments.

describe_toolA

Return the exact parameter schema for one upstream tool (pass 'server:tool' or a unique tool name) before calling it.

Inputs: tool (required).

read_cached_outputA

Inspect a trimmed upstream payload stored in the spillover cache by JSON dot/bracket path or character slice.

Inputs: cacheId (required), path, limit, offset.

search_toolsA

Search configured upstream MCP tools by keyword or capability without loading every full JSON schema into context.

Inputs: query (required), limit, server.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool occupies a distinct stage of the lazy-invocation workflow: discovery (search_tools), inspection (describe_tool), execution (call_tool), and post-execution inspection (read_cached_output). The descriptions make the handoff between stages explicit, so an agent can tell exactly which tool to reach for.

    Naming Consistency5/5

    All four names follow a clean snake_case verb_noun pattern (search_tools, describe_tool, call_tool, read_cached_output) with no convention mixing. The one two-word noun (cached_output) is still readable and unambiguous.

    Tool Count5/5

    Four tools is exactly the right scope for a context-saving proxy: one per workflow stage, with no redundancy or filler. Nothing here feels like it could be collapsed into another tool without losing clarity.

    Completeness4/5

    The search → describe → call → read-cache loop is closed and covers the core purpose of lazily invoking upstream tools. Minor gaps remain: no way to enumerate configured upstream servers or manage/clear the spillover cache (list or evict cacheIds), which agents may need when a cacheId is lost or the cache grows.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Exposes a verified tool registry (calculator, sandboxed file read, web fetch) over MCP stdio, enabling any MCP-capable client to reuse the same tools from the inspectable ReAct loop.
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Lets you run a lightweight stdio MCP server in front of an upstream MCP server, exposing only a configured subset of its tools with compact schemas while keeping the full catalog reachable via discover, describe, and call meta-tools.
      -