> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onyx.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code

> Connect Claude Code to the Onyx MCP server with OAuth or a personal access token.

## Add Onyx

```bash theme={null}
claude mcp add --scope user --transport http onyx https://onyx.example.com/mcp/
claude mcp login onyx
```

Sign in and select **Allow access**. If your version has no `claude mcp login`, enter `/mcp` in Claude Code,
select Onyx, and choose **Authenticate**.
Then send the [test prompt](https://docs.onyx.app/overview/onyx_anywhere/mcp_server.md#test-the-connection).

### Share with a project

To share Onyx with a team, put this in `.mcp.json` at the project root instead.
Each member signs in with their own Onyx account. Use user or project configuration, not both.

```json theme={null}
{
  "mcpServers": {
    "onyx": {
      "type": "http",
      "url": "https://onyx.example.com/mcp/"
    }
  }
}
```

## Personal access token

To use a token instead of OAuth,
export a [personal access token](https://docs.onyx.app/overview/onyx_anywhere/mcp_server.md#use-a-personal-access-token-instead)
as `ONYX_TOKEN` and use this `.mcp.json` entry:

```json theme={null}
{
  "mcpServers": {
    "onyx": {
      "type": "http",
      "url": "https://onyx.example.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${ONYX_TOKEN}"
      }
    }
  }
}
```

Start `claude` from the shell that exports `ONYX_TOKEN`.

## Disconnect

```bash theme={null}
claude mcp logout onyx
claude mcp remove onyx --scope user
```

For a project configuration, remove Onyx from `.mcp.json`. This does not revoke access.
Revoke it in Onyx under [Connected apps](https://docs.onyx.app/overview/onyx_anywhere/mcp_server.md#manage-connected-apps).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.