Skip to main content
Glama

Code Mode Bridge

npm

An MCP (Model Context Protocol) multiplexer that connects to upstream MCP servers and exposes all their tools through a single sandbox_eval_js tool for unified orchestration and execution. Runs on Node.js and Deno. Bun is not officially supported — if you need to use Bun, ensure a container runtime (Docker or Podman) or Deno is available in your PATH so the bridge can delegate code execution to a supported executor.

Key Features

  • Multi-server bridging: Connect to multiple upstream MCP servers simultaneously.

  • Tool aggregation: Exposes all upstream functions through a single sandbox_eval_js tool.

  • Dynamic discovery: Three built-in discovery tools let agents find and inspect available functions before writing code.

  • Multi-executor sandbox: Secure execution via Deno, isolated-vm, Docker/Podman containers, or vm2.

  • Automatic detection: Automatically selects the best available executor for your environment.

  • Live reload: Watches mcp.json for changes and hot-reloads upstream connections without restarting.

  • CLI management: Easy command-line interface for server configuration.

Quick Start

Installation & Run

# Run without installing
npx @ruifung/codemode-bridge

# Or install globally
npm install -g @ruifung/codemode-bridge
codemode-bridge run

Basic Usage

  1. Add a server:

    codemode-bridge config add kubernetes --type stdio --command "npx" --args "-y,kubernetes-mcp-server@latest"
  2. Start the bridge:

    codemode-bridge run
  3. Use in your client: Point your MCP client (Claude Desktop, VS Code, etc.) to npx @ruifung/codemode-bridge.

Discovery Tools

The bridge exposes three tools for discovering what's available before writing sandbox_eval_js code:

Tool

Description

sandbox_get_functions

List all available functions grouped by server. Accepts an optional server filter.

sandbox_get_function_schema

Get the TypeScript type definition for a specific function by name.

sandbox_search_functions

Keyword-search all function names and descriptions. Returns matching functions with their schemas.

Use these before calling sandbox_eval_js to find the correct function name and parameter types.

Using the sandbox_eval_js Tool

The sandbox_eval_js tool executes JavaScript in a sandboxed environment with access to all upstream functions via the codemode object. You can write either a function body or a complete async arrow function:

// Function body (auto-wrapped):
const result = await codemode.server_name__function_name({ param: "value" });
return result;

// Or as a complete async arrow function:
async () => {
  const result = await codemode.server_name__function_name({ param: "value" });
  return result;
}

Documentation Index

  • Architecture: How the bridge works, project structure, and logical flow.

  • Executors: Detailed comparison of sandbox backends (Deno, isolated-vm, Containers).

  • CLI & Configuration: Full command reference and configuration format.

  • HTTP Serve Mode: Multi-client HTTP transport, session isolation, and security.

  • Integration Guide: Setup instructions for Claude Desktop, VS Code, and more.

  • Development: Build and test instructions for contributors.

  • Sandbox Hardening: Security details for the execution environments.

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

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/ruifung/mcp-cm-bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server