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

# MCP Server

> Connect AI assistants to the AudienceLab API via the Model Context Protocol

## Overview

AudienceLab provides a remote [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that lets AI assistants interact with the AudienceLab API. Create audiences, enrich contacts, manage pixels, and more — all through natural language.

<Note>
  Curious how this MCP server was built? It's generated from our OpenAPI spec — check out [openapi-to-mcp](https://github.com/AudienceLabV3/openapi-to-mcp) on GitHub to see how it works under the hood.
</Note>

## Quick Setup

Add the following to your MCP client configuration:

<CodeGroup>
  ```bash Claude Code theme={null}
  claude mcp add audiencelab --transport http https://mcp.audiencelab.io/mcp --header "X-Api-Key: YOUR_API_KEY"
  ```

  ```toml Codex theme={null}
  [mcp_servers.audiencelab]
  url = "https://mcp.audiencelab.io/mcp"
  http_headers = { "X-Api-Key" = "YOUR_API_KEY" }
  ```

  ```json Cursor theme={null}
  {
    "mcpServers": {
      "audiencelab": {
        "url": "https://mcp.audiencelab.io/mcp",
        "headers": {
          "X-Api-Key": "YOUR_API_KEY"
        }
      }
    }
  }
  ```

  ```json VS Code theme={null}
  {
    "mcpServers": {
      "audiencelab": {
        "type": "http",
        "url": "https://mcp.audiencelab.io/mcp",
        "headers": {
          "X-Api-Key": "YOUR_API_KEY"
        }
      }
    }
  }
  ```
</CodeGroup>

Replace `YOUR_API_KEY` with your AudienceLab API key.

## stdio-only Clients

For MCP clients that only support stdio transport, use [mcp-remote](https://www.npmjs.com/package/mcp-remote) as a proxy:

```json theme={null}
{
  "mcpServers": {
    "audiencelab": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.audiencelab.io/mcp",
        "--header",
        "X-Api-Key:YOUR_API_KEY"
      ]
    }
  }
}
```

## Available Tools

The MCP server exposes all AudienceLab API endpoints as tools:

| Tool                     | Description                            |
| ------------------------ | -------------------------------------- |
| `create_audience`        | Create an audience with filters        |
| `get_audiences`          | List all audiences                     |
| `audience_lookup`        | Get audience data by ID                |
| `preview_audience`       | Preview audience count before creating |
| `create_custom_audience` | Create a custom intent audience        |
| `audience_attributes`    | Get available filter attribute values  |
| `audience_delete`        | Delete an audience                     |
| `enrich_contact`         | Real-time contact enrichment           |
| `create_enrichment_job`  | Upload records for batch enrichment    |
| `get_enrichments`        | List enrichment jobs                   |
| `create_pixel`           | Create a new pixel                     |
| `get_pixels`             | List all pixels                        |
| `pixel_lookup`           | Get pixel events                       |
| `pixel_delete`           | Delete a pixel                         |

## Authentication

The MCP server uses your AudienceLab API key for authentication. Pass it in the `X-Api-Key` header. The server forwards it to the AudienceLab API on each request.

Your API key is never stored on the MCP server.
