mcp-compression-proxy 1.0.2 β 1.1.0
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/CHANGELOG.md +22 -0
- package/README.md +227 -659
- package/dist/cli/commands.d.ts +18 -0
- package/dist/cli/commands.js +152 -13
- package/dist/cli/daemon.js +133 -49
- package/dist/cli/index.js +147 -7
- package/dist/cli/payload-interceptor.d.ts +71 -2
- package/dist/cli/payload-interceptor.js +214 -36
- package/dist/cli/runtime-mode.d.ts +3 -0
- package/dist/cli/runtime-mode.js +12 -0
- package/dist/cli/runtime-paths.d.ts +15 -0
- package/dist/cli/runtime-paths.js +26 -0
- package/dist/config/loader.d.ts +4 -0
- package/dist/config/loader.js +92 -1
- package/dist/config/schema.d.ts +90 -1
- package/dist/config/schema.js +95 -13
- package/dist/index.js +319 -28
- package/dist/mcp/call-script.d.ts +33 -0
- package/dist/mcp/call-script.js +153 -0
- package/dist/mcp/client-manager.d.ts +110 -27
- package/dist/mcp/client-manager.js +706 -83
- package/dist/mcp/tool-call-executor.d.ts +11 -0
- package/dist/mcp/tool-call-executor.js +94 -0
- package/dist/services/compression-cache.d.ts +18 -0
- package/dist/services/compression-cache.js +32 -0
- package/dist/services/session-manager.js +5 -0
- package/dist/services/stats-service.d.ts +4 -0
- package/dist/services/stats-service.js +18 -39
- package/dist/types/index.d.ts +59 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -2,841 +2,409 @@
|
|
|
2
2
|
|
|
3
3
|
# ποΈ MCP Compression Proxy
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### More MCP tools. Less context overhead.
|
|
6
|
+
|
|
7
|
+
Use a large MCP toolset without loading every tool into every prompt. MCP Compression Proxy is a local, open-source gateway with progressive discovery for shell-capable agents and one compatible endpoint for native MCP clients.
|
|
6
8
|
|
|
7
9
|
[![npm version][npm-version-badge]][npm-package]
|
|
8
10
|
[![npm downloads][npm-downloads-badge]][npm-package]
|
|
9
|
-
[![
|
|
10
|
-
[![License: MIT][license-badge]][license]
|
|
11
|
-
[![Node][node-badge]][nodejs]
|
|
12
|
-
[![MCP][mcp-badge]][mcp-protocol]
|
|
13
|
-
|
|
11
|
+
[![Node.js 22+][node-badge]][nodejs]
|
|
14
12
|
[![CI][ci-badge]][ci-workflow]
|
|
15
13
|
[![codecov][codecov-badge]][codecov]
|
|
16
|
-
[![
|
|
14
|
+
[![License: MIT][license-badge]][license-file]
|
|
17
15
|
|
|
18
|
-
[
|
|
19
|
-
[![GitHub Forks][forks-badge]][network]
|
|
20
|
-
[![GitHub Issues][issues-badge]][repo-issues]
|
|
21
|
-
[![GitHub Last Commit][commit-badge]][commits]
|
|
22
|
-
[![PRs Welcome][prs-badge]][contributing]
|
|
23
|
-
|
|
24
|
-
[Quick Start](#-quick-start) β’
|
|
25
|
-
[Features](#-features) β’
|
|
26
|
-
[mcp-cli](#οΈ-mcp-cli-progressive-tool-discovery) β’
|
|
27
|
-
[Configuration](#-configuration) β’
|
|
28
|
-
[FAQ](#-faq) β’
|
|
29
|
-
[Contributing](#-contributing)
|
|
16
|
+
[π Quick start](#-quick-start-progressive-discovery) Β· [π§ Choose a mode](#-choose-a-mode) Β· [π§ Configuration](#-configuration) Β· [π Support](#-support-the-project)
|
|
30
17
|
|
|
31
18
|
</div>
|
|
32
19
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## π Table of Contents
|
|
36
|
-
|
|
37
|
-
- [What is MCP Compression Proxy?](#what-is-mcp-compression-proxy)
|
|
38
|
-
- [β¨ Features](#-features)
|
|
39
|
-
- [π Quick Start](#-quick-start)
|
|
40
|
-
- [π― Usage](#-usage)
|
|
41
|
-
- [β¨οΈ mcp-cli (Progressive Tool Discovery)](#οΈ-mcp-cli-progressive-tool-discovery)
|
|
42
|
-
- [π§ Configuration](#-configuration)
|
|
43
|
-
- [π‘ Best Practices](#-best-practices)
|
|
44
|
-
- [β FAQ](#-faq)
|
|
45
|
-
- [π§ͺ Testing](#-testing)
|
|
46
|
-
- [π€ Contributing](#-contributing)
|
|
47
|
-
- [π Support This Project](#-support-this-project)
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## What is MCP Compression Proxy?
|
|
52
|
-
|
|
53
|
-
A **Model Context Protocol (MCP) server** that solves two common problems:
|
|
20
|
+
MCP Compression Proxy combines local stdio and remote Streamable HTTP servers behind one configuration. Agents can search for a tool, inspect its schema only when needed, and keep oversized results out of the conversation.
|
|
54
21
|
|
|
55
|
-
|
|
56
|
-
|
|
22
|
+
- π **Discover tools on demand** with `mcp-cli`.
|
|
23
|
+
- π **Connect through one MCP endpoint** when native MCP compatibility is required.
|
|
24
|
+
- π¦ **Keep large results local** and read only the relevant portions.
|
|
25
|
+
- β»οΈ **Reuse warm backends** and refresh stale or unhealthy connections.
|
|
26
|
+
- π **Keep control local** without a hosted gateway or control plane.
|
|
57
27
|
|
|
58
|
-
|
|
28
|
+
> [!IMPORTANT]
|
|
29
|
+
> `mcp-cli` provides the largest context reduction because it defers full tool schemas until an agent requests one. Native proxy mode shortens tool descriptions, but MCP clients still receive each tool's input schema during discovery.
|
|
59
30
|
|
|
60
|
-
|
|
61
|
-
- Users with many MCP servers (filesystem, GitHub, databases, etc.)
|
|
62
|
-
- AI agents working with limited context windows
|
|
63
|
-
- Anyone wanting to minimize token costs while maximizing tool availability
|
|
31
|
+
## π§ Choose a mode
|
|
64
32
|
|
|
65
|
-
|
|
33
|
+
| Your client | Start with | Context behavior |
|
|
34
|
+
| ----------------------------- | --------------------------- | --------------------------------------------------------------------------------- |
|
|
35
|
+
| β¨οΈ Shell-capable coding agent | **`mcp-cli` (recommended)** | Search compact summaries, inspect one schema, then call the tool |
|
|
36
|
+
| π Native MCP client | **`mcp-compression-proxy`** | Connect through one endpoint and use shorter descriptions; schemas remain exposed |
|
|
66
37
|
|
|
67
|
-
|
|
68
|
-
- **π€ LLM-Based Compression** - Intelligent description compression (50-80% token reduction)
|
|
69
|
-
- **πΎ Persistent Storage** - Compressed descriptions saved to disk and restored on restart
|
|
70
|
-
- **π Session-Based Expansion** - Independent expansion state per conversation
|
|
71
|
-
- **β‘ Parallel Initialization** - All servers connect in parallel with configurable timeouts
|
|
72
|
-
- **π― Selective Expansion** - Compress all tools, expand only what you need
|
|
73
|
-
- **π¦ Zero Config** - Works out-of-the-box with sensible defaults
|
|
74
|
-
- **π₯ Standard MCP** - Compatible with any MCP client (Claude Desktop, Cline, etc.)
|
|
38
|
+
Both modes use the same server configuration and support local stdio and remote Streamable HTTP backends.
|
|
75
39
|
|
|
76
|
-
## π Quick
|
|
40
|
+
## π Quick start: progressive discovery
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- **Node.js 22+** installed on your system
|
|
81
|
-
- An **MCP-compatible client** (Claude Desktop, Cline, Continue.dev, etc.)
|
|
42
|
+
Requires Node.js 22 or newer.
|
|
82
43
|
|
|
83
44
|
### 1. Install
|
|
84
45
|
|
|
85
|
-
**Option A: Install from npm** (recommended for most users):
|
|
86
46
|
```bash
|
|
87
47
|
npm install -g mcp-compression-proxy
|
|
88
48
|
```
|
|
89
49
|
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
git clone https://github.com/kdpa-llc/mcp-compression-proxy.git
|
|
93
|
-
cd mcp-compression-proxy
|
|
94
|
-
npm install
|
|
95
|
-
npm run build
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 2. Configure MCP Client
|
|
99
|
-
|
|
100
|
-
Add to your MCP client configuration file:
|
|
50
|
+
The package installs two commands: `mcp-cli` for progressive discovery and `mcp-compression-proxy` for native MCP clients.
|
|
101
51
|
|
|
102
|
-
|
|
103
|
-
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
52
|
+
### 2. Add one MCP server
|
|
104
53
|
|
|
105
|
-
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"mcpServers": {
|
|
109
|
-
"compression-proxy": {
|
|
110
|
-
"command": "mcp-compression-proxy",
|
|
111
|
-
"env": {
|
|
112
|
-
"LOG_LEVEL": "info"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
```
|
|
54
|
+
This macOS/Linux example gives the filesystem server access to `/tmp`:
|
|
118
55
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"mcpServers": {
|
|
123
|
-
"compression-proxy": {
|
|
124
|
-
"command": "node",
|
|
125
|
-
"args": [
|
|
126
|
-
"/absolute/path/to/mcp-compression-proxy/dist/index.js"
|
|
127
|
-
],
|
|
128
|
-
"env": {
|
|
129
|
-
"LOG_LEVEL": "info"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### 3. Configure Servers
|
|
137
|
-
|
|
138
|
-
Create a JSON configuration file to define which MCP servers to aggregate:
|
|
139
|
-
|
|
140
|
-
**Option 1: User-level config** (recommended for personal use)
|
|
141
|
-
- Location: `~/.mcp-compression-proxy/servers.json`
|
|
142
|
-
|
|
143
|
-
**Option 2: Project-level config** (recommended for team projects)
|
|
144
|
-
- Location: `./servers.json` (in the mcp-compression-proxy directory)
|
|
145
|
-
|
|
146
|
-
**Example configuration:**
|
|
147
|
-
|
|
148
|
-
```json
|
|
56
|
+
```bash
|
|
57
|
+
mkdir -p "$HOME/.mcp-compression-proxy"
|
|
58
|
+
cat > "$HOME/.mcp-compression-proxy/servers.json" <<'JSON'
|
|
149
59
|
{
|
|
150
60
|
"mcpServers": [
|
|
151
61
|
{
|
|
152
62
|
"name": "filesystem",
|
|
153
63
|
"command": "npx",
|
|
154
|
-
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
|
155
|
-
"enabled": true
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"name": "github",
|
|
159
|
-
"command": "npx",
|
|
160
|
-
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
161
|
-
"env": {
|
|
162
|
-
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
|
|
163
|
-
},
|
|
164
|
-
"enabled": true
|
|
64
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
|
165
65
|
}
|
|
166
66
|
]
|
|
167
67
|
}
|
|
68
|
+
JSON
|
|
168
69
|
```
|
|
169
70
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
### 4. Restart Your MCP Client
|
|
173
|
-
|
|
174
|
-
Restart your MCP client (e.g., Claude Desktop) to load the new configuration. The proxy will automatically connect to all configured MCP servers and make their tools available.
|
|
175
|
-
|
|
176
|
-
## π― Usage
|
|
177
|
-
|
|
178
|
-
### Tool Naming
|
|
179
|
-
|
|
180
|
-
**Proxied tools** from your configured MCP servers use the format `serverName__toolName`:
|
|
181
|
-
- `filesystem__read_file`
|
|
182
|
-
- `filesystem__write_file`
|
|
183
|
-
- `github__create_issue`
|
|
184
|
-
|
|
185
|
-
**Management tools** (built-in) don't have a prefix and are listed below.
|
|
186
|
-
|
|
187
|
-
### Management Tools
|
|
188
|
-
|
|
189
|
-
| Tool | Description |
|
|
190
|
-
|------|-------------|
|
|
191
|
-
| `create_session` | Create a new session for independent tool expansion |
|
|
192
|
-
| `set_session` | Set the active session |
|
|
193
|
-
| `delete_session` | Delete a session |
|
|
194
|
-
| `clear_compressed_tools_cache` | Clear all cached compressed tool descriptions |
|
|
195
|
-
| `get_uncompressed_tools` | Get tools that need compression (batch processing) |
|
|
196
|
-
| `cache_compressed_tools` | Save compressed descriptions to cache (batch processing) |
|
|
197
|
-
| `compress_via_sampling` | Compress automatically using the client's own LLM (requires sampling support) |
|
|
198
|
-
| `expand_tool` | Expand a tool to show full description (session-specific) |
|
|
199
|
-
| `collapse_tool` | Collapse tool back to compressed description |
|
|
200
|
-
| `stats` | Return JSON summary of coverage, cache health, sessions, and per-server tool counts |
|
|
201
|
-
|
|
202
|
-
Use `stats` from your client (e.g., `mcp-compression-proxy__stats`) to sanity-check coverage. Optional inputs: `serverName` to scope to one backend and `detailLevel` (`summary` or `full`, default `summary`). The response includes coverage %, estimated token savings, cache state, active sessions, and per-server tool counts (respecting your exclude patterns).
|
|
71
|
+
### 3. Find and call a tool
|
|
203
72
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
mcp-compression-proxy__compress_via_sampling
|
|
73
|
+
```bash
|
|
74
|
+
mcp-cli doctor
|
|
75
|
+
mcp-cli search file
|
|
76
|
+
mcp-cli info filesystem/list_directory
|
|
77
|
+
mcp-cli call filesystem/list_directory '{"path":"/tmp"}'
|
|
212
78
|
```
|
|
213
79
|
|
|
214
|
-
|
|
215
|
-
results, and reports before/after coverage. Call it again for the next batch
|
|
216
|
-
until nothing remains. Batches are sent one at a time, since a host may ask
|
|
217
|
-
you to approve each request.
|
|
218
|
-
|
|
219
|
-
Support varies by client β Cursor implements sampling; Claude Desktop and
|
|
220
|
-
Cline did not at the time of writing. On a client without it the tool returns
|
|
221
|
-
an error pointing at the manual `get_uncompressed_tools` β
|
|
222
|
-
`cache_compressed_tools` flow, which works everywhere.
|
|
80
|
+
The daemon starts automatically on the first command and keeps backend connections warm. `doctor` validates the configuration and reports backend health.
|
|
223
81
|
|
|
224
|
-
###
|
|
82
|
+
### 4. Tell your agent how to use it
|
|
225
83
|
|
|
226
|
-
|
|
84
|
+
Add this to your project instructions or `AGENTS.md`:
|
|
227
85
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
AI: I have access to these tools:
|
|
234
|
-
- filesystem__read_file: Reads the complete contents of a file at the
|
|
235
|
-
specified path. The file must exist and be readable. Returns the file
|
|
236
|
-
contents as text. Supports absolute and relative paths. Maximum file
|
|
237
|
-
size is 10MB. Will throw an error if the file doesn't exist...
|
|
238
|
-
[~200 tokens for one tool]
|
|
86
|
+
```text
|
|
87
|
+
Use mcp-cli to access MCP tools. Search before choosing a tool, inspect its
|
|
88
|
+
schema before the first call, and read large outputs with `mcp-cli output`
|
|
89
|
+
instead of loading an entire payload into the conversation.
|
|
239
90
|
```
|
|
240
91
|
|
|
241
|
-
|
|
92
|
+
That is the complete progressive-discovery setup. Add more servers to the same `servers.json` file as needed.
|
|
242
93
|
|
|
243
|
-
|
|
94
|
+
> π **You're ready.** Your agent can now discover the right tool, load one schema, and call it without carrying the entire catalog through the conversation.
|
|
244
95
|
|
|
245
|
-
|
|
246
|
-
User: Use the mcp-compression-proxy tools to compress tool descriptions and save model context
|
|
96
|
+
## π Native MCP client setup
|
|
247
97
|
|
|
248
|
-
|
|
249
|
-
1. Getting all tools via get_uncompressed_tools...
|
|
250
|
-
2. Compressing descriptions intelligently...
|
|
251
|
-
3. Saving compressed versions via cache_compressed_tools...
|
|
98
|
+
Use this mode when a client expects to launch an MCP server directly. Add the proxy to the client's MCP configuration:
|
|
252
99
|
|
|
253
|
-
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"compression-proxy": {
|
|
104
|
+
"command": "mcp-compression-proxy",
|
|
105
|
+
"env": {
|
|
106
|
+
"LOG_LEVEL": "info"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
254
111
|
```
|
|
255
112
|
|
|
256
|
-
|
|
113
|
+
Restart the client after saving its configuration. The proxy loads backend definitions from `~/.mcp-compression-proxy/servers.json` and exposes their tools as `serverName__toolName`, such as `filesystem__read_file`.
|
|
257
114
|
|
|
258
|
-
|
|
115
|
+
### Compress descriptions
|
|
259
116
|
|
|
260
|
-
|
|
261
|
-
User: What tools do you have?
|
|
117
|
+
If the client supports [MCP sampling][mcp-sampling], ask it to call:
|
|
262
118
|
|
|
263
|
-
|
|
264
|
-
-
|
|
265
|
-
- filesystem__write_file: Write/overwrite file
|
|
266
|
-
- github__create_issue: Create GitHub issue
|
|
267
|
-
[~30 tokens for one tool]
|
|
119
|
+
```text
|
|
120
|
+
mcp-compression-proxy__compress_via_sampling
|
|
268
121
|
```
|
|
269
122
|
|
|
270
|
-
|
|
123
|
+
The proxy asks the client's existing model to shorten a batch of descriptions and saves the results in `~/.mcp-compression-proxy/cache.json`. No separate model provider or API key is required. Sampling is deprecated in the 2026-07-28 MCP specification, so new clients may omit it.
|
|
271
124
|
|
|
272
|
-
|
|
125
|
+
If sampling is unavailable, use `mcp-compression-proxy__get_uncompressed_tools` and then `mcp-compression-proxy__cache_compressed_tools`. Updated backend descriptions are detected as stale and queued for compression again.
|
|
273
126
|
|
|
274
|
-
|
|
127
|
+
## π§ Where the context savings come from
|
|
275
128
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
129
|
+
| Access pattern | Loaded before the task | Loaded when a tool is selected |
|
|
130
|
+
| ---------------- | ---------------------------------------------------------- | ------------------------------------------ |
|
|
131
|
+
| Eager MCP client | Every advertised name, description, and input schema | Nothing additional |
|
|
132
|
+
| Native proxy | Names, shorter cached descriptions, and every input schema | Full description on request |
|
|
133
|
+
| Progressive CLI | A small command vocabulary and compact search results | The selected tool's description and schema |
|
|
280
134
|
|
|
281
|
-
|
|
282
|
-
node dist/index.js --clear-cache
|
|
283
|
-
```
|
|
135
|
+
Exact savings depend on the number of servers, their schema sizes, and which tools a task uses. The project intentionally does not claim a universal percentage: measure the complete tool definitions in your own stack rather than description text alone.
|
|
284
136
|
|
|
285
|
-
|
|
137
|
+
## β¨ What it handles
|
|
286
138
|
|
|
287
|
-
|
|
139
|
+
- **One configuration:** Aggregate any number of local stdio and remote Streamable HTTP servers.
|
|
140
|
+
- **Progressive discovery:** Search tools and fetch only the schema needed for the next call.
|
|
141
|
+
- **Large-output control:** Store results above a configurable threshold in private local files, then search or page through them.
|
|
142
|
+
- **Warm, replaceable connections:** Reuse backend processes while draining old generations without interrupting active calls.
|
|
143
|
+
- **Authentication recovery:** Reconnect after configured authentication failures and retry only tools explicitly marked safe.
|
|
144
|
+
- **Declarative call chains:** Run dependent MCP calls with JSON Pointer references and no arbitrary shell or JavaScript execution.
|
|
145
|
+
- **Operational visibility:** Inspect live server state, connection age, active calls, retries, failures, and compression coverage.
|
|
146
|
+
- **Tool policy:** Exclude tools entirely or preserve selected original descriptions with case-insensitive wildcard patterns.
|
|
288
147
|
|
|
289
|
-
|
|
290
|
-
would rather *shell out* than hold every tool definition in context. Instead
|
|
291
|
-
of loading all tools up front, the agent lists or searches for what it needs
|
|
292
|
-
and pulls the full schema only for the tool it is about to call.
|
|
148
|
+
## ποΈ How it works
|
|
293
149
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
mcp-cli call <server>/<tool> '<json>' # Execute a tool
|
|
302
|
-
mcp-cli stats # Compression statistics
|
|
303
|
-
|
|
304
|
-
mcp-cli daemon start # Start the background daemon
|
|
305
|
-
mcp-cli daemon status # Show daemon status
|
|
306
|
-
mcp-cli daemon stop # Stop the daemon
|
|
150
|
+
```mermaid
|
|
151
|
+
flowchart TD
|
|
152
|
+
A["Agent"] --> B{"Access mode"}
|
|
153
|
+
B --> C["mcp-cli"]
|
|
154
|
+
B --> D["Native MCP proxy"]
|
|
155
|
+
C --> E["Configured MCP servers"]
|
|
156
|
+
D --> E
|
|
307
157
|
```
|
|
308
158
|
|
|
309
|
-
|
|
310
|
-
fast instead when it is not already running.
|
|
159
|
+
`mcp-cli` uses a local daemon so repeated commands are short IPC round trips. Native clients launch the stdio proxy and see one namespaced MCP tool catalog.
|
|
311
160
|
|
|
312
|
-
|
|
313
|
-
problems with large payloads:
|
|
161
|
+
## β¨οΈ CLI reference
|
|
314
162
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
163
|
+
| Command | Purpose |
|
|
164
|
+
| ------------------------------------------------- | ------------------------------------------------- |
|
|
165
|
+
| `mcp-cli search <query>` | Search tool names and descriptions |
|
|
166
|
+
| `mcp-cli info <server>/<tool>` | Load the full schema for one tool |
|
|
167
|
+
| `mcp-cli call <server>/<tool> '<json>'` | Execute a tool |
|
|
168
|
+
| `mcp-cli tools` | List compact summaries for every available tool |
|
|
169
|
+
| `mcp-cli output find <id> <query>` | Search a cached large output |
|
|
170
|
+
| `mcp-cli output read <id> [offset] [length\|all]` | Read a bounded page or the remainder of an output |
|
|
171
|
+
| `mcp-cli script '<json>'` | Run a declarative sequence of calls |
|
|
172
|
+
| `mcp-cli stats` | Show server and compression statistics |
|
|
173
|
+
| `mcp-cli doctor` | Validate configuration and backend health |
|
|
174
|
+
| `mcp-cli daemon status` | Show daemon and connection lifecycle state |
|
|
175
|
+
| `mcp-cli daemon logs [-n N] [-f]` | Read or follow daemon logs |
|
|
176
|
+
| `mcp-cli daemon restart` | Restart the local daemon |
|
|
318
177
|
|
|
319
|
-
|
|
178
|
+
Pass call JSON on stdin when shell quoting becomes awkward:
|
|
320
179
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
```json
|
|
324
|
-
{
|
|
325
|
-
"cli": {
|
|
326
|
-
"payloadThreshold": 500,
|
|
327
|
-
"autoStartDaemon": true,
|
|
328
|
-
"daemonLogLevel": "info"
|
|
329
|
-
},
|
|
330
|
-
"mcpServers": []
|
|
331
|
-
}
|
|
180
|
+
```bash
|
|
181
|
+
echo '{"path":"/tmp/notes.md"}' | mcp-cli call filesystem/read_file
|
|
332
182
|
```
|
|
333
183
|
|
|
334
|
-
|
|
335
|
-
|-------|------|---------|-------------|
|
|
336
|
-
| `payloadThreshold` | number | `500` | Tool output longer than this many characters is written to a temp file and replaced with a reference, keeping large payloads out of the agent's context |
|
|
337
|
-
| `autoStartDaemon` | boolean | `true` | Start the daemon automatically when a command needs it |
|
|
338
|
-
| `daemonLogLevel` | string | `"info"` | Daemon log level (`debug`, `info`, `warn`, `error`) |
|
|
339
|
-
|
|
340
|
-
Daemon state lives in `~/.mcp-compression-proxy/` (socket, PID file, and
|
|
341
|
-
`daemon.log`), created with `0700` permissions since the control socket
|
|
342
|
-
accepts commands that execute downstream MCP tools.
|
|
343
|
-
|
|
344
|
-
## π§ Configuration
|
|
184
|
+
Pass `--no-auto-start` when a command should fail instead of starting the daemon.
|
|
345
185
|
|
|
346
|
-
###
|
|
186
|
+
### Large outputs
|
|
347
187
|
|
|
348
|
-
|
|
349
|
-
- `~/.mcp-compression-proxy/servers.json` (user-level), or
|
|
350
|
-
- `./servers.json` (project-level)
|
|
188
|
+
Tool results longer than 10,000 characters are stored under `~/.mcp-compression-proxy/payloads/` by default. The CLI returns a payload ID instead of flooding the agent's context:
|
|
351
189
|
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
"name": "my-server",
|
|
357
|
-
"command": "command-to-run",
|
|
358
|
-
"args": ["arg1", "arg2"],
|
|
359
|
-
"env": {
|
|
360
|
-
"ENV_VAR": "value"
|
|
361
|
-
},
|
|
362
|
-
"enabled": true
|
|
363
|
-
}
|
|
364
|
-
]
|
|
365
|
-
}
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
#### Configuration Schema
|
|
369
|
-
|
|
370
|
-
**Root Level:**
|
|
371
|
-
| Field | Type | Required | Description |
|
|
372
|
-
|-------|------|----------|-------------|
|
|
373
|
-
| `mcpServers` | array | β
| Array of server configurations |
|
|
374
|
-
| `excludeTools` | string[] | β | Tool name patterns to exclude from tool list entirely (supports wildcards) |
|
|
375
|
-
| `noCompressTools` | string[] | β | Tool name patterns to never compress - descriptions pass through unchanged (supports wildcards) |
|
|
376
|
-
| `defaultTimeout` | number | β | Default timeout in seconds for all servers (default: 30). Can be overridden per-server. |
|
|
377
|
-
| `inheritEnv` | boolean \| string[] | β | Which of the proxy's environment variables backend servers inherit (default: `true`). Can be overridden per-server. |
|
|
378
|
-
| `compressionFallbackBehavior` | `"original"` \| `"blank"` | β | What to show for a tool that has not been compressed yet (default: `"original"`) |
|
|
379
|
-
|
|
380
|
-
**Server Configuration:**
|
|
381
|
-
| Field | Type | Required | Description |
|
|
382
|
-
|-------|------|----------|-------------|
|
|
383
|
-
| `name` | string | β
| Unique server identifier |
|
|
384
|
-
| `command` | string | β
| Command to execute |
|
|
385
|
-
| `args` | string[] | β | Command arguments |
|
|
386
|
-
| `env` | object | β | Environment variables |
|
|
387
|
-
| `inheritEnv` | boolean \| string[] | β | Overrides the root-level `inheritEnv` for this server |
|
|
388
|
-
| `enabled` | boolean | β | Enable/disable server (default: true) |
|
|
389
|
-
| `timeout` | number | β | Server-specific timeout in seconds (overrides `defaultTimeout`) |
|
|
390
|
-
|
|
391
|
-
#### Environment Variable Expansion
|
|
392
|
-
|
|
393
|
-
Use `${VAR_NAME}` syntax to reference environment variables:
|
|
394
|
-
|
|
395
|
-
```json
|
|
396
|
-
{
|
|
397
|
-
"mcpServers": [
|
|
398
|
-
{
|
|
399
|
-
"name": "github",
|
|
400
|
-
"command": "npx",
|
|
401
|
-
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
402
|
-
"env": {
|
|
403
|
-
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}",
|
|
404
|
-
"GITHUB_ORG": "${MY_GITHUB_ORG}"
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
]
|
|
408
|
-
}
|
|
190
|
+
```bash
|
|
191
|
+
mcp-cli output find <payload-id> "needle"
|
|
192
|
+
mcp-cli output read <payload-id> 0 10000
|
|
193
|
+
mcp-cli output read <payload-id> 10000 all
|
|
409
194
|
```
|
|
410
195
|
|
|
411
|
-
|
|
196
|
+
The payload directory is mode `0700` and payload files are mode `0600`. Up to 100 entries are retained by the running process; the oldest are evicted first.
|
|
412
197
|
|
|
413
|
-
|
|
198
|
+
### Declarative call chains
|
|
414
199
|
|
|
415
|
-
|
|
416
|
-
|--------|---------|
|
|
417
|
-
| `${VAR}` | Substitutes `VAR`, or an empty string with a warning if it is not set |
|
|
418
|
-
| `${VAR:-fallback}` | Substitutes `VAR`, or `fallback` when unset or empty |
|
|
419
|
-
| `$${VAR}` | Escapes the expansion β produces the literal text `${VAR}` |
|
|
420
|
-
|
|
421
|
-
If a `${VAR}` reference cannot be resolved, the proxy logs a warning naming
|
|
422
|
-
the variable. An unset variable becomes an empty string, which downstream
|
|
423
|
-
servers usually report as an authentication failure rather than a config
|
|
424
|
-
error, so check the startup log first when a server rejects valid-looking
|
|
425
|
-
credentials.
|
|
426
|
-
|
|
427
|
-
#### What Backend Servers Inherit
|
|
428
|
-
|
|
429
|
-
Backend servers inherit the proxy's full environment by default, so variables
|
|
430
|
-
you exported in your shell are visible to them without being listed in `env`.
|
|
431
|
-
Entries in `env` always take precedence over inherited values.
|
|
432
|
-
|
|
433
|
-
Narrow this with `inheritEnv` when a server should not see unrelated secrets:
|
|
200
|
+
Scripts can run up to 20 sequential MCP calls. A later step may use a prior JSON value through an [RFC 6901 JSON Pointer](https://www.rfc-editor.org/rfc/rfc6901):
|
|
434
201
|
|
|
435
202
|
```json
|
|
436
203
|
{
|
|
437
|
-
"
|
|
438
|
-
"mcpServers": [
|
|
204
|
+
"steps": [
|
|
439
205
|
{
|
|
440
|
-
"
|
|
441
|
-
"
|
|
442
|
-
"
|
|
443
|
-
"
|
|
206
|
+
"id": "search",
|
|
207
|
+
"server": "docs",
|
|
208
|
+
"tool": "search",
|
|
209
|
+
"arguments": { "query": "progressive discovery" }
|
|
444
210
|
},
|
|
445
211
|
{
|
|
446
|
-
"
|
|
447
|
-
"
|
|
448
|
-
"
|
|
449
|
-
"
|
|
212
|
+
"id": "read",
|
|
213
|
+
"server": "docs",
|
|
214
|
+
"tool": "read",
|
|
215
|
+
"arguments": {
|
|
216
|
+
"url": { "$ref": "search#/results/0/url" }
|
|
217
|
+
}
|
|
450
218
|
}
|
|
451
219
|
]
|
|
452
220
|
}
|
|
453
221
|
```
|
|
454
222
|
|
|
455
|
-
|
|
456
|
-
|-------|--------|
|
|
457
|
-
| `true` (default) | Pass the proxy's full environment through |
|
|
458
|
-
| `false` | Pass only the stdio transport's safe defaults (`PATH`, `HOME`, `SHELL`, β¦) |
|
|
459
|
-
| `string[]` | Pass only the named variables, plus the transport's safe defaults |
|
|
460
|
-
|
|
461
|
-
#### Uncompressed Tool Descriptions
|
|
223
|
+
Scripts stop on the first failed step unless that step sets `continueOnError`. References substitute exact values; they do not transform data.
|
|
462
224
|
|
|
463
|
-
|
|
464
|
-
Set `compressionFallbackBehavior` to `"blank"` to show nothing instead, so
|
|
465
|
-
uncompressed tools cost no context while you work through them:
|
|
225
|
+
## π§ Configuration
|
|
466
226
|
|
|
467
|
-
|
|
468
|
-
{
|
|
469
|
-
"compressionFallbackBehavior": "blank",
|
|
470
|
-
"mcpServers": []
|
|
471
|
-
}
|
|
472
|
-
```
|
|
227
|
+
The proxy reads both of these files when present:
|
|
473
228
|
|
|
474
|
-
|
|
475
|
-
|
|
229
|
+
- `~/.mcp-compression-proxy/servers.json` for user-level servers and defaults.
|
|
230
|
+
- `./servers.json` for project-specific additions and overrides.
|
|
476
231
|
|
|
477
|
-
|
|
232
|
+
Servers and tool patterns from both files are combined. Project-level scalar settings override user-level settings. Configuration changes are watched and healthy backends remain connected when their definitions have not changed.
|
|
478
233
|
|
|
479
|
-
|
|
234
|
+
### Local and remote servers
|
|
480
235
|
|
|
481
|
-
|
|
482
|
-
- **Global timeout**: Set `defaultTimeout` in config to change the default for all servers
|
|
483
|
-
- **Per-server timeout**: Set `timeout` on individual servers to override the default
|
|
236
|
+
Each server must define exactly one transport: `command` for local stdio or `url` for Streamable HTTP.
|
|
484
237
|
|
|
485
238
|
```json
|
|
486
239
|
{
|
|
487
|
-
"defaultTimeout": 60,
|
|
488
240
|
"mcpServers": [
|
|
489
241
|
{
|
|
490
|
-
"name": "
|
|
242
|
+
"name": "filesystem",
|
|
491
243
|
"command": "npx",
|
|
492
|
-
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
|
244
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
|
|
245
|
+
"inheritEnv": false
|
|
493
246
|
},
|
|
494
247
|
{
|
|
495
|
-
"name": "
|
|
496
|
-
"
|
|
497
|
-
"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
**Behavior:**
|
|
505
|
-
- All servers initialize in parallel (not sequentially)
|
|
506
|
-
- If a server exceeds its timeout, it's marked as failed but doesn't block other servers
|
|
507
|
-
- The proxy reports ready only after all servers have either connected or timed out
|
|
508
|
-
- This ensures all available tools are loaded before the MCP client can query them
|
|
509
|
-
|
|
510
|
-
**Why this matters:** Without proper timeout handling, a single hanging server could make the entire proxy unresponsive.
|
|
511
|
-
|
|
512
|
-
#### Tool Filtering Patterns
|
|
513
|
-
|
|
514
|
-
**Exclude Tools** - Remove tools from the tool list entirely:
|
|
515
|
-
|
|
516
|
-
Use the `excludeTools` field to filter out unwanted tools using wildcard patterns (case-insensitive):
|
|
517
|
-
|
|
518
|
-
```json
|
|
519
|
-
{
|
|
520
|
-
"mcpServers": [...],
|
|
521
|
-
"excludeTools": [
|
|
522
|
-
"github__delete_*", // Exclude all GitHub delete tools
|
|
523
|
-
"*__experimental*", // Exclude all experimental tools
|
|
524
|
-
"filesystem__write_*", // Exclude filesystem write tools
|
|
525
|
-
"set_*" // Exclude management tools starting with set_
|
|
526
|
-
]
|
|
527
|
-
}
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
**No-Compress Tools** - Keep tools but never compress their descriptions:
|
|
531
|
-
|
|
532
|
-
Use the `noCompressTools` field to bypass compression for specific tools (descriptions pass through unchanged):
|
|
533
|
-
|
|
534
|
-
```json
|
|
535
|
-
{
|
|
536
|
-
"mcpServers": [...],
|
|
537
|
-
"noCompressTools": [
|
|
538
|
-
"filesystem__*", // Never compress filesystem tool descriptions
|
|
539
|
-
"*__help", // Never compress help commands
|
|
540
|
-
"github__search_*" // Never compress GitHub search tools
|
|
541
|
-
]
|
|
542
|
-
}
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
**Pattern Examples:**
|
|
546
|
-
- `"serverName__*"` - All tools from specific server
|
|
547
|
-
- `"*__toolPattern*"` - Tools matching pattern from any server
|
|
548
|
-
- `"exact_tool_name"` - Exact tool name match
|
|
549
|
-
|
|
550
|
-
**Use Cases:**
|
|
551
|
-
- **excludeTools**: Remove dangerous tools, unwanted features, or tools not relevant to your workflow
|
|
552
|
-
- **noCompressTools**: Preserve detailed descriptions for complex tools where compression might lose important information
|
|
553
|
-
|
|
554
|
-
#### Configuration Aggregation
|
|
555
|
-
|
|
556
|
-
Both config files are loaded and combined:
|
|
557
|
-
|
|
558
|
-
1. Load user config (`~/.mcp-compression-proxy/servers.json`)
|
|
559
|
-
2. Load project config (`./servers.json`)
|
|
560
|
-
3. Aggregate servers from both configs
|
|
561
|
-
4. Aggregate exclude and noCompress patterns from both configs
|
|
562
|
-
5. Apply exclude patterns to filter tools
|
|
563
|
-
6. Apply noCompress patterns to bypass compression
|
|
564
|
-
|
|
565
|
-
This allows:
|
|
566
|
-
- Personal defaults in user config
|
|
567
|
-
- Team/project-specific servers in project config
|
|
568
|
-
- Fine-grained tool filtering with exclude patterns
|
|
569
|
-
- Selective compression bypass with noCompress patterns
|
|
570
|
-
|
|
571
|
-
### Environment Variables
|
|
572
|
-
|
|
573
|
-
**For the compression proxy** (set in your MCP client config):
|
|
574
|
-
- `LOG_LEVEL` - Logging level (debug, info, warn, error). Default: `info`
|
|
575
|
-
|
|
576
|
-
**For MCP servers** (set in `servers.json` using `${VAR_NAME}` syntax):
|
|
577
|
-
- `GITHUB_TOKEN` - GitHub personal access token (if using GitHub MCP server)
|
|
578
|
-
- Any other environment variables required by your configured MCP servers
|
|
579
|
-
|
|
580
|
-
See [Environment Variable Expansion](#environment-variable-expansion) for details on using variables in your server configuration.
|
|
581
|
-
|
|
582
|
-
### Command-Line Options
|
|
583
|
-
|
|
584
|
-
**`--clear-cache`** - Clear the persistent compression cache and exit
|
|
585
|
-
|
|
586
|
-
```bash
|
|
587
|
-
# If installed via npm
|
|
588
|
-
mcp-compression-proxy --clear-cache
|
|
589
|
-
|
|
590
|
-
# If installed from source
|
|
591
|
-
node dist/index.js --clear-cache
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
### Debugging
|
|
595
|
-
|
|
596
|
-
**1. Enable debug logging** in your MCP client config:
|
|
597
|
-
|
|
598
|
-
```json
|
|
599
|
-
{
|
|
600
|
-
"mcpServers": {
|
|
601
|
-
"compression-proxy": {
|
|
602
|
-
"command": "mcp-compression-proxy",
|
|
603
|
-
"env": {
|
|
604
|
-
"LOG_LEVEL": "debug"
|
|
605
|
-
}
|
|
248
|
+
"name": "remote-docs",
|
|
249
|
+
"url": "https://mcp.example.com/mcp",
|
|
250
|
+
"headers": {
|
|
251
|
+
"Authorization": "Bearer ${DOCS_TOKEN}"
|
|
252
|
+
},
|
|
253
|
+
"timeout": 30
|
|
606
254
|
}
|
|
255
|
+
],
|
|
256
|
+
"excludeTools": ["*__delete_*", "*__experimental*"],
|
|
257
|
+
"noCompressTools": ["filesystem__write_file"],
|
|
258
|
+
"cli": {
|
|
259
|
+
"payloadThreshold": 10000,
|
|
260
|
+
"autoStartDaemon": true,
|
|
261
|
+
"daemonLogLevel": "info"
|
|
607
262
|
}
|
|
608
263
|
}
|
|
609
264
|
```
|
|
610
265
|
|
|
611
|
-
|
|
612
|
-
- **macOS**: `~/Library/Logs/Claude/mcp*.log`
|
|
613
|
-
- **Windows**: `%APPDATA%\Claude\Logs\mcp*.log`
|
|
614
|
-
|
|
615
|
-
**3. Check for common issues:**
|
|
616
|
-
- Ensure all configured MCP servers are accessible and properly configured
|
|
617
|
-
- Verify environment variables are correctly expanded
|
|
618
|
-
- Check that Node.js version is 18 or higher
|
|
619
|
-
|
|
620
|
-
## π‘ Best Practices
|
|
266
|
+
Remote servers support static headers. The proxy does not perform an interactive OAuth redirect, so use bearer tokens or API-key headers supported by the remote endpoint.
|
|
621
267
|
|
|
622
|
-
|
|
268
|
+
Environment references work in `env` and `headers`:
|
|
623
269
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
270
|
+
| Syntax | Result |
|
|
271
|
+
| ------------------- | ---------------------------------------------------------- |
|
|
272
|
+
| `${NAME}` | Use `NAME`; warn and substitute an empty string when unset |
|
|
273
|
+
| `${NAME:-fallback}` | Use `NAME`, or `fallback` when unset or empty |
|
|
274
|
+
| `$${NAME}` | Preserve the literal text `${NAME}` |
|
|
629
275
|
|
|
630
|
-
|
|
631
|
-
- Verbose explanations
|
|
632
|
-
- Redundant phrases
|
|
633
|
-
- Non-critical examples
|
|
634
|
-
- Marketing language
|
|
276
|
+
Local servers inherit the proxy's environment by default. Set `inheritEnv` to `false` for transport-safe defaults only, or provide an array such as `["HOME", "PATH", "LANG"]`. Explicit values in a server's `env` object always win.
|
|
635
277
|
|
|
636
|
-
###
|
|
278
|
+
### Core options
|
|
637
279
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
280
|
+
| Option | Default | Purpose |
|
|
281
|
+
| ----------------------------- | ------------ | ----------------------------------------------------------- |
|
|
282
|
+
| `defaultTimeout` | `30` | Backend timeout in seconds; overridable per server |
|
|
283
|
+
| `excludeTools` | `[]` | Hide matching `server__tool` names completely |
|
|
284
|
+
| `noCompressTools` | `[]` | Always show original descriptions for matching tools |
|
|
285
|
+
| `compressionFallbackBehavior` | `"original"` | Show `"original"` or `"blank"` before compression exists |
|
|
286
|
+
| `inheritEnv` | `true` | Control which environment variables local servers receive |
|
|
287
|
+
| `softMaxConnectionAgeSeconds` | `3600` | Lazily replace a connection on its next use after this age |
|
|
288
|
+
| `hardMaxConnectionAgeSeconds` | `28800` | Drain a connection at this age and reopen it on demand |
|
|
289
|
+
| `authErrorPatterns` | `[]` | Identify authentication failures in errors or tool results |
|
|
290
|
+
| `authRetryTools` | `[]` | Name tools safe to retry once after authentication recovery |
|
|
291
|
+
| `cli.payloadThreshold` | `10000` | Store larger outputs in private local files |
|
|
292
|
+
| `cli.autoStartDaemon` | `true` | Start the daemon when a CLI command needs it |
|
|
293
|
+
| `cli.daemonLogLevel` | `"info"` | Set `debug`, `info`, `warn`, or `error` logging |
|
|
644
294
|
|
|
645
|
-
|
|
646
|
-
```
|
|
647
|
-
"Search files by glob pattern (*, **, ?), case-sensitive, returns paths"
|
|
648
|
-
```
|
|
295
|
+
Set either connection age to `0` to disable that policy. Lifecycle and authentication options may also be set per server. Authentication failures always replace the backend generation that produced them, but automatic replay occurs only for names matching `authRetryTools`.
|
|
649
296
|
|
|
650
|
-
|
|
297
|
+
See [`servers.json.example`](servers.json.example) for a complete starting point.
|
|
651
298
|
|
|
652
299
|
<details>
|
|
653
|
-
<summary><strong
|
|
654
|
-
<p>Any MCP-compatible client: Claude Desktop, Cline, Continue.dev, or custom agents.</p>
|
|
655
|
-
</details>
|
|
300
|
+
<summary><strong>π¦ Versioned daemon deployments</strong></summary>
|
|
656
301
|
|
|
657
|
-
|
|
658
|
-
<summary><strong>Q: How much context does compression save?</strong></summary>
|
|
659
|
-
<p>Typically 50-80% reduction in token count for tool listings while preserving critical information.</p>
|
|
660
|
-
</details>
|
|
302
|
+
The daemon exposes a contract for a separate stable router to run candidate and active releases on different sockets. Configure each instance with `MCP_DAEMON_SOCKET_PATH`, `MCP_DAEMON_PID_FILE`, `MCP_DAEMON_READY_FILE`, `MCP_DAEMON_LOG_FILE`, and `MCP_DAEMON_RELEASE_ID`.
|
|
661
303
|
|
|
662
|
-
|
|
663
|
-
<summary><strong>Q: Do I need to restart after adding servers?</strong></summary>
|
|
664
|
-
<p>Yes, restart your MCP client to load the new configuration. No rebuild needed when using JSON configuration.</p>
|
|
665
|
-
</details>
|
|
304
|
+
`MCP_DAEMON_BASE_DIR` selects the shared state root, while `MCP_PAYLOAD_DIR` can preserve payload IDs across a release cutover. When `active-release.json` exists in that root, `mcp-cli` treats the installation as router-managed and refuses to start a legacy daemon on the stable socket.
|
|
666
305
|
|
|
667
|
-
|
|
668
|
-
<summary><strong>Q: Can I use multiple MCP servers?</strong></summary>
|
|
669
|
-
<p>Yes! That's the primary use case. Add as many as you need in your <code>servers.json</code> configuration file.</p>
|
|
670
|
-
</details>
|
|
306
|
+
This allows an external router to canary a candidate, switch new requests atomically, drain calls pinned to the old release, and roll back without terminating in-flight work.
|
|
671
307
|
|
|
672
|
-
<details>
|
|
673
|
-
<summary><strong>Q: Is compression permanent?</strong></summary>
|
|
674
|
-
<p>Compressed descriptions are persisted to disk at <code>~/.mcp-compression-proxy/cache.json</code> and automatically restored on server restart. Session-based expansions are temporary and reset per session.</p>
|
|
675
308
|
</details>
|
|
676
309
|
|
|
677
|
-
|
|
678
|
-
<summary><strong>Q: Where is the compression cache stored?</strong></summary>
|
|
679
|
-
<p>Cache is stored at <code>~/.mcp-compression-proxy/cache.json</code>. Use <code>--clear-cache</code> flag to clear it if needed.</p>
|
|
680
|
-
</details>
|
|
310
|
+
## π‘οΈ Security and privacy
|
|
681
311
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
312
|
+
- The proxy runs locally and does not require a hosted control plane.
|
|
313
|
+
- Tool inputs and outputs go only to the backend servers you configure; remote backends naturally receive calls addressed to them.
|
|
314
|
+
- Large outputs are stored in owner-only files and are retrieved by opaque payload ID, not arbitrary path.
|
|
315
|
+
- The daemon's local control socket can execute downstream MCP tools and is kept inside an owner-only directory.
|
|
316
|
+
- Use `inheritEnv: false` or an allowlist when a third-party local server should not receive unrelated environment variables.
|
|
317
|
+
- MCP Compression Proxy is a transport and lifecycle layer, not a sandbox or authorization boundary. Apply normal trust and permission controls to every backend server.
|
|
686
318
|
|
|
687
|
-
|
|
688
|
-
<summary><strong>Q: How do I add a new MCP server?</strong></summary>
|
|
689
|
-
<p>Edit your <code>servers.json</code> configuration file (in <code>~/.mcp-compression-proxy/</code> or project root), add your server config, and restart your MCP client. No rebuild needed.</p>
|
|
690
|
-
</details>
|
|
319
|
+
See [SECURITY.md][security] to report a vulnerability.
|
|
691
320
|
|
|
692
|
-
|
|
321
|
+
## π©Ί Troubleshooting
|
|
693
322
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
Comprehensive test suite included:
|
|
323
|
+
Start with:
|
|
697
324
|
|
|
698
325
|
```bash
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
npm run test:e2e # End-to-end tests only
|
|
703
|
-
npm run test:e2e:real-llm # Real LLM integration tests (requires Ollama)
|
|
704
|
-
npm run test:coverage # Generate coverage report
|
|
326
|
+
mcp-cli doctor
|
|
327
|
+
mcp-cli daemon status
|
|
328
|
+
mcp-cli daemon logs -n 100
|
|
705
329
|
```
|
|
706
330
|
|
|
707
|
-
|
|
331
|
+
- After changing daemon-specific settings, run `mcp-cli daemon restart`.
|
|
332
|
+
- Clear saved descriptions with `mcp-compression-proxy --clear-cache`.
|
|
333
|
+
- Native MCP logs go to stderr so stdout remains valid JSON-RPC.
|
|
334
|
+
- A restricted agent sandbox may block the daemon's Unix socket. Grant access to `~/.mcp-compression-proxy/` or run the CLI in the host environment.
|
|
708
335
|
|
|
709
336
|
## π€ Contributing
|
|
710
337
|
|
|
711
|
-
Contributions welcome
|
|
712
|
-
|
|
713
|
-
Quick start:
|
|
714
|
-
|
|
715
|
-
1. Fork the repository
|
|
716
|
-
2. Create your feature branch
|
|
717
|
-
3. Make your changes and test
|
|
718
|
-
4. Commit using [Conventional Commits](https://www.conventionalcommits.org/)
|
|
719
|
-
5. Open a Pull Request
|
|
720
|
-
|
|
721
|
-
Note: This project follows a [Code of Conduct][code-of-conduct].
|
|
722
|
-
|
|
723
|
-
## π Complementary Projects
|
|
338
|
+
Found a bug π, have an idea β¨, or want to improve the docs? Contributions are welcome. Read [CONTRIBUTING.md][contributing], follow the [Code of Conduct][code-of-conduct], and run the checks before opening a pull request:
|
|
724
339
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
While MCP Compression Proxy optimizes your tool descriptions, [Local Skills MCP][local-skills-mcp] provides expert-level prompt instructions that work across any MCP-compatible client.
|
|
732
|
-
|
|
733
|
-
**Perfect combination:**
|
|
734
|
-
- **MCP Compression Proxy** - Aggregates and compresses tool descriptions (50-80% token reduction)
|
|
735
|
-
- **Local Skills MCP** - Provides expert skills with lazy loading (~50 tokens/skill)
|
|
340
|
+
```bash
|
|
341
|
+
npm install
|
|
342
|
+
npm run typecheck
|
|
343
|
+
npm run lint
|
|
344
|
+
npm test
|
|
345
|
+
```
|
|
736
346
|
|
|
737
|
-
|
|
738
|
-
- π― Optimized context usage across tools AND prompts
|
|
739
|
-
- π Portable workflows that work with Claude, Cline, Continue.dev, and more
|
|
740
|
-
- β‘ Efficient AI interactions with minimal context consumption
|
|
741
|
-
- π Professional-grade AI agent capabilities
|
|
347
|
+
Additional test guidance is in [`tests/README.md`](tests/README.md).
|
|
742
348
|
|
|
743
|
-
|
|
349
|
+
## π Support the project
|
|
744
350
|
|
|
745
|
-
|
|
351
|
+
Open source grows through the people who try it, share it, and improve it. If MCP Compression Proxy gives your agent some breathing room:
|
|
746
352
|
|
|
747
|
-
|
|
353
|
+
- β **[Star the repository][stargazers]** so more MCP users can discover it.
|
|
354
|
+
- π **[Report a bug or suggest an idea][repo-issues]** to help shape the roadmap.
|
|
355
|
+
- π **[Contribute code or documentation][contributing]**βfirst-time contributors are welcome.
|
|
356
|
+
- π **Sponsor continued development** using any of the options below.
|
|
748
357
|
|
|
749
358
|
<div align="center">
|
|
750
359
|
|
|
751
|
-
[![GitHub
|
|
752
|
-
[![
|
|
360
|
+
[![GitHub Stars][stars-badge]][stargazers]
|
|
361
|
+
[![Sponsor on GitHub][sponsor-github-badge]][sponsor-github]
|
|
362
|
+
[![Buy Me a Coffee][sponsor-coffee-badge]][sponsor-coffee]
|
|
753
363
|
[![PayPal][sponsor-paypal-badge]][sponsor-paypal]
|
|
754
364
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
**Ways to support:**
|
|
365
|
+
**Every star, issue, pull request, and contribution helps. Thank you! π**
|
|
758
366
|
|
|
759
|
-
|
|
760
|
-
- π° Sponsor via the badges above
|
|
761
|
-
- π [Report bugs and suggest features][repo-issues]
|
|
762
|
-
- π [Contribute code or documentation][contributing]
|
|
367
|
+
</div>
|
|
763
368
|
|
|
764
369
|
## π License
|
|
765
370
|
|
|
766
|
-
MIT
|
|
767
|
-
|
|
768
|
-
## π Acknowledgments
|
|
769
|
-
|
|
770
|
-
Built with [Model Context Protocol SDK][mcp-sdk]
|
|
371
|
+
[MIT](LICENSE) Β© 2025 KDPA. Built with the [Model Context Protocol TypeScript SDK][mcp-sdk].
|
|
771
372
|
|
|
772
373
|
---
|
|
773
374
|
|
|
774
375
|
<div align="center">
|
|
775
376
|
|
|
776
|
-
|
|
377
|
+
[β¬ Back to top](#-mcp-compression-proxy)
|
|
777
378
|
|
|
778
379
|
Made with β€οΈ by KDPA
|
|
779
380
|
|
|
780
381
|
</div>
|
|
781
382
|
|
|
782
|
-
<!-- Reference
|
|
783
|
-
<!-- Badges - Top of README -->
|
|
383
|
+
<!-- Reference links -->
|
|
784
384
|
|
|
785
385
|
[npm-version-badge]: https://img.shields.io/npm/v/mcp-compression-proxy.svg
|
|
786
386
|
[npm-package]: https://www.npmjs.com/package/mcp-compression-proxy
|
|
787
387
|
[npm-downloads-badge]: https://img.shields.io/npm/dm/mcp-compression-proxy
|
|
788
|
-
[npm-types-badge]: https://img.shields.io/npm/types/mcp-compression-proxy
|
|
789
|
-
[license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
|
|
790
|
-
[license]: https://opensource.org/licenses/MIT
|
|
791
388
|
[node-badge]: https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg
|
|
792
389
|
[nodejs]: https://nodejs.org/
|
|
793
|
-
[mcp-badge]: https://img.shields.io/badge/MCP-Compatible-purple.svg
|
|
794
|
-
[mcp-protocol]: https://modelcontextprotocol.io/
|
|
795
|
-
[mcp-sampling]: https://modelcontextprotocol.io/docs/concepts/sampling
|
|
796
|
-
|
|
797
|
-
<!-- CI/CD Badges -->
|
|
798
|
-
|
|
799
390
|
[ci-badge]: https://github.com/kdpa-llc/mcp-compression-proxy/actions/workflows/test.yml/badge.svg
|
|
800
391
|
[ci-workflow]: https://github.com/kdpa-llc/mcp-compression-proxy/actions/workflows/test.yml
|
|
801
392
|
[codecov-badge]: https://codecov.io/gh/kdpa-llc/mcp-compression-proxy/branch/main/graph/badge.svg
|
|
802
393
|
[codecov]: https://codecov.io/gh/kdpa-llc/mcp-compression-proxy
|
|
803
|
-
[
|
|
804
|
-
[
|
|
805
|
-
|
|
806
|
-
<!-- GitHub Badges -->
|
|
807
|
-
|
|
394
|
+
[license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
|
|
395
|
+
[license-file]: LICENSE
|
|
396
|
+
[repo]: https://github.com/kdpa-llc/mcp-compression-proxy
|
|
808
397
|
[stars-badge]: https://img.shields.io/github/stars/kdpa-llc/mcp-compression-proxy?style=social
|
|
809
398
|
[stargazers]: https://github.com/kdpa-llc/mcp-compression-proxy/stargazers
|
|
810
|
-
[forks-badge]: https://img.shields.io/github/forks/kdpa-llc/mcp-compression-proxy?style=social
|
|
811
|
-
[network]: https://github.com/kdpa-llc/mcp-compression-proxy/network/members
|
|
812
|
-
[issues-badge]: https://img.shields.io/github/issues/kdpa-llc/mcp-compression-proxy
|
|
813
399
|
[repo-issues]: https://github.com/kdpa-llc/mcp-compression-proxy/issues
|
|
814
|
-
[commit-badge]: https://img.shields.io/github/last-commit/kdpa-llc/mcp-compression-proxy
|
|
815
|
-
[commits]: https://github.com/kdpa-llc/mcp-compression-proxy/commits/main
|
|
816
|
-
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
|
|
817
|
-
|
|
818
|
-
<!-- Repository Links -->
|
|
819
|
-
|
|
820
|
-
[repo]: https://github.com/kdpa-llc/mcp-compression-proxy
|
|
821
|
-
[pulls]: https://github.com/kdpa-llc/mcp-compression-proxy/pulls
|
|
822
|
-
|
|
823
|
-
<!-- Documentation Links -->
|
|
824
|
-
|
|
825
400
|
[contributing]: CONTRIBUTING.md
|
|
826
401
|
[security]: SECURITY.md
|
|
827
402
|
[code-of-conduct]: CODE_OF_CONDUCT.md
|
|
828
|
-
[license-file]: LICENSE
|
|
829
|
-
|
|
830
|
-
<!-- Sponsorship Links -->
|
|
831
|
-
|
|
832
403
|
[sponsor-github-badge]: https://img.shields.io/badge/Sponsor-GitHub%20Sponsors-ea4aaa?logo=github
|
|
833
404
|
[sponsor-github]: https://github.com/sponsors/moscaverd
|
|
834
|
-
[sponsor-coffee-badge]: https://img.shields.io/badge/Buy%20Me%
|
|
405
|
+
[sponsor-coffee-badge]: https://img.shields.io/badge/Buy%20Me%20a%20Coffee-support-yellow?logo=buy-me-a-coffee
|
|
835
406
|
[sponsor-coffee]: https://buymeacoffee.com/moscaverd
|
|
836
407
|
[sponsor-paypal-badge]: https://img.shields.io/badge/PayPal-donate-blue?logo=paypal
|
|
837
408
|
[sponsor-paypal]: https://paypal.me/moscaverd
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
[mcp-sdk]: https://github.com/modelcontextprotocol/sdk
|
|
842
|
-
[local-skills-mcp]: https://github.com/kdpa-llc/local-skills-mcp
|
|
409
|
+
[mcp-sdk]: https://github.com/modelcontextprotocol/typescript-sdk
|
|
410
|
+
[mcp-sampling]: https://modelcontextprotocol.io/specification/2026-07-28/client/sampling
|