Skip to main content
Glama

opencode-remote-mcp

Zero-dependency StreamableHTTP MCP bridge that lets you drive your local OpenCode instance from Gemini Web, Gemini Mobile, or any remote MCP client.

Gemini Web / Mobile (https://.../mcp/<secret>)
        │
        ▼  HTTPS (OpenTunnel persistent blind-TLS / Cloudflare / Tailscale)
opencode-remote-mcp (127.0.0.1:49390)
  ├── repo_status / repo_read / repo_search / repo_diff   (fast read-only, sandboxed to --root)
  └── opencode_sessions / opencode_dispatch / opencode_poll / opencode_interrupt
        │
        ▼  Local OpenCode HTTP API (127.0.0.1:49374)
OpenCode (edits, shell, tests, skills — also visible live in OpenCode Desktop)

Quickstart (Gemini Web)

  1. Make sure OpenCode is running locally (opencode serve or OpenCode Desktop) and Bun is installed.

  2. Start the bridge pointing at your projects folder (not published to npm yet, so run via GitHub):

    bunx github:system1970/opencode-remote-mcp --root ~/Projects

    Or from a local checkout:

    bun run src/cli.ts --root ~/Projects

    Optionally pin a workhorse model:

    bunx opencode-remote-mcp --root ~/Projects --model opencode-go/muse-spark-1.3-contributor
  3. Connect in Gemini Web:

    • Open https://gemini.google.com/devmode (or Settings → Connected Apps → Add a custom app).

    • Paste the printed https://...opentunnel.xyz/mcp/<secret> (or trycloudflare.com) URL.

    • Leave OAuth Client ID and Client secret empty and click Next → Connect.

    • With OpenTunnel (--tunnel auto, the default when opentunnel is installed), both the subdomain and your /mcp/<secret> are persisted across restarts — so you only need to paste the URL into Gemini once.

Related MCP server: opencode-mcp

Tools Exposed

Tool

Mode

Purpose

repo_status

Read-only

List allowed repos, git branch, status, and diff stat

repo_read

Read-only

Line-numbered file read (capped at 400 lines / 24 KB)

repo_search

Read-only

rg search (with git grep fallback)

repo_diff

Read-only

Inspect working-tree or staged git diff

opencode_sessions

Read-only

List OpenCode projects and recent/active sessions

opencode_poll

Read-only

Check session status (running / completed / needs_permission), reply, and diff

opencode_dispatch

Action

Start or continue an OpenCode session (waits ~25s, then returns running + session_id to avoid HTTP timeouts)

opencode_interrupt

Action

Abort a running OpenCode session

CLI Options

Flag

Env Var

Default

Description

-r, --root <dir>

OPENCODE_MCP_ROOTS

cwd

Allowed workspace root (repeatable)

-m, --model <provider/id>

OPENCODE_MODEL

OpenCode default

Default model for new sessions

--opencode-url <url>

OPENCODE_URL

http://127.0.0.1:49374

Local OpenCode server URL

--opencode-password <pw>

OPENCODE_PASSWORD

~/.config/opencode/service.json

OpenCode Basic auth password

-p, --port <n>

PORT

49390

Local HTTP port

--secret <token>

MCP_SECRET

Persisted in ~/.config/opencode-remote-mcp/secret

URL path secret (/mcp/<secret>)

--ephemeral-secret

—

false

Use a one-time random secret without saving to disk

--bearer <token>

MCP_BEARER_TOKEN

—

Optional Authorization: Bearer check

--tunnel <auto|opentunnel|cloudflare|none>

MCP_TUNNEL

auto

Auto-prefers opentunnel (persistent blind-TLS), falls back to cloudflare

--route-name <name>

OPENTUNNEL_ROUTE_NAME

—

Optional OpenTunnel subdomain name

--no-tunnel

—

false

Disable tunnel (bring your own HTTPS reverse proxy)

--read-only

MCP_READ_ONLY

false

Disable opencode_dispatch and opencode_interrupt

Permanent URL (Optional)

If you want a permanent URL across Gemini Web and Mobile without re-pasting on restart, pass --no-tunnel --secret <your-fixed-secret> and point a Named Cloudflare Tunnel or Tailscale Funnel at http://127.0.0.1:49390.

Security Model

  • Binds strictly to 127.0.0.1; public exposure exists only while the process is running.

  • Requires a 256-bit secret URL path (/mcp/<secret>) compared in constant time; all other paths return 404.

  • All repo_* tools enforce realpath containment within --root (blocking .. and symlink escapes).

  • Built-in MCP instructions tell the model never to git push unless explicitly asked.

License

MIT


Part of the agent-webmcp ecosystem — see orkestrate.space for more.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Coordinate and verify OpenCode worker agents over MCP Streamable HTTP. The bridge lets compatible AI harnesses dispatch scoped work, inspect progress, run approved commands, and verify results through a safe worker-only endpoint.
      4
      PolyForm Noncommercial 1.0.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Connects MCP clients such as Claude, Cursor, and VS Code to OpenCode's headless API so users can delegate coding work — asking questions, implementing features, monitoring background jobs, answering prompts and permission requests, and reviewing changes across multiple projects. Supports synchronous runs, asynchronous jobs with polling and recovery, multi-project directory scoping, and configurable server authentication and tool profiles.
      22,181 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Connects MCP clients such as Claude, Cursor, and VS Code to an OpenCode server's headless API so coding work can be delegated, answered, and monitored. It supports asking questions, launching foreground or background jobs, supplying required input and permissions, and reviewing resulting changes across projects.
      22,181 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Connects MCP clients such as Claude, Cursor, and VS Code to OpenCode's headless API so they can delegate coding work across projects — asking questions, implementing features, launching and monitoring background jobs, responding to permission and input requests, and reviewing the resulting changes. It supports multi-project directories, configurable default provider/model pairs, and both synchronous and asynchronous task workflows.
      22,181 npm
      MIT