Skip to content

Feature Request: Connect TUI to Existing opencode serve Instance #878

Closed

Description

@heymaaz

Currently, running opencode serve starts the server on a specified port (e.g., 127.0.0.1:4096). However, there does not appear to be a way to connect the TUI to this running server instance. This would be useful for scenarios where I want to access logs or manage the server process separately.

Proposed Solution:
It would be helpful to support a command such as:

opencode --server 127.0.0.1:4096

or have opencode automatically connect to an existing local server if one is running, rather than starting a new instance.

Use Case:
This feature would allow users to:

  • Run the server in headless mode (e.g., for logging or remote access)
  • Connect multiple TUI clients to the same server instance
  • Separate server and client processes for better control and observability

Request:
Is there currently a way to connect the TUI to an existing opencode serve instance? If not, could support for this workflow be added?

Thank you for your consideration!

Activity

  1. thdxr commented on Jul 12, 2025

    @thdxr
    Member

    i believe you can run the TUI on its own with the right env variables - you can check tui.ts to see how we spawn it

  2. thdxr commented on Jul 12, 2025

    @thdxr
    Member

    but yes maybe this should be built in

  3. self-assigned this
    on Jul 12, 2025
  4. pigmej commented on Sep 16, 2025

    @pigmej

    I did some "quick & dirty" implementation in #2635
    No idea if there are some assumptions from TUI side about the host.

  5. thdxr commented on Sep 17, 2025

    @thdxr
    Member

    added opencode attach <url>

  6. added a commit that references this issue on Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions