---
title: "Claude Code MCP server and hooks: connect Claude Code to Cork · Cork"
description: "Connect Claude Code to Cork with one machine install, the Claude Code plugin, or the remote MCP server at mcp.corkcli.com: what your agents get, how to check it works, and how to remove it."
canonical: "https://corkcli.com/docs/claude-code"
last_updated: "2026-10-16"
---

# Cork for Claude Code

Cork keeps Claude Code agents that work on the same repository, on one machine or across a team's machines, from overwriting each other, and hands each agent what the others already learned. Claude Code gets it through hooks (no extra model calls) and through Cork's MCP server.

## Install for every repo on the machine

```
curl -fsSL https://corkcli.com/install.sh | sh
```

Or, with Node, in any terminal including Windows PowerShell: `npx corkcli`. On Windows the shell script runs in Git Bash, which Claude Code uses too. Either command is safe to run again.

What it does:

- Downloads Cork, one program, into `~/.cork/bin`, checks it against its SHA-256 before running it, and adds `cork` to your PATH.
- Registers the hooks in `~/.claude/settings.json`, the user-level settings, so they apply to every project. Your other settings and hooks are kept.
- Adds Cork's MCP tools at user scope as a server named `cork` (the `cork mcp` program, over stdio), in place of any `cork` server already there.
- Writes nothing into your repositories: each one is found by its git remote the first time an agent works in it.

This is Cork, free and local: no account, and everything stays on the machine. To link the machine to an account run `cork login`; to bring in your team, `cork upgrade`. See [the cork command](https://corkcli.com/docs/cli.md).

## Or install the Claude Code plugin

In Claude Code, send these as two separate messages:

```
/plugin marketplace add lithometric/cork
/plugin install cork@cork
```

The next session sets Cork up for every repository on the machine. `/cork:status` shows what Cork did on this machine; `/cork:login` links the machine to a Cork account. The plugin is MIT licensed: https://github.com/lithometric/cork

## Or connect the MCP server only

```
claude mcp add --scope user --transport http cork https://mcp.corkcli.com
```

The short form `claude mcp add -t http cork https://mcp.corkcli.com` adds it too. Claude Code signs in through the browser on first use (OAuth 2.1 with PKCE; no API key, headers or client ID). The first Cork call also installs the same machine hooks; if your agent skips that, tell it `set up cork`. Its `setup` tool returns the one install command, which links the machine to your account.

Added Cork as a connector on claude.ai? Claude Code loads those connectors too.

## What the agent gets

- **A briefing** at session start and with each prompt: the exact signatures, callers and recent changes of the code the prompt is about, so it searches and re-reads less.
- **A write gate.** Every write is checked first; one that lands on a teammate's live change is held, and the agent is told who and what, so it can adapt and retry.
- **Teammates' changes** on its next step: lines starting with `Δ` in a tool result name what changed since its last step.
- **The repo's check** runs detached after a batch of writes, and its verdict arrives with the next tool result.
- **Messages** from the other agents in the repo, and `cork message` to send one.
- **Landing:** a plain `git push` becomes one step that rebases onto teammates' commits, reruns the tests and pushes.
- **MCP tools** such as `get_symbol`, `blast_radius`, `recap` and `remember`. See the [MCP tools reference](https://corkcli.com/docs/mcp-tools.md).

### The hook events

Claude Code runs all seven: **SessionStart** indexes the tree and prints the briefing, **UserPromptSubmit** narrows it to what the prompt names, **PreToolUse** is the gate, **PostToolUse** reports writes, **PostToolBatch** runs the repo check, **Stop** reports a usage limit, and **ConfigChange** fires when the settings file changes. A blocked write is refused with an exit code and stderr. Every hook fails open: any error, timeout or missing config allows the operation.

## Check that it works

- Start a new Claude Code session: a session loads the hooks when it starts, so one that was already open before you installed runs without them.
- A **Cork briefing** arrives in the session's context at start.
- Run `cork status` to see whether Cork is running on this machine and what it did in the last day and since install.
- On a signed-in workspace, edits, intents and collisions appear on the [dashboard](https://corkcli.com/dashboard) as agents work.

## Remove it

```
cork uninstall
```

This takes Cork's hooks out of `~/.claude/settings.json` and its MCP entry out of Claude Code. Your local data stays in `~/.cork` until you delete it. If you also added Cork as a connector on claude.ai, remove it there (Settings, Connectors). Open sessions keep the hooks they started with until they end, so restart them.

## More

- [Codex](https://corkcli.com/docs/codex.md) · [Cursor](https://corkcli.com/docs/cursor.md) · [Gemini CLI](https://corkcli.com/docs/gemini-cli.md)
- [The cork command](https://corkcli.com/docs/cli.md) · [MCP tools reference](https://corkcli.com/docs/mcp-tools.md)
- [Documentation](https://corkcli.com/docs) · [Support](https://corkcli.com/support)
