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

# Set Up Your AI App

> Copy-paste setup for the Smartlead MCP server in Claude, Claude Code, Cursor, OpenAI Codex, ChatGPT and the xAI (Grok) API

Every app connects to the same URL:

```text theme={null}
https://mcp.smartlead.ai/mcp
```

Apps with a sign-in flow (Claude, ChatGPT) use OAuth: you sign in to Smartlead and approve the connection. Developer tools and scripts send your Smartlead API key as `Authorization: Bearer <key>`. A key in the URL (`?user_api_key=`) or in an `X-API-Key` header does **not** work on `/mcp`. See [MCP Server](https://api.smartlead.ai/mcp/overview.md#authentication) for details.

In the examples below, `SMARTLEAD_API_KEY` is an environment variable holding your Smartlead API key. Set it in your shell (for example `export SMARTLEAD_API_KEY=...`) rather than pasting the key into a config file.

## Claude (claude.ai and Claude Desktop)

Add Smartlead as a custom connector. Custom connectors work in claude.ai, Claude Desktop and Cowork, on Free, Pro, Max, Ultra, Team and Enterprise plans (Free plans are limited to one custom connector).

**Pro and Max plans**

1. Go to **Customize > Connectors**.
2. Click **+ Add**, then **Add custom connector**.
3. Name it `Smartlead` and enter the URL `https://mcp.smartlead.ai/mcp`. Click **Continue**.
4. Under **Authentication**, choose a sign-in option (not "No sign in"). If Claude asks how to identify itself (**OAuth client**), choose **Register automatically**.
5. Sign in to Smartlead and approve the connection.

**Team and Enterprise plans:** an Owner first adds the connector in **Organization settings > Connectors** (**Add**, then **Custom**, then **Web**) with the same URL and a sign-in option. Members then find it under **Customize > Connectors**, click **Connect**, and sign in to their own Smartlead account.

Source: [Get started with custom connectors using remote MCP](https://support.claude.com/en/articles/11175166-getting-started-with-custom-connectors-using-remote-mcp).

## Claude Code

With your API key in a header:

```bash theme={null}
claude mcp add --transport http smartlead https://mcp.smartlead.ai/mcp \
  --header "Authorization: Bearer $SMARTLEAD_API_KEY"
```

Your shell expands `$SMARTLEAD_API_KEY` when you run the command, so the key is saved in your Claude Code configuration.

Or without a key, using OAuth: add the server, then sign in from the `/mcp` menu inside Claude Code (or run `claude mcp login smartlead` in your shell).

```bash theme={null}
claude mcp add --transport http smartlead https://mcp.smartlead.ai/mcp
```

Source: [Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp).

## Cursor

Add this to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project). Cursor reads `${env:SMARTLEAD_API_KEY}` from your environment, so the key itself is not stored in the file.

```json mcp.json theme={null}
{
  "mcpServers": {
    "smartlead": {
      "url": "https://mcp.smartlead.ai/mcp",
      "headers": {
        "Authorization": "Bearer ${env:SMARTLEAD_API_KEY}"
      }
    }
  }
}
```

Source: [Cursor docs: Model Context Protocol](https://cursor.com/docs/context/mcp).

## OpenAI Codex (CLI and IDE extension)

The Codex CLI, the IDE extension and the ChatGPT desktop app share this configuration. Add this to `~/.codex/config.toml` (or a trusted project's `.codex/config.toml`). Codex sends the value of the named environment variable as a bearer token.

```toml config.toml theme={null}
[mcp_servers.smartlead]
url = "https://mcp.smartlead.ai/mcp"
bearer_token_env_var = "SMARTLEAD_API_KEY"
```

To use OAuth instead, leave out `bearer_token_env_var` and run `codex mcp login smartlead`.

Source: [Codex docs: Model Context Protocol](https://developers.openai.com/codex/mcp).

## ChatGPT

Add Smartlead as a custom MCP server on ChatGPT on the web. Workspace admins may need to allow custom MCP servers first.

1. Go to [ChatGPT Plugins](https://chatgpt.com/plugins).
2. Select the plus button, then **Add custom MCP server**.
3. Enter the name `Smartlead` and, under **Connection**, the server URL `https://mcp.smartlead.ai/mcp`.
4. Choose **OAuth** for authentication.
5. Review the risk warning, select **I understand and want to continue**, then **Create as a plugin**.
6. Install the plugin, and sign in to Smartlead and approve the connection when asked. In a conversation, type `@` and pick Smartlead.

ChatGPT uses the tools' read-only annotations to decide which calls need your confirmation.

Source: [OpenAI docs: Add custom MCP server](https://platform.openai.com/docs/guides/developer-mode).

## Grok (xAI API)

The xAI Responses API can call remote MCP servers itself. Pass Smartlead as an `mcp` tool with your Smartlead API key in an `Authorization` header:

```bash theme={null}
curl https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
    "model": "grok-4.7",
    "input": [{"role": "user", "content": "List my 5 newest Smartlead campaigns and their status."}],
    "tools": [{
      "type": "mcp",
      "server_url": "https://mcp.smartlead.ai/mcp",
      "server_label": "smartlead",
      "headers": {"Authorization": "Bearer '"$SMARTLEAD_API_KEY"'"},
      "allowed_tools": ["get_campaigns", "get_campaign_by_id", "get_campaign_stats"]
    }]
  }'
```

`allowed_tools` is optional. Without it, all 185 tools are loaded into the model's context. Limiting the list keeps requests smaller and lets you allow only [read-only tools](https://api.smartlead.ai/mcp/tools.md). In the xAI Python SDK, the same fields are `allowed_tool_names` and `extra_headers`.

Source: [xAI docs: Remote MCP Tools](https://docs.x.ai/docs/guides/tools/remote-mcp-tools).

## Other MCP clients

Any client that supports **Streamable HTTP** and either OAuth 2.1 (with dynamic client registration) or a custom `Authorization` header can connect with the URL above. Clients that only support the older HTTP+SSE transport can use the [legacy SSE endpoint](https://api.smartlead.ai/mcp/overview.md#legacy-sse-endpoint-not-recommended), but it puts your key in the URL.

## Check that it works

Ask your app: *"List my Smartlead campaigns."* It should call `get_campaigns` and show your campaigns. If you get an authentication error:

* **401 on `/mcp`:** the key is missing, wrong, or not sent as `Authorization: Bearer <key>`.
* **OAuth sign-in loops:** remove the connector and add it again, then approve the connection in Smartlead.
* **No tools listed:** make sure the URL ends in `/mcp`, not `/sse`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.