Skip to main content
The cmux socket API is a JSON-RPC protocol over a Unix domain socket. It provides programmatic control over cmux without spawning CLI subprocesses.

Connection

Socket path

Default socket locations:
  • Production: /tmp/cmux.sock
  • Debug build: /tmp/cmux-debug.sock
  • Nightly: /tmp/cmux-nightly.sock
  • Staging: /tmp/cmux-staging.sock
Override via CMUX_SOCKET_PATH environment variable.

Security

Socket permissions: 0600 (owner-only) in all modes except allowAll. Socket ownership validation: The socket must be owned by the current user. Connection attempts to sockets owned by other users are rejected to prevent fake-socket attacks.

Authentication

Depending on the configured socket mode:
  1. Off: Socket not available
  2. cmux processes only (default): Only processes with cmux ancestry can connect
  3. Automation mode: Any local process from the same macOS user
  4. Password mode: Requires password authentication via auth command
  5. Full open access: Any local process (unsafe)
Password authentication: If password mode is enabled, send an auth command before any other requests:
Password sources (in order of precedence):
  1. --password CLI flag
  2. CMUX_SOCKET_PASSWORD environment variable
  3. Password file: ~/Library/Application Support/cmux/socket-control-password
Example:

Protocol

V2 JSON-RPC format

All modern commands use JSON-RPC requests and responses. Request:
Success response:
Error response:

V1 legacy format

Older commands use plain text requests:
Responses:
  • Success: OK or data
  • Error: ERROR: <message>
New integrations should use V2 methods. V1 commands are maintained for backward compatibility.

System methods

system.capabilities

Get supported API capabilities:

system.identify

Get current context information:
Response:

Window methods

window.list

List all windows:

window.current

Get current window:

window.focus

Focus a window:

Workspace methods

workspace.list

List workspaces:
Response:

workspace.create

Create a new workspace:
Response:

workspace.current

Get current workspace:

workspace.select

Switch to a workspace:

workspace.close

Close a workspace:

workspace.rename

Rename a workspace:

workspace.move_to_window

Move workspace to another window:

workspace.reorder

Reorder workspace position:

workspace.action

Perform workspace action:

Pane methods

pane.list

List panes in a workspace:

pane.create

Create a new pane:

pane.focus

Focus a pane:

pane.surfaces

List surfaces in a pane:

Surface methods

surface.list

List surfaces in a workspace:

surface.create

Create a new surface in a pane:

surface.split

Create a split from a surface:

surface.close

Close a surface:

surface.focus

Focus a surface:

surface.move

Move a surface:

surface.reorder

Reorder surface within pane:

surface.read_text

Read terminal screen content:
Response:

surface.send_text

Send text to terminal:

surface.send_key

Send key to terminal:

surface.trigger_flash

Flash surface visually:

surface.health

Check surface health status:

Tab methods

tab.action

Perform tab action:

Browser methods

All browser methods require a surface_id parameter identifying the browser surface.

browser.open_split

Open URL in new browser split:

browser.navigate

Navigate to URL:

browser.back / browser.forward / browser.reload

Browser navigation:

browser.url.get

Get current URL:
Response:

browser.snapshot

Capture page accessibility tree:
Response:

browser.eval

Execute JavaScript:
Response:

browser.wait

Wait for page conditions:

browser.click / browser.hover / browser.focus

Interact with elements:

browser.type

Type text into element:

browser.fill

Fill input (clears first):

browser.press

Press keyboard key:

browser.select

Select dropdown option:

browser.get.*

Extract element data:

browser.is.*

Check element state:

browser.find.*

Find elements by locator:

browser.screenshot

Capture screenshot:
Response:

browser.focus_webview

Focus the browser webview:

browser.is_webview_focused

Check if webview is focused:
Response:

Example client (Python)

Error codes

Common error codes in error responses:
  • error: Generic error
  • invalid_params: Invalid or missing parameters
  • not_found: Resource not found
  • unauthorized: Authentication required or failed
  • timeout: Operation timed out
  • internal_error: Internal server error