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

# Connect Claude or Codex

> Use your Datalyr data from Claude, Codex, and other remote MCP clients.

Datalyr provides a hosted, read-only MCP server. Connect it once with your Datalyr account, then ask your AI client about analytics, customers, attribution, ads, revenue, profit, and usage.

```text theme={null}
https://api.datalyr.com/mcp
```

You do not need an Anthropic or OpenAI API key. Your AI subscription and Datalyr account stay separate, and Datalyr never receives your Claude or Codex subscription credentials.

## Connect Claude

For an individual Claude account:

1. Open **Customize → Connectors** in Claude.
2. Select **+ → Add custom connector**.
3. Enter `Datalyr` as the name and `https://api.datalyr.com/mcp` as the remote MCP URL.
4. Select **Add**, then **Connect**.
5. Sign in to Datalyr and allow read-only access.

On Claude Team or Enterprise, an Owner first adds the URL under **Organization settings → Connectors**. Each member then opens **Customize → Connectors** and connects their own Datalyr account.

Start a new conversation and ask: `List my Datalyr workspaces.`

## Connect Codex

Add the Streamable HTTP server from a terminal:

```bash theme={null}
codex mcp add datalyr --url https://api.datalyr.com/mcp
codex mcp login datalyr --scopes datalyr:read
```

Complete the Datalyr sign-in and consent page in your browser. The configuration is then available to Codex surfaces that share your MCP configuration.

## What the connection can read

The server can list workspaces you belong to and read:

* overview, traffic, devices, locations, and realtime activity
* events, event names, users, and user journeys
* campaign attribution and ad performance
* revenue, certified commerce metrics, tracking-link tags, and usage

If your account has more than one workspace, the client first lists them and passes the selected workspace ID to later tools.

<Warning>
  MCP results can contain customer, campaign, and financial data. Only connect AI clients and organizations you trust. AI-generated conclusions can be wrong; verify high-impact decisions against the corresponding Datalyr report.
</Warning>

## Access and key safety

The connection uses OAuth. Claude or Codex receives a short-lived, read-only token, not the workspace Agent key. The MCP server checks your current workspace membership on every tool call.

The connection cannot change tracking, settings, sources, conversion rules, team membership, or billing.

## Disconnect or troubleshoot

Remove Datalyr from your client's connector or MCP settings to stop that client from requesting new data.

If authentication fails, remove the connection and add it again. Make sure your Datalyr account still belongs to the workspace you are trying to query.

If an analytics request fails, ask the client to call `list_workspaces` again and include the returned workspace ID. Date-based tools accept a complete start and end time, or neither; omitting both uses the last 30 days.
