---
title: "Connect Claude Code"
description: "Give Claude Code access to a workspace through your synced folder, the Treehouse MCP server, or both."
canonical_url: "https://trytree.house/docs/agents/connect/claude-code"
last_updated: "2026-09-29"
---

# Connect Claude Code

Give Claude Code access to a workspace through your synced folder, the Treehouse MCP server, or both.

Claude Code can reach a Treehouse workspace in two ways. Open it in your synced folder and it works on the files directly. Connect the Treehouse MCP server and it works through Treehouse itself, with its changes labelled as its own and access to review comments. You can set up either, or both.

## Option 1: work in the synced folder

> **Before you start**
>
> You need the workspace synced to your computer, with the [desktop app](https://trytree.house/docs/desktop/install-the-desktop-app) or the [sync CLI](https://trytree.house/docs/desktop/sync-with-the-cli).

1. In a terminal, go to the synced folder. The desktop app puts it in `~/Treehouse/<workspace name>` unless you chose somewhere else. To find it, choose the folder in the Treehouse menu bar icon and select **Open in Finder**.
2. Run `claude`.

That's it. Claude Code reads `AGENTS.md` at the root of the folder as it would in any project, and every file it writes syncs to the workspace within a few seconds.

```bash
cd ~/Treehouse/Acme
claude
```

## Option 2: connect the MCP server

1. In the Treehouse web app, open the account menu at the bottom of the sidebar and choose **API keys**.
2. Set **Name** to something you'll recognise in the activity feed, such as `claude-code`.
3. Set **Used by** to **Agent (MCP)** and select **Create key**.
4. Copy the command under **Claude Code (MCP)** and run it in a terminal. It looks like this:
   ```bash
   claude mcp add --transport http treehouse https://api.trytree.house/api/mcp \
     --header "x-api-key: <your key>"
   ```
5. Select **I've copied it** to close the dialog. The key won't be shown again.

By default `claude mcp add` connects Treehouse only in the directory you ran it from. To make it available in every project, add `--scope user`:

```bash
claude mcp add --scope user --transport http treehouse https://api.trytree.house/api/mcp \
  --header "x-api-key: <your key>"
```

Keys created in the web app work across every workspace you're a member of. Claude Code will list your workspaces and ask which one you mean, or you can name it in your request.

## Check it worked

Start Claude Code and ask:

```text
List my Treehouse workspaces, then show me what's at the root of <workspace name>.
```

Over MCP it calls the Treehouse tools; run `/mcp` inside Claude Code to see the `treehouse` server and its tools. After it makes a change, open **Activity** in the web app: the change appears under your name with "via claude-code".

## Troubleshooting

### Claude Code says the server returned 401

The key is missing, mistyped or revoked. Treehouse expects it in an `x-api-key` header, not `Authorization: Bearer`. Remove the server with `claude mcp remove treehouse` and add it again with a fresh key.

### It can't find a file I can see in the web app

The file may be [private](https://trytree.house/docs/files/private-files) to someone else, in which case Treehouse reports it as not found. Or the agent may be looking in the wrong workspace: ask it to list your workspaces first.

### Its edits in the synced folder show up as mine

That's expected. The folder syncs through your desktop app or CLI, which signs in as you. Use the MCP connection if you want the agent's changes labelled separately.

## Related

- [How agents work with Treehouse](https://trytree.house/docs/agents/connect/how-agents-work): The two ways an agent can reach a workspace, what it can do there, and how its work shows up for everyone else.
- [Manage API keys](https://trytree.house/docs/agents/connect/api-keys): Create a key for each agent, see which keys can reach your workspaces, and revoke the ones you no longer need.
- [Write your AGENTS.md](https://trytree.house/docs/playbooks/write-your-agents-md): The one file every agent reads first. What to put in it so any agent, in any session, works the way your team does.
