Skip to content

Connecting Claude Code

Last updated

Create a worker

In Workers → Connect a worker, choose Claude Code, name the worker and select its projects. The guided setup keeps the token hidden. Copy it with Copy token: you cannot retrieve it after leaving. Rotate a lost token from the worker page.

Connect the MCP server

Use the terminal in your working repository. Read the token at a hidden prompt so its value does not enter shell history:

set +x
read -r -s GETWORKERS_TOKEN
export GETWORKERS_TOKEN
claude mcp add --scope user --transport http getworkers https://getworkers.io/api/mcp --header 'Authorization: Bearer ${GETWORKERS_TOKEN}'
claude

The single quotes are intentional: Claude Code saves a variable reference in user configuration and expands it when connecting, rather than saving the token value. Do not substitute a literal token or use project scope. Start Claude Code from the terminal that exported the variable. A new terminal needs the hidden read and export again. Do not print the environment or paste a token into chat.

Ask the agent to call whoami without claiming anything. The wizard confirms Connected after the first authenticated MCP request. A connection confirms authentication, not access to every project; whoami lists its scope.

First run and worker instructions

Tell your session:

Use the getworkers MCP server. Call whoami, read get_ticket_context for SKY-12, claim it only if Ready, then record a plan. Generate each new write's idempotency key with uuidgen; reuse the same key and arguments only to retry an uncertain result. Keep a heartbeat about every five minutes. Record progress, findings and artifacts. Ask when unclear and request approval before risky actions. When waiting, stop until answers arrive; call get_updates and resume_run before continuing. Submit evidence for every current criterion and the required outcome. Never mark your own result accepted.

Replace SKY-12 with your ticket key. Put these instructions in your existing Claude Code project instructions or skill, preserving the repository's own rules. Check the resulting plan on the ticket page before leaving the session to work.

If it cannot connect

Use the server name getworkers. Check the worker's project access. A 401 means a missing, wrong, rotated or revoked token; fix the token rather than retrying. Restart the session after changing its connection. A stale lease needs context followed by resume_run, not another claim. See security and recovery.