theseus/bundled-addons/claude-connector/README.md
Dev a920737c3c Claude connector 0.2.0: connect Claude Code and Claude Desktop from the panel
Setting the connector up meant copying a command with a token into a
terminal, and since 0.3.107 the token rotates whenever the connector
stops, so a configured client silently lost access after any extension
toggle and had to be set up again.

The panel now has a Connect button per app. Claude Code is registered
through its own CLI (claude mcp add-json, user scope), so its config is
written by Claude Code itself; Claude Desktop gets only the theseus entry
in claude_desktop_config.json, with a backup and no write to a file that
does not parse. Apps connected this way are re-registered after every
start and every Revoke when the address or token no longer matches. The
panel opens by itself the first time the extension is turned on. The
copy-a-command route stays under "Set up by hand".
2026-10-24 00:32:06 +03:00

28 lines
1.7 KiB
Markdown

# 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/clients.cjs` | "Connect": registers the connector with Claude Code (its CLI, user scope) and Claude Desktop (its config file), reports status, re-registers after token/port changes |
| `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).