Duet Bridge is a custom MCP connector designed to solve the problem that Claude Duet cannot directly access the local computer. Duet runs in the Anthropic cloud and cannot reach the user's computer, and the user's computer should not open ports to the internet either. Duet Bridge acts as an intermediary switch: both sides actively make outbound calls to it, and it connects them to each other. The user's computer only makes outbound calls, and nothing on the internet can call it.
Main capabilities:
- Duet can converse with already-open Claude Code windows. Start the window with duet-code instead of claude, and Duet sees it in list_sessions; messages appear in the window within seconds, and the window replies to Duet through the send_to_duet tool.
- Duet can start new Claude Code sessions. start_session launches a background conversation on Mac, with each Duet message being one turn; Claude Code remembers previous turns, and Duet continues via send_message.
- View Duet's sessions in the agent view. Each session runs as a Claude Code background session named duet: <name> (claude --bg), stays idle between turns, and can be attached at any time. The runner closes and removes it after Duet ends the session or after bg_idle_hours (default 8 hours) with no turns. This process consumes no tokens; a quiet session retains the conversation, and the next Duet message can continue it.
- Show sessions on screen. open_on_mac opens a background session in a terminal window (macOS prefers Ghostty, otherwise Terminal; Windows prefers Windows Terminal, otherwise PowerShell console) so it can be read and taken over. The window then becomes a live session. The tool keeps the same name on both platforms, so one connector works everywhere.
- Wait for answers. send_message, start_session, and read_messages accept wait_seconds (up to 45), and the call returns immediately once Claude Code answers.
- Get messages from Claude Code first. read_messages without a session Collect everything Claude Code sends.
What Claude Code can do:
- In a duet-code window: send_to_duet replies to Duet or conveys information; set_focus tells the Duet window what is being worked on. Duet cannot see terminal text, so the Stop hook sends it back once when the window only replies to Duet in the terminal.
- From any script: mac/duet-bridge.py tell --text "..." leaves a message for Duet.
Limitation: Claude Code cannot wake Duet. Duet reads messages when the user talks to it or during its own background checks.
The thirteen tools Duet gets: the materials do not list them one by one; they only state that Duet can read email, and a carefully crafted email might try to get Duet to send work to Claude Code. Therefore the work mode's denial rules are a guard rather than a wall: work sessions have a real shell. It is recommended to test the limits on your own Mac with a canary request (for example, ask a read-only session to run touch /tmp/canary, then check that the file does not exist).
Setup (one-time): Requirements: Claude Code logged in, Node.js 20 or higher, Python 3.11 or higher, a free Cloudflare account, and a claude.ai plan that supports Claude Duet and custom connectors. Both macOS and Windows 10/11 work. On Windows, if open_on_mac needs to provide a suitable window for the session, Windows Terminal must also be installed, and the steps must be run in PowerShell 7 (pwsh).
macOS steps:
- Clone the repository and log in to Cloudflare: cd claude-duet-bridge/worker && npm install && npx wrangler login
- Run ./setup.sh. It generates two secrets in the home folder (~/.duet-bridge-token and ~/.duet-bridge-passphrase), deploys the Worker, writes the URL to mac/config.toml,and prints the connector URL.
- Edit mac/config.toml. Set the folder for each workspace, as well as the read-only MCP servers that read-only sessions can use. If you add a workspace name, you also need to add it to WORKSPACES in worker/wrangler.jsonc and run npx wrangler deploy.
- In claude.ai, open Settings > Connectors > Add custom connector. Name it Duet Bridge and paste the URL ending in /mcp.
- Click Connect. On the login page, paste the passphrase (pbcopy < ~/.duet-bridge-passphrase copies it).
- Run mac/install.sh. It starts the Mac runner via launchd and links duet-code to ~/.local/bin.
- Use duet-code to open a window. On the warning screen about the development channel, select I am using this for local development. Then tell Duet: "List my Claude Code sessions and say hello to the live one."
Windows steps:
- Clone the repository and log in to Cloudflare: cd claude-duet-bridge\worker && npm install && npx wrangler login
- Run ..\windows\setup.ps1. It generates two secrets in the user folder (~.duet-bridge-token and ~.duet-bridge-passphrase, each locked to the account via icacls), deploys the Worker, writes the URL to windows\config.toml, and prints the connector URL.
- Edit windows\config.toml. Set the folder for each workspace, as well as the read-only MCP servers that read-only sessions can use. If you add a workspace name, you also need to add it to WORKRun npx wrangler deploy in SPACES.
- Add a custom connector in claude.ai and paste the URL.
- Click Connect. Paste the passphrase on the login page (Get-Content ~.duet-bridge-passphrase | Set-Clipboard copies it).
- Run windows\install.ps1. It registers a scheduled task that starts the runner at login and restarts it when it stops, and writes the duet-code.cmd shim to ~.local\bin. No administrator privileges are required: the task belongs only to the user, runs interactively, and can put the window on the desktop.
Notes:
- The channel is a research preview. Custom channels require --dangerously-load-development-channels, which duet-code passes through, showing a warning screen on every launch. Personal plans cannot turn this off; the pre-approved channel setting applies to Team and Enterprise administrators.
- Remote control is off in the duet-code window. In testing, a Duet window with remote control enabled sometimes moved into Claude Code's background service about 30 seconds after a turn, and the moved session could no longer hear Duet. Other windows keep remote control.
- Claude Code cannot wake Duet.
- Work waits while the Mac sleeps. A window that stops checking shows connected: false within 90 seconds. Its session ends after 12 hours without a check, so a Mac sleeping overnight keeps the window.
- Background sessions on Windows have not been tested. Session turns run as claude --bg background sessions. Windows support was tested before that change; the background path was only tested on macOS. If Windows turns fail, the runner log will indicate the step.
- Duet's background checks may or may not use the custom connector. To test: leave a message with tell and see whether Duet mentions it on its own.
- On Windows the runner reads windows\config.toml, so its OFF switch is also in windows. duet-bridge.py is shared by both platforms and stays in mac/ so existing installations keep working.
- npm run check type-checks the code. Every npm test run ends with a 15-minute login lock, so restart npm run dev before the next run.
Directory listing (Glama): Glama scores by starting the MCP server in a container and listing tools over stdio. The Worker cannot run that way, so worker/glama/stdio.mjs answers initialize and tools/list with the same catalog the Worker serves (worker/src/catalog.ts). Its tools/call only points to this README. glama.json tells Glama how to run it. Requires Node 22.18 or later, no installation needed.
How login works: The Worker is its own OAuth server, with dynamic client registration and PKCE. claude.ai registers itself and is sent to a login page that asks for the passphrase. There is only one owner, no user accounts. Login only to https://claude.ai/api/mcp/auth_callback or send code to the loopback address. Logins from other addresses are rejected. Five incorrect passphrases within 15 minutes will lock out login for 15 minutes. The Mac uses a separate bearer token on a separate path (/bridge/*). The connector token cannot open that path.
File structure: worker/src/index.ts (entry point and OAuth setup), worker/src/authorize.ts (passphrase login page and redirect protection), worker/src/mcp.ts (MCP endpoint and Duet's thirteen tools), worker/src/bridge.ts (the Mac's private path /bridge/*), worker/src/mailbox.ts (storage and real-time socket, SQLite Durable Object), channel/channel.mjs (Claude Code channel that provides the real-time window to the Duet line), channel/stop-hook.mjs (sends the window back to Duet if it does not reply via send_to_duet), mac/duet-code (macOS real-time window launcher), mac/duet-bridge.py (runner, shared by both platforms, serve, tell, sessions, status), mac/install.sh (launchd job and duet-code link), mac/config.example.toml (macOS runner settings), windows/duet-code.ps1 (Windows real-time window launcher), windows/install.ps1 (scheduled task and duet-code.cmd shim), windows/setup.ps1 (the Windows counterpart of worker/setup.sh), windows/config.example.toml (Windows runner settings).
License: MIT. See LICENSE.