lwis docs

Agents / Codex, opencode and other agents

Codex, opencode and other agents

Any agent that can run a stdio MCP server can pull your captures with lwis mcp. It asks for captures when it needs them; nothing starts a turn by itself.

How it works

lwis mcp --agent <name> is a stdio MCP server. When the agent starts it, it registers a session with lwisd under that name (shown on your devices, at most 16 characters; default mcp). Like a Claude Code session, it is unattached until you attach it.

The agent then gets these tools:

ToolWhat it does
lwis_list_capturesThe captures sent to this session that are still available (up to 24 hours, or until the session ends).
lwis_get_captureOne capture's images, gestures and page targets.
lwis_replyA plain-text reply to the device (at most 1000 characters; to an agent pairing's report, up to 8000 and one file from the session's directory), which waits for your approval.
lwis_request_captureAsks you to take a capture on a paired device.

The server never starts lwisd. Keep it running with lwis install-service --enable.

Codex

Add a server to ~/.codex/config.toml:

[mcp_servers.lwis]
command = "lwis"
args = ["mcp", "--agent", "codex"]
env = { LWIS_ATTACH = "1" }

opencode

Add a server to your opencode.json:

{
  "mcp": {
    "lwis": {
      "type": "local",
      "command": ["lwis", "mcp", "--agent", "opencode"],
      "environment": { "LWIS_ATTACH": "1" }
    }
  }
}

Other MCP agents

Use the same entry in the agent's own format: command lwis, arguments mcp --agent <name>. If the agent doesn't inherit your shell's PATH, give the absolute path to lwis.

Attach the session

Pick one:

lwis detach <sid> and lwis disallow <dir> undo it. Only attached sessions appear on your devices.

Differences from Claude Code

Check the result with lwis sessions (the agent name appears in the second column) and lwis doctor.