Tutorial

How to Set Up an MCP Proxy / Daemon for Claude, Cursor, and opencode

Run one MCP daemon for all your AI assistants. Cuts context bloat 99% and RAM usage 4 GB to 200 MB.

An r/opencodeCLI thread documented 35 npm processes and 4 GB of RAM serving MCP servers across pi, VS Code, and opencode. The fix is a single MCP daemon. This tutorial walks the setup.

Prerequisites

  • Node 20+
  • Claude Desktop / Cursor / opencode (any combination)

Walkthrough

Step 1: Pick a gateway implementation

FastMCP and @modelcontextprotocol/server-everything are the common starting points.

Bash
npm install -g @modelcontextprotocol/server-gateway

Step 2: Define the upstream MCP fleet

Single config lists all servers the daemon proxies.

JSON
{
  "upstreams": {
    "scavio": { "url": "https://mcp.scavio.dev/mcp", "headers": { "x-api-key": "${SCAVIO_API_KEY}" } },
    "playwright": { "command": "npx", "args": ["@playwright/mcp"] },
    "shadcn": { "command": "npx", "args": ["@shadcn/mcp"] }
  }
}

Step 3: Run the daemon as a single process

HTTP mode lets agents connect remotely.

Bash
mcp-gateway --config gateway.json --http --port 8765 &

Step 4: Point each agent at the daemon

All agents see the same fleet.

JSON
// .cursor/mcp.json AND ~/.config/Claude/claude_desktop_config.json AND opencode config
{
  "mcpServers": {
    "gateway": { "url": "http://localhost:8765/mcp" }
  }
}

Step 5: Verify the consolidation

Check process count + RAM before vs after.

Bash
ps aux | grep -E 'mcp|npm exec' | wc -l
# Before: 35+. After: 1.

Python Example

Python
# This tutorial is config-driven; no Python sample needed.

JavaScript Example

JavaScript
// See JSON config blocks above.

Expected Output

JSON
Process count drops from 35+ to 1. RAM drops from ~4 GB to ~200 MB. Schema-load tokens drop from 50K to under 500.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Node 20+. Claude Desktop / Cursor / opencode (any combination). A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Run one MCP daemon for all your AI assistants. Cuts context bloat 99% and RAM usage 4 GB to 200 MB.