by postrv
Code Mode inspired local sandboxed MCP Gateway — collapses N servers x M tools into 2 tools (~1,000 tokens)
# Add to your Claude Code skills
git clone https://github.com/postrv/forgemaxCode Mode MCP Gateway — collapses N servers x M tools into 2 tools (~1,000 tokens).
Instead of dumping every tool schema into the LLM's context window, Forgemax exposes exactly two MCP tools:
search — query a capability manifest to discover tools (read-only, sandboxed)execute — run JavaScript against the tool API in a sandboxed V8 isolatev0.2 adds three new capabilities inside the sandbox (the MCP surface stays at exactly 2 tools):
forge.readResource(server, uri) — read MCP resources from downstream serversforge.stash — session-scoped key-value store for sharing data across executionsforge.parallel(calls, opts) — bounded concurrent execution of tool/resource callsThe LLM writes JavaScript that calls through typed proxy objects. Credentials, file paths, and internal state never leave the host — the sandbox only sees opaque bindings.
Forgemax's Code Mode approach draws inspiration from Cloudflare's sandbox tool-calling pattern — their implementation of sandboxed code execution for MCP tool orchestration is excellent and well worth studying. We encourage supporting their work.
| Traditional MCP | Forgemax Code Mode |
|---|---|
| 76 tools = ~15,000 tokens of schema | 2 tools = ~1,000 tokens |
| 5-10 sequential round-trips | 1 execute() call with chaining |
| Every new tool widens the context | Tool count is invisible to the LLM |
LLMs are trained on billions of lines of code. They're better at writing narsil.symbols.find({pattern: "handle_*"}) than picking the right tool from a 76-item JSON schema list.
No comments yet. Be the first to share your thoughts!
forgemax Binary entry point (stdio MCP transport)
forge-config TOML config loading with env var expansion
forge-client MCP client connections (stdio + HTTP/SSE)
forge-server MCP server handler (search + execute via rmcp)
forge-sandbox V8 sandbox (deno_core, dual-mode execution)
forgemax-worker Isolated child process for V8 execution
forge-manifest Hierarchical capability manifest registry
forge-test-server Mock MCP server for integration tests
The core innovation. Uses deno_core to run LLM-generated JavaScript in a locked-down V8 isolate:
forge.parallel()) with concurrency capsIsolated child process binary for production ...