@luutuankiet/mcp-proxy-shim 1.3.4 → 1.3.5

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.
Files changed (2) hide show
  1. package/README.md +46 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -378,6 +378,51 @@ We tested this live: added a YNAB financial tool mid-session → 43 new tools ap
378
378
  # => [{ name: "Checking", balance: 1500000, ... }]
379
379
  ```
380
380
 
381
+ ## Response Size Annotation
382
+
383
+ Claude Code has a hardcoded 50,000 char ceiling (`Vb_=50000` in the binary) for MCP tool results. Responses exceeding this are persisted to disk and replaced with a 2KB preview — forcing the agent to waste 3-5 extra calls recovering the content.
384
+
385
+ The shim solves this by annotating **every proxied tool** with `_meta["anthropic/maxResultSizeChars"]` in the `tools/list` response. When Claude Code sees this annotation, it raises the ceiling from 50k to up to 500k chars (`IU6=500000`), letting large responses flow through inline.
386
+
387
+ ### How it works
388
+
389
+ ```mermaid
390
+ sequenceDiagram
391
+ participant CC as Claude Code
392
+ participant Shim as mcp-proxy-shim
393
+ participant Proxy as mcpproxy-go
394
+
395
+ CC->>Shim: tools/list
396
+ Shim->>Proxy: tools/list
397
+ Proxy-->>Shim: tools (no annotation)
398
+ Note over Shim: Inject _meta annotation<br/>on every tool
399
+ Shim-->>CC: tools with _meta:<br/>{"anthropic/maxResultSizeChars": 500000}
400
+
401
+ Note over CC: Persistence ceiling<br/>raised from 50k → 500k chars
402
+
403
+ CC->>Shim: call_tool_read (multi-file read)
404
+ Shim->>Proxy: call_tool_read
405
+ Proxy-->>Shim: 60k chars response
406
+ Shim-->>CC: 60k chars (inline ✅)
407
+ Note over CC: Without annotation:<br/>persisted to disk ❌
408
+ ```
409
+
410
+ ### Before vs After
411
+
412
+ | Scenario | Without annotation (v1.3.3) | With annotation (v1.3.4+) |
413
+ |----------|---------------------------|---------------------------|
414
+ | 4-file read (~53k chars) | Persisted to disk → 2KB preview → 5 wasted recovery calls | Inline, 1 call ✅ |
415
+ | Large command output (~80k chars) | Same persistence trap | Inline up to 500k chars ✅ |
416
+ | Responses under 50k chars | No change | No change |
417
+
418
+ ### Configuration
419
+
420
+ | Variable | Default | Description |
421
+ |----------|---------|-------------|
422
+ | `MCP_MAX_RESULT_CHARS` | `500000` | Value for the `anthropic/maxResultSizeChars` annotation. Claude Code's max is 500,000 chars. Set to `0` to disable the annotation entirely. |
423
+
424
+ In a **shim chain** (e.g., Claude Code → shim → proxy → inner shim → proxy), only the outermost shim's annotation matters — Claude Code only sees tools listed by the shim it directly connects to. Inner shim annotations are harmless but overwritten.
425
+
381
426
  ## Configuration
382
427
 
383
428
  | Environment variable | Default | Transport | Description |
@@ -386,6 +431,7 @@ We tested this live: added a YNAB financial tool mid-session → 43 new tools ap
386
431
  | `MCP_PORT` | `3000` | HTTP only | Port to listen on |
387
432
  | `MCP_HOST` | `0.0.0.0` | HTTP only | Host to bind to |
388
433
  | `MCP_APIKEY` | — (open) | HTTP only | API key for downstream clients. When set, requests must include `?apikey=KEY`. Unset = no auth. |
434
+ | `MCP_MAX_RESULT_CHARS` | `500000` | All | `anthropic/maxResultSizeChars` annotation value. Raises Claude Code's response persistence ceiling. Set `0` to disable. |
389
435
  | `https_proxy` / `HTTPS_PROXY` | — | Both | HTTPS proxy (auto-detected via undici ProxyAgent) |
390
436
 
391
437
  ## Architecture Details
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luutuankiet/mcp-proxy-shim",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "MCP proxy shim for mcpproxy-go — transforms call_tool_* args_json:string to native args:object. Supports stdio and HTTP Streamable transports.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",