Lazy
MCP lazy loading proxy for AI agents - reduce context window token usage by 90%+
Ask AI about Lazy
Powered by Claude Β· Grounded in docs
I know everything about Lazy. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
ββββ ββββ ββββββββββββββ βββ ββββββ βββββββββββ βββ βββββ βββββββββββββββββββββ βββ ββββββββββββββββββββ ββββ ββββββββββββββ βββββββββββββββββ ββββββββ βββββ βββββββ ββββββββββββββ βββββββ βββββββββ ββββββββ βββββ βββββ βββ βββ ββββββββββββββ βββββββββββ βββββββββββ βββ βββ βββ ββββββββββ βββββββββββ βββββββββββ βββ
mcp-lazy π«
Reduce MCP context window token usage by 90%+ with lazy loading. One command setup.
- MCP servers load all tool definitions into the context window at startup β even before you use them. With 5-10 servers, this can consume 30-50% of your context window. mcp-lazy proxies all your MCP servers through a single lightweight proxy that loads tools on-demand.
82 tools exposed at startup

π Just 2 with mcp-lazy

Quick Start
Pick one for your agent:
npx mcp-lazy add --cursor # Cursor
npx mcp-lazy add --antigravity # Antigravity
npx mcp-lazy add --opencode # Opencode
npx mcp-lazy add --all # or all at once
Then pre-build the tool cache (recommended):
npx mcp-lazy init
-
The
addcommand reads your agent's existing MCP config, saves all server definitions to~/.mcp-lazy/servers.json, and replaces the agent config with only the mcp-lazy proxy entry. -
initpre-builds the tool cache so your first agent session starts instantly. Without it, the first session will be slightly slower while mcp-lazy discovers tools from all servers.Tip: Installed a new MCP server? Just re-run
npx mcp-lazy add --<agent>β no extra steps.
How It Works
Without mcp-lazy:
Agent β MCP Server A (50 tools) + Server B (30 tools) + Server C (20 tools)
= 100 tools loaded at startup (~67,000 tokens)
With mcp-lazy:
Agent β mcp-lazy proxy (2 tools only, ~350 tokens)
β on-demand
Server A / B / C (loaded only when needed)
URL servers (Notion, Slack, etc.) via mcp-remote bridge
The proxy exposes just 2 tools:
- mcp_search_tools β Search available tools by keyword
- mcp_execute_tool β Execute a tool (lazy-loads the server on first call)

What add Does
- When you run
npx mcp-lazy add --<agent>, it:
- Reads your agent's existing MCP server config
- Extracts all server definitions (stdio and URL-based)
- Converts URL servers (OAuth-requiring services like Notion, Slack) to stdio commands using
npx mcp-remote <url> - Saves everything to
~/.mcp-lazy/servers.json - Replaces the agent config with only the mcp-lazy proxy entry
- The proxy reads from
~/.mcp-lazy/servers.jsonat runtime β that's where all your server definitions live after setup.
Supported Agents
| Agent | Status |
|---|---|
| Cursor | β Supported |
| Opencode | β Supported |
| Antigravity | β Supported |
| Codex | Native support (not needed) |
| Claude Code | Native support (not needed) |
Commands
npx mcp-lazy add
-
Register the proxy with your agent:
npx mcp-lazy add --cursor # register with Cursor npx mcp-lazy add --antigravity # register with Antigravity npx mcp-lazy add --all # register with all agents
Options:
--cursor,--opencode,--antigravity,--codexβ target agent--allβ register with all agents
npx mcp-lazy init
Pre-build the tool cache by connecting to all registered servers:
$ npx mcp-lazy init
mcp-lazy init β building tool cache...
β github-mcp 15 tools 342ms
β postgres-mcp 12 tools 518ms
β slack-mcp connection timeout
β filesystem 8 tools 120ms
Cache saved: 35 tools from 3/4 servers in 1.2s
Ready! mcp-lazy serve will start instantly.
- Connects to every server in parallel and saves the tool index to
~/.mcp-lazy/tool-cache.json - Run this after
addso the first agent session starts instantly instead of waiting for discovery
npx mcp-lazy doctor
Diagnose your setup:
$ npx mcp-lazy doctor
β Node.js 18+ installed
β 7 MCP server(s) registered
- github, notion, slack, postgres, filesystem, memory, puppeteer
β Cursor: registered
Token savings: 67,300 β 350 (99.5% reduction)
URL & OAuth Support
-
Some MCP servers are hosted at a URL and require OAuth (Notion, Slack, Linear, etc.). The
addcommand automatically handles these by converting them to stdio commands usingnpx mcp-remote:URL server: https://mcp.notion.com/sse β converted automatically stdio: npx mcp-remote https://mcp.notion.com/sse -
This means all your servers β local stdio and remote OAuth-requiring URL servers β get proxied through mcp-lazy with no manual conversion needed.
How Search Works
When an agent calls mcp_search_tools("query database"), the proxy searches across all registered tools using weighted scoring:
| Match Type | Score |
|---|---|
| Exact tool name match | +1.0 |
| Partial tool name match | +0.8 |
| Description keyword match | +0.6 |
| Server description match | +0.4 |
Results are sorted by relevance and returned to the agent.
FAQ
Q: The first run is slow.
- On the very first launch, mcp-lazy connects to every registered MCP server to discover available tools and build the search index. This can take 10-30 seconds depending on the number of servers.
- After that, the tool index is cached at
~/.mcp-lazy/tool-cache.json. Subsequent launches load from cache and start in under a second. - The cache is automatically refreshed when your server configuration changes.
- Run
npx mcp-lazy initafter setup to pre-build the cache and avoid the slow first start.
Q: I'm getting "Error: Unexpected error" during setup.
-
Check that you have read/write permissions for the config directory. For example:
Cursor:
~/.cursor/mcp.json
Opencode:~/.config/opencode/config.json
Antigravity:~/.gemini/antigravity/mcp_config.json -
Try running
ls -laon the relevant path to verify permissions. If needed, fix withchmod 644 <path>.
Q: I installed a new MCP server after setting up mcp-lazy. How do I add it?
-
Simply add the new server to your agent's MCP config as usual, then re-run the add command:
npx mcp-lazy add --cursor # re-scans and picks up the new server -
mcp-lazy will detect the new server, add it to
~/.mcp-lazy/servers.json, and keep the proxy config intact.
Scope
- mcp-lazy currently supports global MCP configurations only (e.g.,
~/.cursor/mcp.json). Project-level MCP configs (e.g.,.cursor/mcp.jsonin a project root) are not yet supported.
Requirements
- Node.js 18+
- Existing MCP server configurations (global scope)
License
MIT
