OpenCode browser MCP

Give OpenCode a browser that stays open.

Local MCP endpoint

http://127.0.0.1:47812/mcp

Start Hronaut once and leave it running. OpenCode can restart or switch projects without owning the browser. The endpoint listens on loopback; it is not a hosted browser.

Why Hronaut

The browser belongs to you, not the session.

Persistent sessions are not unique to Hronaut. Choose it when you want a separate desktop browser with durable state, visible human control, and named workspaces that stay available as coding-agent clients change. See how task, MCP transport, and browser lifetimes differ →

  • Restart the agent, keep the session. Hronaut owns Chromium and its profile. Closing an OpenCode session does not intentionally close the browser or discard its local state.
  • See, pause and take over. Watch each action, pause MCP before a sensitive step, sign in yourself, then let the agent continue in the same session.
  • Keep project accounts separate. Each named workspace has its own cookies and site storage. Use a clean workspace per task; reopening one needs its private resume key.
  • Browser data stays on this device. Hronaut is a local Electron/Chromium app with a loopback endpoint. It is not a hosted browser, proxy, CAPTCHA service or multi-browser CI runner.

Need something else? To let trusted code drive selected tabs in your everyday Chromium browser, OpenCode's Browser Control uses an extension and a local relay. For ephemeral multi-browser CI, use a Playwright-managed workflow. Compare ownership models →

Step 1 · Connect

Connect OpenCode.

OpenCode documents separate stable and V2 configuration shapes. Use the one that matches your installed version, and save it globally in ~/.config/opencode/opencode.json or in opencode.json at a project root.

OpenCode stable

mcp.hronaut

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "hronaut": {
      "type": "remote",
      "url": "http://127.0.0.1:47812/mcp",
      "enabled": true,
      "oauth": false,
      "headers": {
        "Authorization": "Bearer {file:/path/from-hronaut-home}"
      }
    }
  }
}

OpenCode stable MCP documentation ↗

OpenCode V2

mcp.servers.hronaut

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "hronaut": {
        "type": "remote",
        "url": "http://127.0.0.1:47812/mcp",
        "oauth": false,
        "headers": {
          "Authorization": "Bearer {file:/path/from-hronaut-home}"
        }
      }
    }
  }
}

V2 connects configured servers unless disabled is true. OpenCode V2 MCP documentation ↗

Authentication on (default)

Copy the setup from Hronaut Home

A new Hronaut profile requires the MCP token. Both examples read it from the owner-only token file with OpenCode's {file:...} substitution, so the token never appears in opencode.json. Copy the setup from Hronaut Home, which fills in the file's path, and keep that file out of chat, screenshots, issues and source control.

Turned authentication off?

Use this only with a profile whose Require MCP authentication is off, such as one from before Hronaut 3.5 that kept that setting. While authentication is on, Hronaut rejects a connection without the token.

OpenCode stable · authentication off

mcp.hronaut

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "hronaut": {
      "type": "remote",
      "url": "http://127.0.0.1:47812/mcp",
      "enabled": true,
      "oauth": false
    }
  }
}

OpenCode V2 · authentication off

mcp.servers.hronaut

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "hronaut": {
        "type": "remote",
        "url": "http://127.0.0.1:47812/mcp",
        "oauth": false
      }
    }
  }
}

Why a remote entry? OpenCode connects to the already-running local Streamable HTTP server. “Remote” describes the transport shape, not an internet-hosted service.

Step 2 · Verify

Check that it works.

Use a clean workspace for this check, before OpenCode goes near a signed-in page.

  1. 1

    OpenCode sees Hronaut

    Start Hronaut, restart or refresh OpenCode, then run opencode mcp list. Hronaut should appear connected. If it does not, run opencode mcp debug hronaut, check that Hronaut Home reports MCP online, and make sure the configured port matches the current endpoint.

  2. 2

    Hronaut sees OpenCode

    Open Hronaut Home. OpenCode should appear under Connections.

  3. 3

    Run a first browser task

    Ask: “Create a Hronaut workspace named first-check, open https://example.com inside it, and tell me the page title and workspace ID. Start with clean scratch storage.”

    Expected result: a visible first-check workspace opens Example Domain, and OpenCode reports its workspace ID.

Security

Protect your signed-in sessions.

Keep authentication on. A new Hronaut profile requires the owner token for MCP, so other processes running as your user cannot drive the browser. A profile from before Hronaut 3.5 keeps the setting it saved: if Require MCP authentication is off in Settings → MCP security, turn it on before you use valuable sign-ins and copy the token-aware OpenCode setup from Hronaut Home.

Take over for human-only steps. A signed-in browser carries the authority of every site in its profile. Pause MCP before you enter passwords, security keys, payment details or other human-only information.

Keep going

Next steps.

Give every durable browser job its own named workspace. Then learn how to hand off a login safely or run several agents side by side.

Sources

Hronaut is an independent project and is not affiliated with or endorsed by the OpenCode team.