# MCP memory server setup for Claude Code, Cursor, and Codex

Use this recipe to connect multiple coding-agent hosts to the same Handover
workspace and prove that one authenticated actor can continue another actor's
work.

## Connection

Endpoint:

```text
https://handover.sh/api/mcp
```

Create a separate named service credential for each agent or host profile under
**Company > Agents**. Export it in the shell that launches the host:

```sh
export HANDOVER_TOKEN=hnd_...
```

Never commit the credential to a repository or paste it into a handover.

## Claude Code

```sh
claude mcp add --transport http --scope user \
  handover https://handover.sh/api/mcp \
  --header "Authorization: Bearer ${HANDOVER_TOKEN}"

claude mcp list
```

## Cursor

Put this in `~/.cursor/mcp.json` for a global connection or
`.cursor/mcp.json` for one project:

```json
{
  "mcpServers": {
    "handover": {
      "url": "https://handover.sh/api/mcp",
      "headers": {
        "Authorization": "Bearer ${env:HANDOVER_TOKEN}"
      }
    }
  }
}
```

Open Cursor's MCP settings and confirm that `handover` is enabled.

## Codex

```sh
codex mcp add handover \
  --url https://handover.sh/api/mcp \
  --bearer-token-env-var HANDOVER_TOKEN

codex mcp list
```

## End-to-end continuity test

### Agent A

1. Call `handover.whoami`.
2. Create a handover titled `MCP continuity check <unique marker>`.
3. Attach `checkpoint.md` containing:
   - objective;
   - current state;
   - one decision and its reason;
   - one piece of evidence;
   - one unresolved constraint;
   - one exact next action.
4. Record the returned handover ID and revision ID.

### Agent B

Start a new session in a different host. Do not paste Agent A's conversation.

1. Call `handover.whoami` and confirm a different named identity.
2. Call `handover.search` with the unique marker.
3. Call `handover.get` for the canonical record.
4. Read `checkpoint.md`.
5. List unresolved annotations.
6. State the objective, decision, evidence, constraint, and next action.
7. Call `handover.continue` with the current `expectedRevisionId`.

## Pass criteria

- Both hosts connect to the same workspace.
- The second host finds the record without receiving the first chat.
- The second host cites the attached evidence correctly.
- History attributes each revision to the correct identity.
- A stale `expectedRevisionId` is rejected instead of overwriting newer work.
- Revoking one service credential prevents that agent from accessing Handover
  without affecting the other identity.

## Security checklist

- One credential per agent or profile.
- Least-privilege scopes.
- No credentials in repository files, prompts, or handover artifacts.
- Human approval remains enabled while validating write tools.
- Public sharing is explicit; workspace context remains isolated by default.
