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

# Connect Claude Code

> Add the Ocean Security MCP server to Claude Code via the CLI or an .mcp.json file.

## Overview

[Claude Code](https://docs.claude.com/en/docs/claude-code) is Anthropic's agentic CLI. This
guide adds Ocean as a remote MCP server so you can query threats, metrics, phishing reports,
and allow/deny lists directly from Claude Code.

For connection details and the full tool catalog, see the
[MCP Server Overview](/api-reference/mcp/overview).

## Prerequisites

* Claude Code installed (`npm install -g @anthropic-ai/claude-code`).
* MCP access enabled for your tenant.
* An Ocean account to sign in with — or, if you're using the API key method, an Ocean **API
  key** (see [Authentication](/api-reference/introduction#authentication)).

## Add with OAuth (recommended)

Add the server with no credential, then authenticate in the browser:

```bash theme={null}
claude mcp add --transport http ocean https://api.ocean.security/mcp
```

Start Claude Code, run `/mcp`, select **ocean**, and choose to authenticate. A browser window
opens where you sign in with your Ocean account and approve the access Claude asked for.
Claude Code stores the resulting token and refreshes it automatically.

<Note>
  OAuth access to Ocean is **read-only**. If you need the allow/deny write tools, use an API
  key instead — see [Authentication](/api-reference/mcp/overview#authentication).
</Note>

## Add with an API key

Pass your API key as a header instead:

```bash theme={null}
claude mcp add --transport http ocean https://api.ocean.security/mcp --header "X-Api-Key: YOUR_API_KEY"
```

## Add via `.mcp.json`

To share the server with your team, commit a `.mcp.json` file at the root of your project.
With no `headers` block, each teammate authenticates with their own Ocean account over OAuth:

```json .mcp.json theme={null}
{
  "mcpServers": {
    "ocean": {
      "type": "http",
      "url": "https://api.ocean.security/mcp"
    }
  }
}
```

To use an API key here instead, add a `headers` block with `X-Api-Key`.

<Warning>
  Don't commit a real API key. Reference an environment variable instead —
  `"X-Api-Key": "${OCEAN_API_KEY}"` — and have each teammate export `OCEAN_API_KEY` in their
  shell.
</Warning>

## Verify the connection

<Steps>
  <Step title="List your MCP servers">
    Run `claude mcp list` and confirm `ocean` appears and shows as connected.
  </Step>

  <Step title="Check inside a session">
    Start Claude Code and run the `/mcp` command. `ocean` should be listed as authenticated,
    along with its available tools.
  </Step>

  <Step title="Ask a question">
    Try a prompt such as **"Use Ocean to list this week's threats"** and confirm Claude calls
    an Ocean tool and returns data.
  </Step>
</Steps>

## Troubleshooting

* **`ocean` not listed / failed to connect.** Re-check the URL
  (`https://api.ocean.security/mcp`). Remove and re-add with `claude mcp remove ocean`.
* **`/mcp` keeps asking you to authenticate.** Remove and re-add the server so Claude Code
  re-runs the OAuth flow from scratch.
* **Tools call but return 401.** With an API key, the key is missing, expired, or inactive —
  update it. With OAuth, re-authenticate from `/mcp`.
* **No tools shown for `ocean`.** MCP access may not be enabled for your tenant, or your
  identity lacks the relevant permissions. See the
  [overview troubleshooting](/api-reference/mcp/overview#troubleshooting).
