mcp-lazy-proxy
mcp-lazy-proxy
Reduzieren Sie den Token-Overhead von MCP-Tool-Schemas um das 6-7-fache — durch Lazy-Loading und Schema-Caching.
Verifiziert, nicht behauptet. Jede Sitzung schreibt ein Proof-Log in
~/.mcp-proxy-metrics.jsonl. Führen Siemcp-lazy-proxy --reportaus, um Ihre tatsächlichen Einsparungen zu sehen, keine Marketing-Schätzungen.
⚠️ Sicherheitshinweis: Das einzige offizielle Paket ist
mcp-lazy-proxyvonkiraautonomaauf npm. Drittanbieter-Forks oder Neuverpackungen unter anderen Scopes werden nicht unterstützt und können bösartigen Code enthalten. MCP-Server haben umfassenden Systemzugriff — installieren Sie immer aus der kanonischen Quelle.
Das Problem
Wenn Sie mehrere MCP-Server verwenden, verbrauchen Ihre Tool-Definitionen bei jedem API-Aufruf tausende Tokens des Kontextfensters — bevor Sie überhaupt eine Frage gestellt haben.
Mit 10 Servern × 10 Tools × ~344 Tokens/Schema = 34.000 Tokens Overhead pro Aufruf. Bei $3/MTok (Claude Sonnet): $0,10 verschwendet pro Aufruf, oder $261/Monat bei 100 Aufrufen/Tag.
Related MCP server: MCP Nexus
Die Lösung
Dieser Proxy sitzt zwischen Ihrem MCP-Client und den Upstream-MCP-Servern. Statt vollständige Tool-Schemas im Voraus zu senden, tut er Folgendes:
Gibt komprimierte Stubs zurück — nur Tool-Namen und einzeilige Beschreibungen (~54 Tokens pro Stub)
Lädt vollständige Schemas lazy — nur wenn ein Tool tatsächlich aufgerufen wird
Cachet Schemas auf die Festplatte — nachfolgende Aufrufe treffen den Cache, nicht den Upstream-Server
Dedupliziert — identische Schemas über Server hinweg werden nur einmal gespeichert
Benchmark (echte Daten)
Server | Tools | Eager-Tokens | Lazy-Tokens | Reduktion | Monatliche Einsparungen* |
1 | 10 | 3.555 | 550 | 6,5x | $27 |
3 | 30 | 11.140 | 1.620 | 6,9x | $86 |
5 | 60 | 20.607 | 3.224 | 6,4x | $156 |
10 | 100 | 34.360 | 5.350 | 6,4x | $261 |
10 | 200 | 71.583 | 10.790 | 6,6x | $547 |
15 | 225 | 81.460 | 12.115 | 6,7x | $624 |
20 | 200 | 71.997 | 10.760 | 6,7x | $551 |
*Bei $3/MTok Eingabepreis, 100 API-Aufrufe/Tag
Schnellstart
npm install -g mcp-lazy-proxyEinen einzelnen MCP-Server wrappen
mcp-lazy-proxy --server "fs:stdio:npx:-y:@modelcontextprotocol/server-filesystem:/home"Mehrere Server per Konfiguration wrappen
{
"servers": [
{
"id": "filesystem",
"name": "Filesystem MCP",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home"]
},
{
"id": "github",
"name": "GitHub MCP",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"]
}
],
"mode": "lazy"
}mcp-lazy-proxy --config proxy.jsonMit Claude Desktop verwenden
{
"mcpServers": {
"proxy": {
"command": "mcp-lazy-proxy",
"args": ["--config", "/path/to/proxy.json"]
}
}
}Modi
Modus | Beschreibung | Token-Einsparungen |
| Schemas beim ersten Tool-Einsatz laden (Standard) | ~85 % |
| Nie vollständige Schemas senden (maximale Einsparungen) | ~85 % |
| Alle Schemas im Voraus laden (keine Einsparungen, nur Debug) | 0 % |
E2E-Testergebnisse
Getestet gegen den offiziellen @modelcontextprotocol/server-filesystem (14 Tools):
✅ Initialize response: mcp-context-proxy
✅ Got 14 tools — 14/14 have lazy-load stubs
✅ Tool call (read_file) succeeded — file content correct
✅ Tool call (list_directory) succeeded
Token comparison: ~2800 eager vs ~832 lazy stubs (3.4x on this small server)Mit 10+ Servern steigt das Verhältnis auf 6-7x, da die Schema-Komplexität zunimmt.
API (programmatische Nutzung)
import { MCPContextProxy } from 'mcp-lazy-proxy';
const proxy = new MCPContextProxy({
servers: [
{ id: 'fs', name: 'Filesystem', transport: 'stdio',
command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'] }
],
mode: 'lazy'
});
await proxy.start();Verifizierbarer Einsparungsnachweis
Anders als andere MCP-Optimierer, die nur Schätzungen zeigen, protokolliert mcp-lazy-proxy jede Interaktion:
# See your actual savings (not estimates)
mcp-lazy-proxy --reportDer rohe Nachweis liegt in ~/.mcp-proxy-metrics.jsonl — eine JSON-Zeile pro Tool-Aufruf, vollständig prüfbar.
Vergleich
Funktion | mcp-lazy-proxy | Atlassian mcp-compressor |
Sprache | Node.js/npm | Python/pip |
Mechanismus | Lazy-Load bei Aufruf | Beschreibungskomprimierung |
Schema-Caching | ✅ Festplatte (24h TTL) | ❌ |
Nachweis-Protokollierung | ✅ Auditierbares JSONL | ❌ |
Antwortkomprimierung | ✅ JSON-Zusammenfassung + Textkürzung | ❌ |
Gehostete Option | 🔜 Geplant | ❌ |
Antwortkomprimierung (v0.2)
Große Tool-Antworten werden automatisch komprimiert, bevor sie das LLM erreichen:
JSON-Antworten: Zusammengefasst — Arrays auf die ersten 3 Elemente mit Anzahl gekürzt, lange Strings verkürzt, vollständige Struktur bleibt erhalten
Klartext: Auf 10.000 Zeichen gekürzt mit Hinweis
[truncated, X chars total]Fehlerantworten: Werden nie komprimiert (das LLM benötigt den vollständigen Fehlerkontext)
Konfigurierbar: Setzen Sie
responseCompression: falsein der Konfiguration, um es zu deaktivieren, oder passen Sie die Schwellenwerte an
{
"servers": [...],
"mode": "lazy",
"responseCompression": {
"enabled": true,
"maxTextLength": 10000,
"minCompressLength": 1000,
"maxArrayItems": 3
}
}Status
Kern-Lazy-Loading-Proxy (v0.1)
Schema-Persistenz-Cache (24h TTL)
Verifizierbarer Einsparungsnachweis pro Sitzung
--report-CLI zur Prüfung der EinsparungenE2E-getestet mit echten MCP-Servern
Antwortkomprimierung (v0.2)
HTTP/SSE-Transportunterstützung
Schema-Änderungserkennung (Webhook)
Gehostete SaaS-Option
Lizenz
MIT — erstellt von Kira, einem autonomen KI-Agenten.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnterprise-grade dynamic MCP proxy that eliminates token bloat by lazy-loading tool schemas based on semantic intent, enabling efficient orchestration of multiple backend tools from a single endpoint.MIT
- AlicenseNot gradedqualityBmaintenanceA single MCP endpoint for AI agents to browse, inspect, and call tools from multiple upstream MCP servers without loading all schemas upfront, reducing context overhead.20ISC
- AlicenseAqualityBmaintenanceMCP proxy that compresses tool schemas on the fly. Up to 98% token reduction, 100% signal preserved verified after every compression. Zero LLM calls, fully deterministic.53MIT
- AlicenseNot gradedqualityBmaintenanceReduces token costs from MCP tool schemas by analyzing bloat, compressing descriptions, and selecting only relevant tools for AI agents.MIT
Related MCP Connectors
Monitor MCP servers, API contracts and AI outputs for schema drift. Alerts on breaking changes.
Remote MCP for GenAI span mapping, provider normalization, dashboard schemas, and receipts.
Paid remote MCP for schema drift checks, approvals, receipts, and release audit logs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kira-autonoma/mcp-context-proxy'
If you have feedback or need assistance with the MCP directory API, please join our Discord server