🫠 MCP tools eating your context window? Lazy-load them on demand across all AI agents with one command.
翻譯準備中
開發工具TypeScript · JavaScriptGitHub @PeterCha90自行安裝營運者未確認
試用過了嗎? 點一下就好,不需要登入。
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
安裝型專案無需部署網域也可驗證。個人儲存庫可透過 GitHub 登入驗證,組織儲存庫可使用上方的儲存庫驗證檔案。
正在載入完整 README。 以下為已儲存的摘錄。
███╗ ███╗ ██████╗██████╗ ██╗ █████╗ ███████╗██╗ ██╗ ████╗ ████║██╔════╝██╔══██╗ ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝ ██╔████╔██║██║ ██████╔╝█████╗██║ ███████║ ███╔╝ ╚████╔╝ ██║╚██╔╝██║██║ ██╔═══╝ ╚════╝██║ ██╔══██║ ███╔╝ ╚██╔╝ ██║ ╚═╝ ██║╚██████╗██║ ███████╗██║ ██║███████╗ ██║ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ Reduce MCP context window token usage by 90%+ with lazy loading. One command setup.檢視完整 README ↗
Reduce MCP context window token usage by 90%+ with lazy loading. One command setup.
82 tools exposed at startup
👇 Just 2 with mcp-lazy
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 add command 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.
init pre-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.
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:
add Doesnpx mcp-lazy add --<agent>, it:npx mcp-remote <url>~/.mcp-lazy/servers.json~/.mcp-lazy/servers.json at runtime — that's where all your server definitions live after setup.| Agent | Status |
|---|---|
| Cursor | ✓ Supported |
| Opencode | ✓ Supported |
| Antigravity | ✓ Supported |
| Codex | Native support (not needed) |
| Claude Code | Native support (not needed) |
npx mcp-lazy addRegister 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 agentsnpx mcp-lazy initPre-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.
~/.mcp-lazy/tool-cache.jsonadd so the first agent session starts instantly instead of waiting for discoverynpx mcp-lazy doctorDiagnose 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)
Some MCP servers are hosted at a URL and require OAuth (Notion, Slack, Linear, etc.). The add command automatically handles these by converting them to stdio commands using npx 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.
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.
~/.mcp-lazy/tool-cache.json. Subsequent launches load from cache and start in under a second.npx mcp-lazy init after setup to pre-build the cache and avoid the slow first start.Check that you have read/write permissions for the config directory. For example:
Cursor:
~/.cursor/mcp.jsonOpencode:~/.config/opencode/config.jsonAntigravity:~/.gemini/antigravity/mcp_config.json
Try running ls -la on the relevant path to verify permissions. If needed, fix with chmod 644 <path>.
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.
~/.cursor/mcp.json). Project-level MCP configs (e.g., .cursor/mcp.json in a project root) are not yet supported.MIT