Skip to main content
Glama

webmcp-gate

hon2be/webmcp-gate MCP server

Let an agent use the tools of a web app you are logged in to, safely.

A small local relay connects your page to Claude Code, Codex or any MCP agent. Risky actions are approved by a person in the page, not by the agent. No browser extension. 한국어

agent ──(MCP · stdio)──▶ relay ◀──(WebSocket · 127.0.0.1)── your logged-in tab
                                                            runs the tools, asks you to approve

Experimental (0.1.0-alpha.0). Tried on macOS in headless Chrome, with a live Codex session and a live Claude Code session (read-only calls). Not tried on a production app or other browsers. What was checked

Why this one

  • A pairing code per session, never sent: both sides only prove they know it.

  • Allowed origins are listed one by one. No wildcard, nothing to switch off.

  • A person approves risky actions in the page, and the relay re-checks the call afterwards.

  • Thousands of tools? The agent gets search, describe, read and call.

  • Your own MCP tools with registerTool in a config file.

Related MCP server: WebMCP

Try it

git clone https://github.com/hon2be/webmcp-gate && cd webmcp-gate
npm install && npm run build
node examples/serve.mjs 01-hello        # the page, on http://localhost:3000

In another terminal:

cd examples/01-hello/server
node ../../../plugins/claude/dist/cli.mjs trust   # approve the example config
claude --plugin-dir ../../../plugins/claude

Ask "show the webmcp-gate status", paste the wgate1.… string into the page, press Connect, then ask the agent to read demo.echo. For the approval dialog, try examples/02-approval.

Install the plugin

# Claude Code
/plugin marketplace add hon2be/webmcp-gate
/plugin install webmcp-gate@webmcp-gate

# Codex
codex plugin marketplace add hon2be/webmcp-gate
codex plugin add webmcp-gate@webmcp-gate

Or run npx -y @webmcp-gate/server@next install claude (codex, all). Node 20+ is enough.

Use it in your app

npm i @webmcp-gate/client@next
import { connectBridge } from "@webmcp-gate/client";

const host = connectBridge({ connection });   // the string the agent's `status` tool shows
await host.registerTool({
    name: "app.items.list",
    description: "Lists items",
    annotations: { readOnlyHint: true },       // read-only tools run with `read`
    execute: async () => ({ ok: true, result: [] }),
});

More in docs/integrating.md. The wire protocol is documented (docs/protocol.md), so you can write your own client.

Packages: @webmcp-gate/client (your page), @webmcp-gate/server (relay and CLI), @webmcp-gate/protocol (shared types). All are 0.1.0-alpha.0, so install them with @next.

Config

Put webmcp-gate.config.ts in your project, like vite.config.ts. webmcp-gate init creates one.

import type { Config } from "@webmcp-gate/server";

export default {
    origins: ["http://localhost:3000"],
    tools(server, bridge, z) {              // your own MCP tools
        server.registerTool("list_menus", { description: "Lists menus", inputSchema: { keyword: z.string().optional() } },
            async ({ keyword }) => ({ content: [{ type: "text", text: JSON.stringify(await bridge.call("app.menu.list", { keyword })) }] }));
    },
} satisfies Config;

A config is code, so it runs only after you approve it with webmcp-gate trust. Agents cannot approve it. All fields are in docs/config.md.

What the agent sees

Tool

Does

status

State and the connection string

search

Finds page tools

describe

One tool's input shape

read

Runs a read-only page tool

call

Runs any other page tool

attach_file

Optional. Attaches a file from the one folder you allow

Safety

  • Listens on 127.0.0.1 only. Only the origins you list can connect.

  • A 20-character pairing code per session (about 100 bits). Wrong tries are rate-limited.

  • Approval stays in the page. The relay re-checks the call after you approve.

  • One tab at a time.

  • attach_file is off unless you set a folder, and it stays inside it.

  • A config runs only after trust, as a single file.

Details and limits: docs/security.md.

More

What was checked · Related projects · Roadmap · Architecture · Plugins · Privacy

Develop

npm install
npm test        # typecheck, build, end-to-end tests

plugins/*/dist/cli.mjs is committed (twice) because a plugin runs alone from its folder. After changing source, run npm run build and commit the result.

MIT licensed.

If this project is useful to you, starring the repository helps other people find it.

Available Tools

5 tools
callB
Destructive

Runs a tab tool by name. This includes clicking, saving, deleting and deploying. The page may ask the user to approve.

Inputs: name (required), input.

describeB
Read-only

Shows one tab tool's description and input shape.

Inputs: name (required).

readA
Read-only

Runs a read-only tab tool. Put the tab tool's name in name. Use call for tools that change things.

Inputs: name (required), input.

statusA
Read-only

Shows whether a tab is connected, and the connection string to paste into the page to connect.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool has a clear primary role: status for connection, search for discovery, describe for inspection, read and call for execution. The only overlap is read vs. call, since read is a restricted subset of call, but the descriptions explicitly say to use call for anything that changes state, which resolves most confusion.

    Naming Consistency4/5

    All names are short, lowercase, single-word and prefix-free, giving a predictable vocabulary. The only minor deviation is that status is a noun while the others are verbs (search, describe, read, call), but the set still reads as a coherent convention.

    Tool Count5/5

    Five tools is exactly right for a gateway: connect, discover, inspect, execute-read, execute-write. Each tool earns its place with no redundant surface area.

    Completeness4/5

    The lifecycle of discovering and invoking tab tools is fully covered, including a safety split between read-only and mutating execution. Minor gaps exist, such as no explicit disconnect/reset operation or a way to enumerate all tools without a query, but agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that runs in the browser, letting web pages register custom tools and prompts and expose them to an MCP client over WebSocket. Enables agents to drive UI, call page-scoped APIs, and get human-in-the-loop confirmation.
      11 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables browser-based AI chat interfaces to use local MCP tools by injecting a tool-call protocol into the page and executing approved filesystem, shell, and downstream MCP tool calls from a local daemon.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Exposes an OAuth-gated MCP endpoint with 38 governed tools that let web-based AI chat clients read and edit local files, run whitelisted shell commands, search, use Git and SQLite, fetch localhost/intranet APIs, automate Chromium and DevTools, and manage background tasks, ports, clipboard, notifications, and Postman. Local IDEs can connect directly over 127.0.0.1, while remote clients reach the same machine through a secure public ingress.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Exposes a governed suite of 38 OAuth-gated tools over one MCP endpoint, letting web-based AI chat clients read and edit files, run whitelisted shell commands, search, and use Git, SQLite, browser automation, DevTools, background tasks, ports, clipboard, notifications, and localhost services on the user's own machine. It also allows local IDEs and automation tools to connect directly over localhost for offline, low-latency access.
      MIT