mcplexer

Connect / Bridge

The mcplexer connect command bridges stdin/stdout to a running MCPlexer daemon over a Unix socket. This lets AI clients that only support stdio-based MCP servers communicate with a long-running MCPlexer instance.

Why Connect?

MCPlexer can run in two modes:

  • Direct stdiomcplexer serve --mode=stdio starts a fresh instance per client session
  • Daemon + connect — the daemon runs persistently, and mcplexer connect bridges individual clients to it

The daemon approach is preferred for production use because downstream server processes persist across client sessions, caches stay warm, and configuration changes take effect immediately without restarting clients.

Usage

Connect to a running daemon via its Unix socket:

terminal
mcplexer connect --socket=/path/to/mcplexer.sock
NameTypeDefaultDescription
--socketstringPath to the MCPlexer daemon's Unix socket. Can also be set via MCPLEXER_SOCKET_PATH.

The default socket location is /tmp/mcplexer.sock when the daemon is started with default settings.

terminal
# Start the daemon mcplexer daemon start # In another terminal, connect a stdio bridge mcplexer connect --socket=/tmp/mcplexer.sock

CWD Injection

When mcplexer connect starts, it passes the client's current working directory to the daemon via the MCPLEXER_CLIENT_CWD environment variable. The daemon uses this to resolve which workspace the client belongs to.

This means workspace matching works correctly even though the daemon runs as a separate process — it knows where the client is working from.

how CWD flows
# Client is in /home/dev/projects/api-service cd /home/dev/projects/api-service mcplexer connect --socket=/tmp/mcplexer.sock # Daemon receives MCPLEXER_CLIENT_CWD=/home/dev/projects/api-service # Matches workspace with root: /home/dev/projects/api-service

Claude Desktop Integration

To use daemon mode with Claude Desktop, configure mcplexer connect as the MCP server command:

json
{
  "mcpServers": {
    "mcplexer": {
      "command": "mcplexer",
      "args": ["connect", "--socket", "/tmp/mcplexer.sock"]
    }
  }
}

Config file location

On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

With this setup, Claude Desktop launches mcplexer connect which bridges to your running daemon. The daemon manages all downstream servers, caching, and routing.

When to Use Connect vs Direct Stdio

ScenarioRecommended Mode
Single developer, simple setupDirect stdio (serve --mode=stdio)
Multiple clients sharing stateDaemon + connect
Persistent downstream processesDaemon + connect
Warm caches across sessionsDaemon + connect
Quick testing or evaluationDirect stdio

Start simple

If you're just getting started, use direct stdio mode. Switch to daemon + connect when you need persistent processes, shared caches, or multiple concurrent clients.