arek-e/mcpx
Self-hosted MCP Code Mode gateway — aggregate multiple MCP servers behind 2 tools with V8 isolate execution
Platform-specific configuration:
{
"mcpServers": {
"mcpx": {
"command": "npx",
"args": [
"-y",
"mcpx"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
Collapse multiple MCP servers into 2 tools. Your agent writes code to call them instead of loading 100+ tool schemas into context.
mcpx sits between your agent and your MCP servers. Instead of registering every tool (which eats context tokens), it exposes just `search` and `execute`. The agent discovers tools via search, writes JavaScript to call them, and the code runs in a sandboxed V8 isolate.
Without mcpx: agent ← 120 tool schemas (~84,000 tokens)
With mcpx: agent ← 2 tools (~1,000 tokens) → writes JS → mcpx executes → calls real tools| Approach | Context tokens | | ---------------------------- | -------------- | | 120 tools (full schemas) | ~84,000 | | 120 tools (minimal schemas) | ~17,000 | | mcpx Code Mode (2 tools) | ~1,000 |
Inspired by Cloudflare's Code Mode pattern — self-hosted, no Cloudflare dependency.
<table> <tr> <td align="center"><br><b>Claude Code</b></td> <td align="center"><br><b>Cursor</b></td> <td align="center"><b>Codex</b></td> <td align="center"><br><b>Amp</b></td> <td align="center"><b>OpenCode</b></td> </tr> </table>
Supports stdio and HTTP (Streamable HTTP) — works with any MCP-compatible agent.
---
Run mcpx locally as a stdio subprocess. No server, no Docker, no Kubernetes.
# Import your existing MCP servers from .mcp.json
bunx mcpx-tools init
# Or start with a blank template
bunx mcpx-tools init --emptyEdit `mcpx.jso
Loading reviews...