theseus/bundled-addons/claude-connector/README.md
Dev c06557e957 Theseus: Claude connector, an opt-in MCP server for the signed-in profile
Claude sessions could not work inside the user's own profile: the desktop
app's browser lost synthetic pastes and typing in Medium's editor, and a
browser-wide --remote-debugging-port would hand every session to any local
process. The connector is a built-in extension, off until turned on in
Settings > Extensions, that serves MCP on 127.0.0.1 behind a per-install
token and drives one tab at a time through that tab's webContents.debugger.

- Host: a "tab-control" capability (built-in add-ons only) for listing,
  opening, navigating, closing and focusing tabs, handing out web tabs'
  webContents (never Settings, extension or home tabs), and a toolbar chip
  plus tab outline while a client is connected; the chip's X stops it.
  Built-in add-ons can ship "defaultEnabled": false.
- Tools: list_tabs, open_tab, navigate, activate_tab, close_tab, screenshot,
  read_page_text, snapshot (accessibility tree with refs), click, type
  (insertText + real Enter), press_key, paste_html / paste_text (system
  clipboard + webContents.paste, clipboard restored), upload_file
  (DOM.setFileInputFiles), wait_for, and evaluate behind its own switch.
- Safety: first use of each site asks the user; password and one-time-code
  fields are refused; uploads only from folders the user added; requests
  from web pages or foreign Host headers are refused; every action is
  logged with a timestamp in the panel and actions.log.
- Claude Desktop runs stdio-shim.cjs through the Theseus executable in Node
  mode.
- Tests: unit (protocol, auth, policy, shim) and an end-to-end run on a
  throwaway profile that types, pastes HTML with a heading and a link, and
  uploads a PNG on a local page.
2026-10-23 17:45:02 +03:00

1.5 KiB

Claude connector

Built-in Theseus extension: a local MCP server through which Claude Code or Claude Desktop works in the user's tabs. Setup and safety model are in the Theseus README ("Claude connector (MCP)") and DESIGN-claude-connector.md.

file role
index.js activation, settings (add-on store), server start/stop, panel messages
lib/mcp-server.cjs Streamable HTTP + JSON-RPC, token, Host/Origin guards, sessions, SSE presence
lib/tools.cjs tool definitions and handlers; resolves tabs through api.tabControl
lib/tab-driver.cjs one tab over its own webContents.debugger (CDP 1.3)
lib/policy.cjs site approvals, upload-folder checks, password-field detection
lib/clipboard.cjs put / save / restore the system clipboard around a paste
lib/action-log.cjs timestamped action log (panel + actions.log)
panel.html the sidebar panel
stdio-shim.cjs stdio ⇄ HTTP relay for Claude Desktop, run by Theseus in Node mode

Stored in <userData>/extensions-data/claude-connector.json (token, port, switches, approved origins, upload folders) and <userData>/extensions-data/claude-connector/ (endpoint.json while listening, actions.log).

Needs the host's tab-control capability, which only built-in add-ons get. Turning any extension on or off restarts every add-on, this one included, which ends the connected clients' sessions. A client that does not start a new session by itself reconnects from its MCP menu (/mcp in Claude Code).