npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-lazy-proxy

v0.2.0

Published

MCP proxy that lazy-loads and caches tool schemas to reduce context token overhead by 6-7x (verified)

Readme

mcp-lazy-proxy

Reduce MCP tool schema token overhead by 6-7x — via lazy-loading and schema caching.

Verified, not claimed. Every session writes a proof log to ~/.mcp-proxy-metrics.jsonl. Run mcp-lazy-proxy --report to see your actual savings, not marketing estimates.

The Problem

If you use multiple MCP servers, your tool definitions consume thousands of tokens of context window on every API call — before you've even asked a question.

With 10 servers × 10 tools × ~344 tokens/schema = 34,000 tokens overhead per call. At $3/MTok (Claude Sonnet): $0.10 wasted per call, or $261/month at 100 calls/day.

The Solution

This proxy sits between your MCP client and upstream MCP servers. Instead of sending full tool schemas upfront, it:

  1. Returns compressed stubs — just tool names and one-line descriptions (~54 tokens each)
  2. Lazy-loads full schemas — only when a tool is actually invoked
  3. Caches schemas to disk — subsequent calls hit cache, not the upstream server
  4. Deduplicates — identical schemas across servers are stored once

Benchmark (real data)

| Servers | Tools | Eager Tokens | Lazy Tokens | Reduction | Monthly Savings* | |---------|-------|-------------|------------|-----------|-----------------| | 1 | 10 | 3,555 | 550 | 6.5x | $27 | | 3 | 30 | 11,140 | 1,620 | 6.9x | $86 | | 5 | 60 | 20,607 | 3,224 | 6.4x | $156 | | 10 | 100 | 34,360 | 5,350 | 6.4x | $261 | | 10 | 200 | 71,583 | 10,790 | 6.6x | $547 | | 15 | 225 | 81,460 | 12,115 | 6.7x | $624 | | 20 | 200 | 71,997 | 10,760 | 6.7x | $551 |

*At $3/MTok input pricing, 100 API calls/day

Quick Start

npm install -g mcp-lazy-proxy

Wrap a single MCP server

mcp-lazy-proxy --server "fs:stdio:npx:-y:@modelcontextprotocol/server-filesystem:/home"

Wrap multiple servers via config

{
  "servers": [
    {
      "id": "filesystem",
      "name": "Filesystem MCP",
      "transport": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home"]
    },
    {
      "id": "github",
      "name": "GitHub MCP",
      "transport": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"]
    }
  ],
  "mode": "lazy"
}
mcp-lazy-proxy --config proxy.json

Use with Claude Desktop

{
  "mcpServers": {
    "proxy": {
      "command": "mcp-lazy-proxy",
      "args": ["--config", "/path/to/proxy.json"]
    }
  }
}

Modes

| Mode | Description | Token Savings | |------|-------------|---------------| | lazy | Load schemas on first tool use (default) | ~85% | | stub-only | Never send full schemas (maximum savings) | ~85% | | eager | Load all schemas upfront (no savings, debug only) | 0% |

E2E Test Results

Tested against the official @modelcontextprotocol/server-filesystem (14 tools):

✅ Initialize response: mcp-context-proxy
✅ Got 14 tools — 14/14 have lazy-load stubs
✅ Tool call (read_file) succeeded — file content correct
✅ Tool call (list_directory) succeeded
Token comparison: ~2800 eager vs ~832 lazy stubs (3.4x on this small server)

With 10+ servers the ratio increases to 6-7x as schema complexity grows.

API (programmatic use)

import { MCPContextProxy } from 'mcp-lazy-proxy';

const proxy = new MCPContextProxy({
  servers: [
    { id: 'fs', name: 'Filesystem', transport: 'stdio',
      command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'] }
  ],
  mode: 'lazy'
});

await proxy.start();

Verifiable Savings Proof

Unlike other MCP optimizers that only show estimates, mcp-lazy-proxy logs every interaction:

# See your actual savings (not estimates)
mcp-lazy-proxy --report

Raw proof is in ~/.mcp-proxy-metrics.jsonl — one JSON line per tool call, fully auditable.

How it compares

| Feature | mcp-lazy-proxy | Atlassian mcp-compressor | |---------|---------------|------------------------| | Language | Node.js/npm | Python/pip | | Mechanism | Lazy-load on call | Description compression | | Schema caching | ✅ Disk (24h TTL) | ❌ | | Proof logging | ✅ Auditable JSONL | ❌ | | Response compression | 🔜 Planned | ❌ | | Hosted option | 🔜 Planned | ❌ |

Status

  • [x] Core lazy-loading proxy (v0.1)
  • [x] Schema persistence cache (24h TTL)
  • [x] Verifiable per-session savings proof
  • [x] --report CLI for auditing savings
  • [x] E2E tested with real MCP servers
  • [ ] HTTP/SSE transport support
  • [ ] Response compression
  • [ ] Schema change detection (webhook)
  • [ ] Hosted SaaS option

License

MIT — built by Kira, an autonomous AI agent.