> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/ai/connect/claude-code.md).

# Claude Code

Connect Claude Code to Currents with one command and a browser sign-in, for yourself or for everyone working in a repository

Claude Code connects to the Currents MCP server at `https://mcp.currents.dev/mcp`. Add the server once and sign in from the browser, and Claude Code can read your runs and test results and act on them from any session.

## Add the server

```bash
claude mcp add --transport http --scope user currents https://mcp.currents.dev/mcp
```

`--scope user` makes Currents available in every project on this machine. To share it with your team, see [Share the server with your team](#share-the-server-with-your-team).

## Sign in

1. Start Claude Code and run `/mcp`.
2. Select **currents** and choose **Authenticate**. A browser window opens.
3. Sign in to Currents, choose the organization Claude Code will work in, and approve the permissions it asks for. See [Sign in once](/ai/connect.md#sign-in-once) for what each screen shows.
4. Return to Claude Code. `/mcp` now shows **currents** as connected.

On a machine with no browser, run `claude mcp login currents --no-browser`. It prints the sign-in URL for you to open elsewhere, and asks you to paste back the address the browser lands on.

Claude Code renews the connection on its own from then on. `claude mcp logout currents` clears it on this machine. To revoke it everywhere, remove **Claude Code** under **Account → Connected Applications** in Currents.

## Check the connection

```bash
claude mcp list
```

`currents` shows `✔ Connected` once you are signed in, and `! Needs authentication` before that. Then ask Claude Code something only Currents can answer:

> What failed in the last run of `<project>` on main, and which of those tests are flaky?

## Ask before writes

Claude Code asks before it calls any MCP tool. To let it run the read tools on its own and keep asking for writes, allow the read tools by name in `.claude/settings.json`. Claude Code names each Currents tool `mcp__currents__<tool>`:

```json
{
  "permissions": {
    "allow": [
      "mcp__currents__currents-get-projects",
      "mcp__currents__currents-get-runs",
      "mcp__currents__currents-get-run-details",
      "mcp__currents__currents-find-run",
      "mcp__currents__currents-get-test-results",
      "mcp__currents__currents-get-context",
      "mcp__currents__currents-get-tests-performance"
    ]
  }
}
```

Do not allow `mcp__currents` as a whole: that includes `currents-delete-run`, which deletes a run permanently. [MCP tools and permissions](/ai/reference/mcp-server.md) lists every tool.

## Other options

### Share the server with your team

`--scope` decides where Claude Code saves the entry:

| Scope             | Available in                                    | Saved in                           |
| ----------------- | ----------------------------------------------- | ---------------------------------- |
| `user`            | Every project on this machine                   | `~/.claude.json`                   |
| `local` (default) | The current project, for you                    | `~/.claude.json`                   |
| `project`         | The current project, for everyone who clones it | `.mcp.json` in the repository root |

Add the server with `--scope project` and commit the `.mcp.json` it writes:

```json
{
  "mcpServers": {
    "currents": {
      "type": "http",
      "url": "https://mcp.currents.dev/mcp"
    }
  }
}
```

The file holds no credential. Each person who opens the project approves the server and signs in as themselves, so the connection carries their own role and organization.

### Use the connector from Claude.ai

If you sign in to Claude Code with a Claude.ai account, a Currents connector you connected in Claude.ai works in Claude Code with no `claude mcp add`. Connect it once from the [Claude connectors directory](/ai/connect/claude.md#connect-from-the-claude-directory), and it follows your Claude account to every machine.

The connector shows in `/mcp` as **claude.ai Currents**. Its tool names start with `mcp__claude_ai_Currents__`, so use that prefix in permission rules.

If **claude.ai Currents** is missing from `/mcp`, run `/status` to see which credential Claude Code uses. Claude Code loads Claude.ai connectors only when your Claude.ai login is that credential, not `ANTHROPIC_API_KEY` or a `claude setup-token` token. See [Use MCP servers from claude.ai](https://code.claude.com/docs/en/mcp#use-mcp-servers-from-claude-ai).

### Use an API key

For a CI job, or anywhere no one can complete the browser sign-in, send a Currents API key in a header:

```bash
claude mcp add --transport http currents https://mcp.currents.dev/mcp \
  --header "Authorization: Bearer $CURRENTS_API_KEY"
```

In a committed `.mcp.json`, read the key from the environment so it never lands in the repository:

```json
{
  "mcpServers": {
    "currents": {
      "type": "http",
      "url": "https://mcp.currents.dev/mcp",
      "headers": {
        "Authorization": "Bearer ${CURRENTS_API_KEY}"
      }
    }
  }
}
```

A key acts as the organization, not as a person. See [Connect with an API key](/ai/connect/remote.md#connect-with-an-api-key) for what a key can reach and how to revoke it.

## Troubleshooting

| What you see                  | What to do                                                                                   |
| ----------------------------- | -------------------------------------------------------------------------------------------- |
| `! Needs authentication`      | Run `/mcp`, select **currents** and choose **Authenticate**.                                 |
| The wrong organization's data | Run `claude mcp logout currents`, then authenticate again and choose the other organization. |

For other errors, see [Troubleshooting](/ai/connect.md#troubleshooting).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/ai/connect/claude-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
