# Connect your AI assistant to Cairn

How to connect an AI assistant to Cairn’s built-in MCP server on your Mac. (HTML version: https://cairn-notes.com/ai/connect/)

Cairn’s built-in MCP server lets an AI assistant you choose, running on your Mac, work with your notes: add to today’s journal, gather your to-dos, search and summarize what you’ve written. It’s off until you turn it on, and it only accepts connections from your own Mac. What it can do, and why: https://cairn-notes.com/ai/

## The easy way

1. On your Mac, open **Cairn → Settings → Cairn MCP Server** and choose **Turn On…**. Cairn explains what that allows; confirm.
2. Under **Connect an assistant**, pick yours: Claude Code, Claude Desktop, Cursor or VS Code.
3. Click **Copy**. The setup is copied with your own address and access token already filled in.
4. Follow the steps for your assistant below, then keep Cairn running while you work.

The steps below show the same setup with placeholders: `<PORT>` is the port shown in Cairn’s Settings (8788 unless you changed it) and `<TOKEN>` is your access token.

## Claude Code

Paste this in Terminal, then start Claude Code:

```
claude mcp add --transport http --scope user cairn http://127.0.0.1:<PORT>/mcp --header "Authorization: Bearer <TOKEN>"
```

Check it worked: in Claude Code, type `/mcp`. **cairn** should show as connected.

## Claude Desktop

Claude Desktop connects to Cairn through a small free bridge that runs on **Node.js**, so install Node.js first (from nodejs.org) if you don’t have it.

1. In Claude Desktop, open **Settings → Developer → Edit Config**.
2. Add this to the file and save. If the file already has servers, add just the “Cairn” entry inside `mcpServers`.

```
{
  "mcpServers": {
    "Cairn": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://127.0.0.1:<PORT>/mcp", "--header", "Authorization: Bearer <TOKEN>"]
    }
  }
}
```

3. Quit Claude Desktop completely (⌘Q) and open it again. Cairn’s tools appear in the tools menu.

Claude’s “custom connectors” don’t work for this: they connect from Anthropic’s servers, which can’t reach your Mac.

## Cursor

Add this to `~/.cursor/mcp.json` (or **Cursor → Settings → MCP → Add**), then restart Cursor:

```
{
  "mcpServers": {
    "cairn": {
      "url": "http://127.0.0.1:<PORT>/mcp",
      "headers": { "Authorization": "Bearer <TOKEN>" }
    }
  }
}
```

## VS Code (GitHub Copilot)

Run **MCP: Open User Configuration** from the Command Palette, add this, then start **cairn** from the MCP server list:

```
{
  "servers": {
    "cairn": {
      "type": "http",
      "url": "http://127.0.0.1:<PORT>/mcp",
      "headers": { "Authorization": "Bearer <TOKEN>" }
    }
  }
}
```

## ChatGPT

Not yet. ChatGPT only connects to servers on the internet, and Cairn’s server stays on your Mac.

## If it doesn’t connect

- **Is Cairn running, with the server on?** Settings → Cairn MCP Server should say it’s on. Your assistant can only reach Cairn while Cairn is open.
- **Wrong or old token?** If you generated a new token or copied it partly, copy the setup again from Cairn’s Settings.
- **Changed the port?** A new port takes effect the next time Cairn launches; copy the setup again after that.
- **Claude Desktop:** make sure Node.js is installed, and quit and reopen Claude Desktop after editing the config. Its logs are in `~/Library/Logs/Claude/`.

## Keep your token private

Your access token is like a password for your notes on this Mac. It only works from your own Mac, but don’t paste it anywhere public. If you think it’s been shared, choose **Generate New Token…** in Cairn’s Settings and copy the setup again into each assistant.

Questions? Email support@cairn-notes.com.
