Skip to main content
Glama
README.md
<div align="center">

<img src="assets/logo.svg" alt="handoff-mcp logo: a crab claw passing a note" width="140">

<h1>handoff-mcp</h1>

<p><b>Start it on your phone. Finish it in Claude Code.</b></p>

<p>Hand work between your claude.ai chats and your Claude Code sessions, in both directions,<br>and keep lasting notes per repo.</p>

<p>
  <a href="https://github.com/amd989/handoff-mcp/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/amd989/handoff-mcp?style=flat-square&color=C2410C"></a>
  <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/amd989/handoff-mcp?style=flat-square&color=475569"></a>
  <a href="https://modelcontextprotocol.io"><img alt="Remote MCP server" src="https://img.shields.io/badge/MCP-remote%20server-475569?style=flat-square&logo=modelcontextprotocol&logoColor=white"></a>
  <a href="https://workers.cloudflare.com"><img alt="Runs on Cloudflare Workers" src="https://img.shields.io/badge/Cloudflare-Workers-F38020?style=flat-square&logo=cloudflareworkers&logoColor=white"></a>
  <a href="#3-set-up-claude-code"><img alt="Claude Code plugin" src="https://img.shields.io/badge/Claude%20Code-plugin-D97757?style=flat-square&logo=claude&logoColor=white"></a>
  <img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white">
</p>

<p>
  <a href="#1-deploy-the-server"><b>Deploy</b></a> ·
  <a href="#2-connect-claudeai"><b>Connect claude.ai</b></a> ·
  <a href="#3-set-up-claude-code"><b>Claude Code plugin</b></a> ·
  <a href="https://github.com/amd989/handoff-mcp/releases/latest"><b>Get the chat skill</b></a>
</p>

</div>

<br>

```
claude.ai chat (phone / web)             Claude Code (desktop / CLI)
  "handoff this"   "any reports?"          /pickup       /handoff
        │                ▲                    ▲             │
        ▼                │                    │             ▼
┌──────────────────────────────────────────────────────────────────┐
│  handoff-mcp: Cloudflare Worker + D1, GitHub sign-in             │
│  H-7K2 handoffs · R-7K2 reports · per-repo notes                 │
└──────────────────────────────────────────────────────────────────┘
```

- **Handoffs** (`H-7K2`) are self-contained briefs: goal, context, decisions, open questions, done-when checks. Status goes `pending` → `claimed` → `done` / `blocked`. A claim nobody touches for 24 hours goes back to `pending`.
- **Reports** (`R-7K2`) are what Code sends back. Answering a blocked handoff's questions from your phone puts it back to `pending` for the next `/pickup`.
- **Project notes** are lasting facts per repo (setup, commands, conventions). Notes under the repo `*` apply everywhere. `/pickup` loads them with the task.
- **Repos** are matched by git remote, however it is spelled: `git@github.com:Me/x.git`, `https://github.com/me/x` and `github.com/me/x` are the same repo. Without a remote, the folder name is used (`local/<name>`).

It runs on the Cloudflare Workers free plan. Each person deploys their own copy, so nobody else holds your data.

## 1. Deploy the server

You need a Cloudflare account and Node 20 or newer.

1. **Create a GitHub OAuth app** at <https://github.com/settings/developers> → *New OAuth App*:
   - Homepage URL: `https://handoff-mcp.<your-subdomain>.workers.dev`
   - Authorization callback URL: `https://handoff-mcp.<your-subdomain>.workers.dev/callback`

   Keep the client ID and generate a client secret. The server only uses GitHub to learn who signed in (public profile, no scopes) and does not keep the GitHub token.

2. **Create the storage and configure:**

   ```sh
   npm install
   cp wrangler.example.jsonc wrangler.jsonc
   npx wrangler login
   npx wrangler kv namespace create OAUTH_KV
   npx wrangler d1 create handoff
   ```

   Put the two ids into `wrangler.jsonc` (git ignores it, so your deployment details stay out of the repo), and set `vars`:
   - `PUBLIC_URL`: `https://handoff-mcp.<your-subdomain>.workers.dev`
   - `ALLOWED_GITHUB_USERS`: your GitHub login (comma-separated for several; `*` lets anyone with GitHub sign in and get their own private space).

3. **Set secrets, create the tables, deploy:**

   ```sh
   npx wrangler secret put GITHUB_CLIENT_ID
   npx wrangler secret put GITHUB_CLIENT_SECRET
   npx wrangler secret put COOKIE_SECRET        # 32+ random characters
   npm run db:migrate:remote
   npm run deploy
   ```

Opening `PUBLIC_URL` in a browser shows the connector URL.

## 2. Connect claude.ai

