GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(browser): serve the in-app browser's tools from the desktop over client MCP by Hona · Pull Request #59477 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Oct 27, 2026

Copy link
Copy Markdown
Member

Draft to look at the shape of the code. The in-app browser now registers its tools the way James's client MCP does (#57502–#57506): the desktop hosts an MCP server called browser over /api/experimental/client-mcp, and the server has no browser code at all. @opencode/plugin-browser is deleted.

Before / after

flowchart LR
  subgraph Before
    direction LR
    A1[Agent] --> T1[plugin-browser tools<br/>server]
    T1 --> C1[connection.ts<br/>pending map, grants, state copy]
    C1 -- "event: control {requestID}" --> D1[Desktop pane]
    D1 -- "rpc.command(requestID)" --> C1
    D1 -- "rpc.result(outcome)" --> C1
    D1 -- "rpc.state(inventory)" --> C1
    D1 <-- "rpc.tunnel.*" --> C1
  end
  subgraph After
    direction LR
    A2[Agent] --> M2[core MCP<br/>attached client 'browser']
    M2 -- "tools/call + _meta.sessionID" --> D2[Desktop pane]
    D2 -- "result + structuredContent" --> M2
  end
Loading
Before After
Server code packages/plugin-browser (connection, tools, skill, tunnel, proxy, files) none
Wire plugin RPC: attach, state, command, result, tunnel.* + control events one WebSocket, MCP JSON-RPC
Tool schemas Effect Schema on the server same Browser.Operations, exported as JSON Schema by the desktop
Guidance browser skill MCP instructions
Code Mode path tools.browser.tabs.open tools.browser.tabs_open
Model tool name browser_tabs_open browser_tabs_open (same)

The whole desktop side

packages/gui-plugins/src/browser/pane.ts serves one connection per server and directory and routes each call by session:

connectClientMcp({
  url: entry.server.url,
  headers: entry.server.headers,
  name: "browser",
  directory,
  instructions,
  tools: browserTools((sessionID) => {
    const pane = Array.from(served).find((item) => item.sessionID === sessionID)
    return pane && {
      execute: (command, signal) => run(pane, command, signal),
      read: (path, signal) => client.file.read({ path, location: { directory } }, { signal }),
    }
  }),
})

packages/gui-plugins/src/browser/mcp.ts turns Browser.Operations into tools: it decodes the input, runs the page, checks the output against the operation's schema, and returns structuredContent. Screenshots go back as image parts. Other captures go back as resource blobs, which the server saves to a file.

What the SDK and core needed

  • connectClientMcp (packages/client/src/mcp.ts):
    • instructions option.
    • Per-tool outputSchema.
    • structuredContent and resource parts in results.
    • ctx.signal, which aborts on notifications/cancelled or when the socket closes.
  • Mcp.instructions() includes the instructions of the attached client that serves each name, so the browser skill becomes server instructions.
  • McpTool content: textual resources over 32 KiB are saved to a file instead of inlined, so a Lighthouse JSON report or a .cpuprofile does not flood the context.

Behavior changes to decide on

  • Network: pages load on the desktop's network. localhost is the user's machine, not the server. The tunnel/proxy is gone, so a remote server's dev ports are no longer reachable.
  • Tool visibility: tools are scoped to the folder, not the session. Every session in a directory that a desktop pane shows sees browser_*. A session with no pane gets [browser.disconnected]. Before, a deny rule hid the tools until a pane attached to that exact session.
  • Permissions: browser tools use the default MCP action names (browser_<tool>), not the browser action.
  • Screenshots: returned as an image only, with no server-local path.
  • Uploads: paths are relative to the workspace and read through GET /api/fs/read. Absolute server paths are no longer accepted.
  • Error messages: many still say browser.tabs.list({}); Code Mode now uses browser.tabs_list.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

