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

# Claude Code

Connect Claude Code to Zenlytic's MCP server so it can query your business data directly from the command line.

Claude Code connects to remote MCP servers over HTTP transport from the command line. See [MCP Server](https://docs.zenlytic.com/mcp/connecting-to-zenlytic.md) for what you get once connected and general prerequisites.

## Before you start

You'll need the MCP URL that matches your Zenlytic instance. The US, EU, and company-specific patterns are listed in [Before you start](https://docs.zenlytic.com/mcp/connecting-to-zenlytic.md#before-you-start) on the MCP Server page.

## Connect with OAuth (recommended)

1. Add the server. The command below uses the US URL — if you're on the EU instance or a company-specific URL, swap in [the one for your instance](https://docs.zenlytic.com/mcp/connecting-to-zenlytic.md#before-you-start):

```bash
claude mcp add --transport http zenlytic https://mcp.zenlytic.com/mcp
```

2. Inside Claude Code, run `/mcp`, select **zenlytic**, and click **Authenticate**.
3. Complete the OAuth login/approval flow in the browser window that opens, and pick your workspace.

Claude Code stores the token and refreshes it automatically, so you shouldn't need to re-authenticate unless you revoke access.

## Connect with a Personal Access Token (alternative)

If OAuth isn't available, add the server with a static bearer header instead. Creating one requires the Admin (or Organization Admin) role — see [Option 2](https://docs.zenlytic.com/mcp/connecting-to-zenlytic.md#option-2-connect-with-a-personal-access-token-for-static-config-clients-or-when-oauth-isnt-available).

1. In Zenlytic, go to **Settings → Profile → Personal Access Tokens** (`/personal-access-tokens`), click **Create token**, and copy it immediately — it's only shown once.
2. Add the server with the token as a header, again swapping in [the URL for your instance](https://docs.zenlytic.com/mcp/connecting-to-zenlytic.md#before-you-start) if you're not on the US instance:

```bash
claude mcp add --transport http zenlytic https://mcp.zenlytic.com/mcp \
  --header "Authorization: Bearer <your-personal-access-token>"
```

## Using it

Once connected, ask Claude Code a data question naturally, for example:

> "Hey Zoë, who were our top 5 customers by revenue last month?"

Claude will call the `ask_zoe` tool and return the answer along with a link back to the full conversation in Zenlytic.

## Troubleshooting

* **"Unauthorized" or repeated login prompts:** run `/mcp`, select **zenlytic**, and re-authenticate, or generate a new Personal Access Token.
* **Server not found:** double-check the URL with `claude mcp list`, and confirm it with your workspace admin.
* **Not sure what got asked/answered:** open Zenlytic and check your conversation history — MCP conversations appear there just like conversations started in the app.


---

# 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.zenlytic.com/mcp/connecting-to-zenlytic/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.
