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:
| Tool | What it does |
|---|---|
lwis_list_captures | The captures sent to this session that are still available (up to 24 hours, or until the session ends). |
lwis_get_capture | One capture's images, gestures and page targets. |
lwis_reply | A 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_capture | Asks 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_ATTACH=1in the MCP server's environment, as in the examples above: every session of that agent is attached from its start.lwis allow <project dir>: every session started in that directory or below is attached.lwis attach <sid>: attach one running session, by the idlwis sessionsshows.
lwis detach <sid> and lwis disallow <dir> undo it. Only attached sessions appear on your devices.
Differences from Claude Code
- No wake-up. Captures wait until the agent calls
lwis_list_captures, so ask it to check ("look at my last lwis capture"). - No slash commands. Approve replies from a terminal:
lwis replies, thenlwis reply-approve <id>orlwis reply-deny <id>. - Strict mode is available from the terminal:
lwis sessions strict <sid> on, orLWIS_STRICT=1in the server's environment. A held capture can be viewed once you runlwis accept <cid>. - There is no
lwis setupfor these agents: you add the server entry yourself.
Check the result with lwis sessions (the agent name appears in the second column) and lwis doctor.