mcp-lazy 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peter Cha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,187 @@
1
+ <pre>
2
+ ███╗ ███╗ ██████╗██████╗ ██╗ █████╗ ███████╗██╗ ██╗
3
+ ████╗ ████║██╔════╝██╔══██╗ ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝
4
+ ██╔████╔██║██║ ██████╔╝█████╗██║ ███████║ ███╔╝ ╚████╔╝
5
+ ██║╚██╔╝██║██║ ██╔═══╝ ╚════╝██║ ██╔══██║ ███╔╝ ╚██╔╝
6
+ ██║ ╚═╝ ██║╚██████╗██║ ███████╗██║ ██║███████╗ ██║
7
+ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝
8
+ </pre>
9
+
10
+ # mcp-lazy
11
+
12
+ [한국어](./docs/README.ko.md)
13
+
14
+ > Reduce MCP context window token usage by 90%+ with lazy loading. One command setup.
15
+
16
+ - 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.
17
+
18
+ <br>
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ npx mcp-lazy add --cursor
24
+ npx mcp-lazy add --codex
25
+ npx mcp-lazy add --antigravity
26
+ npx mcp-lazy add --all # or register all at once
27
+ ```
28
+
29
+ - That's it. 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.
30
+
31
+ > **Tip:** Installed a new MCP server? Just re-run `npx mcp-lazy add --<agent>` — no extra steps.
32
+
33
+ <br>
34
+
35
+ ## How It Works
36
+
37
+ ```
38
+ Without mcp-lazy:
39
+ Agent → MCP Server A (50 tools) + Server B (30 tools) + Server C (20 tools)
40
+ = 100 tools loaded at startup (~67,000 tokens)
41
+
42
+ With mcp-lazy:
43
+ Agent → mcp-lazy proxy (2 tools only, ~350 tokens)
44
+ ↓ on-demand
45
+ Server A / B / C (loaded only when needed)
46
+ URL servers (Notion, Slack, etc.) via mcp-remote bridge
47
+ ```
48
+
49
+ The proxy exposes just 2 tools:
50
+
51
+ - **mcp_search_tools** — Search available tools by keyword
52
+ - **mcp_execute_tool** — Execute a tool (lazy-loads the server on first call)
53
+
54
+ ![mcp-lazy Architecture](./architecture.png)
55
+
56
+ <br>
57
+
58
+ ## What `add` Does
59
+
60
+ - When you run `npx mcp-lazy add --<agent>`, it:
61
+
62
+ 1. Reads your agent's existing MCP server config
63
+ 2. Extracts all server definitions (stdio and URL-based)
64
+ 3. Converts URL servers (OAuth-requiring services like Notion, Slack) to stdio commands using `npx mcp-remote <url>`
65
+ 4. Saves everything to `~/.mcp-lazy/servers.json`
66
+ 5. Replaces the agent config with only the mcp-lazy proxy entry
67
+
68
+ - The proxy reads from `~/.mcp-lazy/servers.json` at runtime — that's where all your server definitions live after setup.
69
+
70
+ <br>
71
+
72
+ ## Supported Agents
73
+
74
+ | Agent | Status |
75
+ | ----------- | --------------------------- |
76
+ | Cursor | ✓ Supported |
77
+ | Opencode | ✓ Supported |
78
+ | Antigravity | ✓ Supported |
79
+ | Codex | ✓ Supported |
80
+ | Claude Code | Native support (not needed) |
81
+
82
+ <br>
83
+
84
+ ## Commands
85
+
86
+ ### `npx mcp-lazy add`
87
+
88
+ - Register the proxy with your agent:
89
+
90
+ ```bash
91
+ npx mcp-lazy add --cursor # register with Cursor
92
+ npx mcp-lazy add --antigravity # register with Antigravity
93
+ npx mcp-lazy add --all # register with all agents
94
+ ```
95
+
96
+ Options:
97
+
98
+ - `--cursor`, `--opencode`, `--antigravity`, `--codex` — target agent
99
+ - `--all` — register with all agents
100
+
101
+ <br>
102
+
103
+ ### `npx mcp-lazy doctor`
104
+
105
+ Diagnose your setup:
106
+
107
+ ```bash
108
+ $ npx mcp-lazy doctor
109
+
110
+ ✓ Node.js 18+ installed
111
+ ✓ 7 MCP server(s) registered
112
+ - github, notion, slack, postgres, filesystem, memory, puppeteer
113
+ ✓ Cursor: registered
114
+
115
+ Token savings: 67,300 → 350 (99.5% reduction)
116
+ ```
117
+
118
+ <br>
119
+
120
+ ## URL & OAuth Support
121
+
122
+ - 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`:
123
+
124
+ ```
125
+ URL server: https://mcp.notion.com/sse
126
+ ↓ converted automatically
127
+ stdio: npx mcp-remote https://mcp.notion.com/sse
128
+ ```
129
+
130
+ - This means all your servers — local stdio and remote OAuth-requiring URL servers — get proxied through mcp-lazy with no manual conversion needed.
131
+
132
+ <br>
133
+
134
+ ## How Search Works
135
+
136
+ When an agent calls `mcp_search_tools("query database")`, the proxy searches across all registered tools using weighted scoring:
137
+
138
+ | Match Type | Score |
139
+ | ------------------------- | ----- |
140
+ | Exact tool name match | +1.0 |
141
+ | Partial tool name match | +0.8 |
142
+ | Description keyword match | +0.6 |
143
+ | Server description match | +0.4 |
144
+
145
+ Results are sorted by relevance and returned to the agent.
146
+
147
+ <br>
148
+
149
+ ## FAQ
150
+
151
+ ### Q: I'm getting "Error: Unexpected error" during setup.
152
+
153
+ - Check that you have read/write permissions for the config directory. For example:
154
+
155
+ > Cursor: `~/.cursor/mcp.json` <br>
156
+ > Codex: `~/.codex/config.toml` <br>
157
+ > Opencode: `~/.config/opencode/config.json` <br>
158
+ > Antigravity: `~/.gemini/antigravity/mcp_config.json`
159
+
160
+ - Try running `ls -la` on the relevant path to verify permissions. If needed, fix with `chmod 644 <path>`.
161
+
162
+ ### Q: I installed a new MCP server after setting up mcp-lazy. How do I add it?
163
+
164
+ - Simply add the new server to your agent's MCP config as usual, then re-run the add command:
165
+
166
+ ```bash
167
+ npx mcp-lazy add --cursor # re-scans and picks up the new server
168
+ ```
169
+
170
+ - mcp-lazy will detect the new server, add it to `~/.mcp-lazy/servers.json`, and keep the proxy config intact.
171
+
172
+ <br>
173
+
174
+ ## Scope
175
+
176
+ - mcp-lazy currently supports **global MCP configurations only** (e.g., `~/.cursor/mcp.json`). Project-level MCP configs (e.g., `.cursor/mcp.json` in a project root) are not yet supported.
177
+
178
+ <br>
179
+
180
+ ## Requirements
181
+
182
+ - Node.js 18+
183
+ - Existing MCP server configurations (global scope)
184
+
185
+ ## License
186
+
187
+ MIT
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node