Repository navigation
feat(tui): expose open_terminal over client MCP (experimental) - #57506
Merged
Merged
Conversation
This was referenced Oct 20, 2026
jlongster
force-pushed
the
client-mcp-endpoint
branch
from
October 20, 2026 19:29
de29b40 to
fc76153
Compare
jlongster
force-pushed
the
client-mcp-tui
branch
from
October 20, 2026 19:30
124aeec to
78bcc34
Compare
jlongster
force-pushed
the
client-mcp-endpoint
branch
from
October 20, 2026 19:37
fc76153 to
3a3cf4b
Compare
jlongster
force-pushed
the
client-mcp-tui
branch
from
October 20, 2026 19:37
78bcc34 to
d462594
Compare
jlongster
force-pushed
the
client-mcp-endpoint
branch
2 times, most recently
from
October 22, 2026 19:39
5c13f0f to
2ed5e8b
Compare
…MCP to viewed location
jlongster
force-pushed
the
client-mcp-tui
branch
from
October 22, 2026 19:59
3b3727f to
1ffbd38
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stack 5/5, based on
client-mcp-endpoint. Merge in order.Part of the client MCP stack (experimental): a client (TUI/desktop/web) opens a WebSocket to the server, and the server treats that incoming socket as an internal MCP server scoped to a location. Tool calls carry
_meta["ai.opencode/sessionID"]so the client acts on the calling session. MCP has no official WebSocket transport, so this is a custom transport, which the spec allows.This PR
The TUI connects as client MCP server
tui(behind theclient-mcpexperiment, off by default) and exposesopen_terminalandwrite_terminal.write_terminal({ text })typestextas-is into the same terminalopen_terminalwould use (selected, else newest, else a new one); no newline is appended, so include\nto run a command. Input written before the pane attaches is queued and sent once it does<ClientMcp />; reconnects when the endpoint, credentials or directory changeTests run the real TUI against a fake WebSocket peer (connection count, flag off, errors, create/reuse, no focus, written input reaches the PTY).
Two TUIs in the same directory both stay connected as
tui: the most recently attached one serves the tools, and the earlier one takes over when it closes (connection stacking, #57503), so they don't keep replacing each other and reconnecting.Stack
→ 5. feat(tui): expose open_terminal over client MCP (experimental) #57506 feat(tui): expose open_terminal over client MCP (experimental)