1. In claude.ai, open *Settings → Connectors → Add custom connector* and enter `https://handoff-mcp.<your-subdomain>.workers.dev/mcp`. Sign in with GitHub when asked. Connectors you add on the web also work in the mobile app.
2. In each claude.ai Project, add one line to the project instructions naming its main repo. It is the default: a conversation that is about another repo (one attached to it, or named in it) hands off to that repo instead.

   ```
   repo: github.com/<owner>/<name>
   When I say "handoff" or "send to Code", use the handoff connector.
   ```

3. Optional but recommended: upload the **handoff-chat skill**. Chats don't get slash commands, so this skill is what makes "handoff this" in a chat as dependable as `/handoff` in Claude Code: it holds the checklist for a good brief, how to pick the repo, and how to follow up on reports.

   ```sh
   npm run build:skill    # writes dist/handoff-chat.zip
   ```

   In claude.ai, open the skills section of *Settings* (under *Capabilities*), upload `dist/handoff-chat.zip`, and turn it on. Skills you enable on claude.ai also sync into Claude Code; there the plugin's commands take precedence, as the skill itself says.

Then, in a chat: *"handoff this to Code"*, *"any reports?"*, *"what's the status of H-7K2?"*, *"answer H-7K2: use 5 minutes"*, *"remember that the broker is on 10.0.0.5"*.

## 3. Set up Claude Code

**The tools.** If Claude Code is signed in with your claude.ai account (the default, and always the case in the Claude desktop app's Code tab), the connector from step 2 is already there: claude.ai connectors sync into Claude Code. Nothing to do.

If you use Claude Code with an API key instead, add the server yourself and sign in with `/mcp`:

```sh
claude mcp add --transport http --scope user handoff https://handoff-mcp.<your-subdomain>.workers.dev/mcp
```

Don't do both, or every tool shows up twice.

**The plugin** adds the `/pickup`, `/handoff`, `/note` commands and the session-start notice. It carries no server config of its own, so it works with either setup above.

1. Install it from this repo:

   ```sh
   claude plugin marketplace add <owner>/handoff-mcp
   claude plugin install handoff@handoff
   ```

2. Optional, for the "📬 handoffs waiting" line when a session starts: run `/handoff-setup` and put the two values it gives you in `~/.claude/settings.json`:

   ```json
   {
     "env": {
       "HANDOFF_URL": "https://handoff-mcp.<your-subdomain>.workers.dev",
       "HANDOFF_TOKEN": "hk_..."
     }
   }
   ```

   That token can only read the list of pending handoffs.

### Commands

| Command | What it does |
|---|---|
| `/pickup` | Claims the pending handoff for this repo. With several, lists them so you choose. |
| `/pickup H-7K2` | Claims that one, from any folder. |
| `/pickup --all` | Lists pending handoffs in every repo. |
| `/handoff [done\|blocked\|paused]` | Reports on the handoff this session is working on. With none, hands the session over to claude.ai so you can carry on from your phone. |
| `/note <fact>` | Saves a lasting note for this repo (`--global` for all repos). `/note list`, `/note forget <topic>`. |
| `/handoff-setup` | Creates the token for the session-start hook. |

## MCP tools

| Tool | Purpose |
|---|---|
| `handoff_create` | New handoff, from chat or Code, for the other side |
| `handoff_list` | Open handoffs by default; filter by repo, target, status |
| `handoff_get` | Full brief, thread and notes, without claiming |
| `handoff_claim` | Start work (by id, or the single pending one for a repo) |
| `handoff_report` | `done`, `blocked` with questions, or `in_progress` |
| `handoff_reply` | Answer questions; reopens blocked (or, if asked, done) handoffs |
| `handoff_cancel` | Drop a handoff |
| `repos_list` | Repos with open handoffs and notes |
| `notes_get`, `note_save`, `note_delete` | Project notes |
| `hook_token` | Create, list or revoke session-start hook tokens |

The server also sends usage instructions to clients when they connect, so claude.ai knows how to write a good brief without extra setup.

## Security

- Every row is scoped to your GitHub user id, so a shared deployment (`ALLOWED_GITHUB_USERS=*`) keeps users apart.
- Sign-in uses [`@cloudflare/workers-oauth-provider`](https://github.com/cloudflare/workers-oauth-provider): dynamic client registration, PKCE, a consent page that shows which app is asking and where the sign-in goes, and browser-bound state for the consent and GitHub steps.
- Hook tokens are stored as SHA-256 hashes and can only read pending handoff titles.
- Anything you put in a handoff or note is stored in your Cloudflare D1 database. Don't put secrets in them.

## Development

```sh
cp .dev.vars.example .dev.vars
npm run db:migrate:local
npm run dev
npm test          # node:test against SQLite with the real migrations
npm run typecheck
```

On Windows, if `wrangler` fails with `internal error` for local D1, the project path is too long for the local database file. Add `--persist-to C:\wr` (any short folder) to both the migrate and dev commands.

## License

MIT