# Set up your AI tool

This page connects your AI tool to Unspar. Each tool has a short section with the command or the settings file it needs, for the hosted server, the local server or both.

Web version: https://www.unspar.com/docs/mcp/setup/

Unspar has two MCP servers. The hosted server runs at `https://app.unspar.com/mcp`, and you approve it in your browser. Only Claude Code and Codex can use it. The local server comes with the unspar CLI and runs on your computer. Any tool that can start a local MCP server can use it, and it can also publish. [Unspar MCP server](https://www.unspar.com/docs/mcp/) explains the differences and what you approve.

Only the team owner and members with the **Administrator** role can approve a connection or a CLI login. To teach your agent Unspar's rules, install the [skill file](https://www.unspar.com/docs/agents/#teach-your-agent-the-rules) as well.

## Before you use the local server

The local server is part of the CLI. Install it and log in once. On macOS and Linux:

```sh
curl -fsSL https://app.unspar.com/install.sh | sh
unspar login
```

On Windows, [CLI](https://www.unspar.com/docs/cli/) has the install command. The login opens your browser, and what you approve there decides what your AI tool can do in Unspar. With full access, that includes publishing. [API keys and connections](https://www.unspar.com/docs/agents/access/#approve-a-cli-login) explains the options.

None of the settings on this page store a key. The server reads your CLI login each time the tool calls it. If you log in again with another key, the next call uses the new one. Your login's key appears on the **API tokens** screen in [Settings](https://app.unspar.com/settings), where you can also revoke it.

To check your setup, ask your AI tool which Unspar team it's connected to. It calls `unspar_whoami`, which only works with a valid CLI login.

If a tool can't start the server, it usually can't find the `unspar` program. Use the full path instead of `unspar`. These commands print it:

```sh
command -v unspar                # macOS and Linux
(Get-Command unspar).Source      # PowerShell on Windows
```

On Windows, the CLI installs to `%LOCALAPPDATA%\Programs\unspar\unspar.exe`. In a JSON file, write each backslash twice. After running `unspar update`, restart your AI tool so it starts the new version.

## Claude Code

Claude Code can use both servers. For the hosted server, run this command in your project folder:

```sh
claude mcp add --transport http unspar https://app.unspar.com/mcp
```

That adds Unspar to this one project. Add `--scope user` to make it available in all your projects. Then log in:

1. Start Claude Code and type `/mcp`.
2. Pick **unspar** and choose **Authenticate**. Your browser opens Unspar's approval page.
3. Open **Advanced settings** and check what Claude can do and in which projects.
4. Choose **Approve** and return to Claude Code.

The Unspar tools are now ready to use. Instead of steps 1 and 2, you can also run `claude mcp login unspar` in your terminal.

To share the server with everyone working on the repository, use `--scope project`. Claude Code writes it into `.mcp.json`:

```json
{
  "mcpServers": {
    "unspar": {
      "type": "http",
      "url": "https://app.unspar.com/mcp"
    }
  }
}
```

Claude Code requires the `"type": "http"` line. The file holds no secrets, so each person logs in and approves their own connection.

After 30 days, or to pick up new tools that Unspar added later, connect again. Type `/mcp` and pick **unspar**. Choose **Clear authentication** and then **Authenticate**. **Clear authentication** or `claude mcp logout unspar` only removes the login on your computer. To end the connection in Unspar, [revoke it](https://www.unspar.com/docs/agents/access/#see-and-revoke-mcp-connections).

For the local server, use this command instead. Add `--scope user` to use it in all your projects:

```sh
claude mcp add --transport stdio unspar -- unspar mcp serve
```

If you want both servers, give the local one another name, like `unspar-local`.

## Codex

Codex can use both servers. Its editor extension reads the same settings as the Codex CLI. For the hosted server:

```sh
codex mcp add unspar --url https://app.unspar.com/mcp
```

Codex opens Unspar's approval page in your browser. Check **Advanced settings** and choose **Approve**. If the page doesn't open, start the login yourself:

```sh
codex mcp login unspar
```

Codex stores the server in `~/.codex/config.toml`. In a project that Codex trusts, you can put the same lines in `.codex/config.toml` inside the project:

```toml
[mcp_servers.unspar]
url = "https://app.unspar.com/mcp"
```

After 30 days, run `codex mcp login unspar` again. To pick up new tools that Unspar added later, log out first:

```sh
codex mcp logout unspar
codex mcp login unspar
```

Each login approves a new connection, and logging out only removes the login in Codex. If Codex loses the connection well before the 30 days are up, switch to the local server. It doesn't depend on a hosted connection:

```sh
codex mcp add unspar -- unspar mcp serve
```

That writes these lines into `~/.codex/config.toml`. If the hosted server already uses the name `unspar`, pick another name, like `unspar-local`.

```toml
[mcp_servers.unspar]
command = "unspar"
args = ["mcp", "serve"]
```

## Claude Desktop

Claude Desktop uses the local server. Its custom connectors run through your claude.ai account, and the hosted server doesn't accept that login.

1. Find the full path of the CLI with `command -v unspar`. Claude Desktop doesn't always find programs that your terminal knows.
2. Open `claude_desktop_config.json`, or create it. The table below shows where it lives.
3. Add the server below, replacing `/absolute/path/to/unspar` with your path. If the file already lists other servers, add the `"unspar"` entry alongside them.
4. Quit Claude Desktop completely and open it again.

```json
{
  "mcpServers": {
    "unspar": {
      "command": "/absolute/path/to/unspar",
      "args": ["mcp", "serve"]
    }
  }
}
```

The settings file sits in a different folder on each operating system.

| System  | Folder                                  |
| ------- | --------------------------------------- |
| macOS   | `~/Library/Application Support/Claude/` |
| Windows | `%APPDATA%\Claude\`                     |
| Linux   | `~/.config/Claude/`                     |

To check that it worked, click **+** in a chat and choose **Connectors**. Unspar and its tools should appear in the list. Claude Desktop's settings show the status and log for each server under **Local MCP servers**. If something fails, check for a wrong path in `"command"` first. If the tools show up but every call fails, run `unspar whoami` or `unspar doctor` in a terminal.

## Cursor

Cursor uses the local server. Add this to `~/.cursor/mcp.json` for all your projects, or to `.cursor/mcp.json` in a single project folder:

```json
{
  "mcpServers": {
    "unspar": {
      "type": "stdio",
      "command": "unspar",
      "args": ["mcp", "serve"]
    }
  }
}
```

Save the file and restart Cursor. Unspar will appear under **Customize** and **MCPs** in the sidebar. If something goes wrong, check the server's messages in the Output panel under **MCP Logs**. On macOS, Cursor may not see `~/.local/bin`, where the installer often puts the CLI. If that happens, use the full path.

## VS Code

GitHub Copilot in VS Code uses the local server.

1. Open the command palette and run **MCP: Add Server**.
2. Choose **Command (stdio)**.
3. Enter `unspar mcp serve` as the command.
4. Enter `unspar` as the server ID.
5. Choose where VS Code saves it: your global settings for all workspaces, or the workspace's `.mcp.json`.

To check it, run **Chat: Open Customizations** from the command palette and open **MCP Servers**. You can also add the server by hand. VS Code reads this from `~/.copilot/mcp-config.json` for all your workspaces, and from `.mcp.json` at the root of one workspace:

```json
{
  "mcpServers": {
    "unspar": {
      "type": "stdio",
      "command": "unspar",
      "args": ["mcp", "serve"]
    }
  }
}
```

Older setups keep servers in `.vscode/mcp.json`. That file takes the same entry, with `"servers"` instead of `"mcpServers"` at the top.

If VS Code runs on another machine, such as over SSH or in a container, the server runs there too. Install the CLI and log in on that machine. If your company manages VS Code, the `chat.mcp.access` setting controls whether MCP servers can run.

## Gemini CLI

Gemini CLI uses the local server. This command adds it for all your projects and writes it into `~/.gemini/settings.json`:

```sh
gemini mcp add -s user unspar unspar mcp serve
```

Without `-s user`, it writes to `.gemini/settings.json` in the current project only.

## Windsurf and Devin Desktop

Windsurf's Cascade and Devin Desktop use the local server. Both read it from `mcp_config.json`.

| Applies to                    | File                                           |
| ----------------------------- | ---------------------------------------------- |
| All your projects             | `~/.config/devin/mcp_config.json`              |
| All your projects, on Windows | `%APPDATA%\devin\mcp_config.json`              |
| One project                   | `.devin/mcp_config.json` in the project folder |

In Windsurf, **Open MCP config file** in Cascade's MCP menu opens the file. Add the Unspar entry:

```json
{
  "mcpServers": {
    "unspar": {
      "command": "unspar",
      "args": ["mcp", "serve"]
    }
  }
}
```

## Zed

Zed uses the local server. Add it to Zed's settings under `context_servers`, or under **AI** and **MCP Servers** in the settings screen:

```json
{
  "context_servers": {
    "unspar": {
      "command": "unspar",
      "args": ["mcp", "serve"],
      "env": {}
    }
  }
}
```

## Other tools

Any tool that can start a local MCP server can use Unspar. It needs the command `unspar` and the arguments `mcp serve`. Most tools take an entry like this:

```json
{
  "mcpServers": {
    "unspar": {
      "command": "unspar",
      "args": ["mcp", "serve"]
    }
  }
}
```

Never put an API key into a tool's settings.

### Give one tool less access

One agent may only need read access, while you keep a full login for yourself. The CLI can hold several logins, called profiles. Log in under a second profile and choose **Read only** under **Access** on the approval page. The second command switches your terminal back to your normal login.

```sh
unspar --profile agent-readonly login
unspar profile use default
```

Then point the server at that profile:

```json
{
  "mcpServers": {
    "unspar-readonly": {
      "command": "unspar",
      "args": ["--profile", "agent-readonly", "mcp", "serve"]
    }
  }
}
```

If the `UNSPAR_API_KEY` environment variable is set where the tool runs, the server uses that key instead of any profile.

## ChatGPT and claude.ai

ChatGPT and claude.ai in the browser can't use Unspar. They run in the cloud, so they can't start the local server on your computer, and the hosted server doesn't accept their login. On your computer, use Claude Desktop or Codex instead.
