Skip to main content
Glama

MCP Bridge — Dynamic Tool Gateway

A generic bridge between any MCP client and any tool provider via Cloudflare Workers Durable Objects. Tool providers connect via WebSocket, MCP clients connect via Streamable HTTP. Tools are registered dynamically and discovered automatically.

How It Works

┌─────────────────┐  WebSocket   ┌──────────────────────┐  HTTP/SSE   ┌──────────────┐
│  Tool Provider  │ ───────────→ │  Cloudflare Worker   │ ──────────→ │  MCP Client  │
│  (Extension,    │              │  (Durable Object)    │             │  (VS Code,   │
│   App, Script)  │  register    │                      │ tools/list  │   Claude,    │
│                 │  tools       │  dynamic registry    │ tools/call  │   Cursor)    │
│  execute        │─────────────→│  + bridge            │───────────→│              │
│  tools          │←─────────────│  forward calls       │←───────────│  AI agent    │
│                 │  callTool    │                      │             │  discovers   │
└─────────────────┘              └──────────────────────┘             └──────────────┘

Bridge — stateless MCP proxy with dynamic tool registry (Cloudflare Durable Object)

Tool Provider — anything that connects via WebSocket and registers tools (browser extension, desktop app, script, etc.)

MCP Client — any standard MCP client (VS Code, Claude Desktop, Cursor, etc.)

Related MCP server: Remote MCP Server on Cloudflare

Quick Start

1. Deploy the Bridge

git clone <this-repo>
cd mcp-bridge-cf
npm install
npx wrangler login
npm run deploy

Output: https://mcp-bridge.<your-subdomain>.workers.dev

2. Connect a Tool Provider

Any application can register tools via WebSocket:

const ws = new WebSocket("wss://mcp-bridge.<subdomain>.workers.dev/ws/extension")

// Register tools
ws.send(JSON.stringify({
  type: "registerTools",
  tools: [
    {
      name: "my_tool",
      description: "Does something useful",
      inputSchema: {
        type: "object",
        properties: {
          query: { type: "string", description: "Input query" }
        },
        required: ["query"]
      }
    }
  ]
}))

// Handle tool calls from MCP client
ws.onmessage = (event) => {
  const msg = JSON.parse(event.data)
  if (msg.type === "callTool") {
    // Execute the tool
    const result = executeMyTool(msg.name, msg.params)

    // Send result back
    ws.send(JSON.stringify({
      type: "toolResult",
      callId: msg.callId,
      result: {
        content: [{ type: "text", text: JSON.stringify(result) }]
      }
    }))
  }
}

3. Connect an MCP Client

VS Code (.vscode/settings.json):

{
  "mcp": {
    "servers": {
      "bridge": {
        "url": "https://mcp-bridge.<subdomain>.workers.dev/mcp"
      }
    }
  }
}

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "bridge": {
      "url": "https://mcp-bridge.<subdomain>.workers.dev/mcp"
    }
  }
}

Protocol

Tool Provider → Bridge (WebSocket)

Register tools:

{
  "type": "registerTools",
  "tools": [
    {
      "name": "tool_name",
      "description": "What it does",
      "inputSchema": { "type": "object", "properties": { ... } }
    }
  ]
}

Unregister tools:

{
  "type": "unregisterTools",
  "names": ["tool_name"]
}

Respond to tool call:

{
  "type": "toolResult",
  "callId": "uuid-from-bridge",
  "result": {
    "content": [{ "type": "text", "text": "result data" }],
    "isError": false
  }
}

Bridge → Tool Provider (WebSocket)

Execute tool:

{
  "type": "callTool",
  "callId": "unique-id",
  "name": "tool_name",
  "params": { "query": "value" }
}

Ping:

{ "type": "ping" }

MCP Client → Bridge (Streamable HTTP)

Standard MCP protocol on /mcp endpoint:

  • POST /mcp — JSON-RPC requests (initialize, tools/list, tools/call)

  • GET /mcp — SSE stream for server-initiated messages

Endpoints

Endpoint

Protocol

Description

/ws/extension

WebSocket

Tool provider connects here

/mcp

Streamable HTTP

MCP client connects here

/health

HTTP GET

Status + registered tools

Example: Browser Extension

See extension-example/ for a Chrome extension that:

  • Detects page context (GitHub, Gmail, Notion, etc.)

  • Registers context-specific tools dynamically

  • Executes tools in the page DOM

  • Auto-upplements tools when navigating

This is just one example — you can build tool providers for anything:

  • Desktop apps (Electron, Tauri)

  • CLI tools

  • Mobile apps

  • IoT devices

  • Other APIs

Development

npm run dev      # Local dev with wrangler
npm run typecheck

Security

For production use, add authentication:

import OAuthProvider from "@cloudflare/workers-oauth-provider"

export default new OAuthProvider({
  apiRoute: "/mcp",
  apiHandler: createMcpHandler(createServer),
  // ... OAuth config
})

License

MIT

F
license - not found
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.

  • Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.

View all MCP Connectors

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/kelvinzer0/mcp-bridge-cf'

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