[READ-ONLY] Mirror of https://github.com/mayask/pi-mcp-bridge. Minimal Pi extension that bridges HTTP MCP tools into Pi tools.
README.md

pi-mcp-bridge #

Minimal Pi extension that bridges HTTP MCP tools into Pi tools.

It is Playwright-first by default, but the config shape leaves room for more HTTP MCP servers later.

Install locally #

cd ~/src/pi-mcp-bridge
npm install

Run Pi with the extension:

pi -e ~/src/pi-mcp-bridge

Or add it to ~/.pi/agent/settings.json:

{
  "extensions": ["~/src/pi-mcp-bridge"]
}

Default behavior #

If no config file exists, the extension connects to the local Playwright MCP server:

http://localhost:8931/mcp

and registers Playwright tools with the pw_ prefix, for example:

pw_browser_navigate
pw_browser_snapshot
pw_browser_click

browser_run_code_unsafe is disabled by default.

Playwright with the backend repo #

Starting the Playwright MCP server #

Use the Docker Compose service from your backend repo, or run Playwright MCP directly:

docker compose -f /path/to/docker-compose.yml --profile mcp up -d

Then open Chrome with remote debugging:

google-chrome \
  --remote-debugging-address=0.0.0.0 \
  --remote-debugging-port=9222 \
  --user-data-dir=~/.cache/playwright-mcp-chrome

Start Pi with the bridge:

pi -e ~/src/pi-mcp-bridge

Optional config #

Create ~/.pi/agent/mcp-bridge.json only if you want to override the defaults or add more HTTP MCP servers.

{
  "servers": [
    {
      "name": "playwright",
      "url": "http://localhost:8931/mcp",
      "toolPrefix": "pw",
      "disabledTools": ["browser_run_code_unsafe"],
      "requestTimeoutMs": 120000
    }
  ]
}

You can point at another config with:

PI_MCP_BRIDGE_CONFIG=/path/to/mcp-bridge.json pi -e ~/src/pi-mcp-bridge

Server fields #

type Server = {
  name: string
  url: string
  toolPrefix?: string
  headers?: Record<string, string>
  allowedTools?: string[]
  disabledTools?: string[]
  confirmTools?: string[]
  requestTimeoutMs?: number
}

allowedTools, disabledTools, and confirmTools accept * globs against the original MCP tool name.

Commands #

Inside Pi:

  • /mcp-bridge-status — show connection and registered tool status
  • /mcp-bridge-reload — reconnect and register tools again

Pi cannot unregister tools dynamically. If a reload removes a tool, it may stay visible until Pi restarts, but calling it will fail.

Safety notes #

MCP tools can be powerful. For Playwright, keep browser_run_code_unsafe disabled unless you explicitly trust the MCP server and agent session.