colthreepv reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@Hona
refactor(browser): serve the in-app browser's tools from the desktop …
6922c24
…over client MCP
This was referenced Oct 28, 2026
browser: add an API operation to close tabs #59787
Closed
[FEATURE]: Browser recording and replay for the browser agent #51662
Closed
[FEATURE]: Apply integration policies to client-attached MCP servers #60253
Open
[FEATURE]: Let the browser pane use the desktop's network instead of the connected server's #60476
Open
browser: in-app browser tools are never registered for desktop sessions (opencode.browser active, /api/mcp empty) #60519
Closed
@ryanmeador

ryanmeador commented Nov 1, 2026

Copy link
Copy Markdown

Thanks for working on this! I’m exploring a related browser use case and would appreciate some guidance.

I run OpenCode on a Linux machine and connect through opencode web from several devices, including an Android phone. I’d like the user and agent to share a browser running on that Linux machine, with an interactive viewer inside the web UI. The browser would keep running when I disconnect, and I could reconnect from another device.

Two questions before exploring an implementation:

  • General direction: Does a server-hosted browser with a web viewer fit OpenCode’s intended direction, whether built-in or provided through plugins?
  • This PR: How would this refactor affect that approach? Could a server-hosted implementation reuse the browser tools being developed here, or would a separate MCP integration be the better fit?

I’d be interested in contributing and want to understand how this could complement the desktop browser work.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Nov 1, 2026
📊 AI CLI 工具社区动态日报 2026-11-02 litang9/big_model_radar#640
Open
@opencodejr opencodejr Bot mentioned this pull request Nov 3, 2026
[FEATURE]: session browser tabs should be visible from non-desktop clients (web/iOS) #61326
Open
@colthreepv

colthreepv commented Nov 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Just posting as encouragement. This direction seems fine and avoids proxying, and hopefully keeps everything on desktop app (to be decided, from what I see).

We need a top level browser in OpenCode Desktop.

EDIT:
@ryanmeador
regarding server-hosted browser, https://github.com/anomalyco/browse this came out this week.

Maybe that project was spun up from this PR. Not sure. Plausible?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanmeador

ryanmeador commented Nov 7, 2026

Copy link
Copy Markdown

I hadn't seen that, thank you for the tip. That looks like it will do everything I want, just not quite with the UX I'm looking for: that is a tab in a regular browser, and I was hoping for a tab right in OpenCode itself next to the session transcript, so it's all visually together. I wonder if this browse tool and a remote window viewer (VNC?) embedded in OpenCode might work well together.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@colthreepv

colthreepv commented Nov 7, 2026

Copy link
Copy Markdown

Uhm. I don't think VNC is the way (unless you have specific needs?), just rework the embedding as stated in this PR should come out as more polished and persistent Browser.

As a general rule of thumb, I spent my saturday to look at OpenCode UX / polish, and I think it needs a month of intense hammering to become as smooth as more famous competitors
It's all feasible, keep it up!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jlongster jlongster mentioned this pull request Nov 9, 2026
feat(desktop): keep browser tools across screen lock #62963
Open
@Hona Hona mentioned this pull request Nov 12, 2026
fix(browser): keep a configured browser deny when the desktop attaches #63614
Closed
@opencodejr opencodejr Bot mentioned this pull request Nov 13, 2026
[FEATURE]: client-attached MCP: what a GUI client still needs to serve its tools to a running server #63642
Open
1 task done
@Hona Hona mentioned this pull request Nov 13, 2026
feat(desktop): signed-in browser pane with extensions, previews, prompts and agent safeguards #63002
Merged
@opencodejr opencodejr Bot mentioned this pull request Nov 26, 2026
[FEATURE]: Optional tabbed browser companion for terminal sessions #66606
Closed
1 task done
@github-actions

github-actions Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Nov 27, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@thdxr thdxr Awaiting requested review from thdxr thdxr will be requested when the pull request is marked ready for review thdxr is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Hona @ryanmeador @colthreepv
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.