> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# MCP Integration

> Step-by-step instructions to connect BeatAPI's hosted remote MCP server (https://beatapi.io/mcp) to Claude Code, Codex, Cursor, Gemini CLI, Antigravity, OpenCode, VS Code, and other HTTP MCP clients.

**BeatAPI MCP** is BeatAPI's hosted remote tool server at `https://beatapi.io/mcp`. After you connect an AI client to `https://beatapi.io/mcp`, the AI client can search Xiaohongshu, Douyin, X, YouTube, and other social platforms, check SEO rankings, search and read live web pages, and call 70+ text, image, video, and music models directly inside chat.

BeatAPI MCP uses the Model Context Protocol (MCP) over Streamable HTTP. You do not need to install or run a local MCP server on your computer. Connecting requires only two values: the server URL `https://beatapi.io/mcp` and a BeatAPI API key.

> **Two different setups:** This page gives an AI client access to BeatAPI **tools** (social data, SEO, web search, media models). To switch the chat model inside Claude Code, Codex CLI, Gemini CLI, or Cursor to BeatAPI, use the model-provider guides under [Integrations](/integrations): [Claude Code](/integrations/claude-code), [Codex CLI](/integrations/codex-cli), [Gemini CLI](/integrations/gemini-cli), or [Cursor](/integrations/cursor).

## Step 1: Create a BeatAPI API key

Every HTTP MCP client starts with a BeatAPI API key.

1. Open [BeatAPI Dashboard → API Keys](https://beatapi.io/dashboard/apikeys) and sign in.
2. Create a new key and name the key after your AI client (for example, `cursor-mcp` or `claude-code-mcp`). Using one key per AI client lets you track each client's spending and disable one client without affecting other clients.
3. Copy the new BeatAPI API key (usually starting with `sk-`). BeatAPI displays the full key only once. Keep the key private and do not post the key in public chats or repositories.

Every HTTP MCP client uses these exact two connection values:

* **Server URL:** `https://beatapi.io/mcp`
* **Authorization header:** Header name `Authorization`, header value `Bearer sk-YOUR-BEATAPI-KEY` (keep one space between `Bearer` and the key)

## Step 2: Configure your AI client

Find your AI client below and follow the numbered steps. If your config file already lists other MCP servers, add the `beatapi` block alongside those entries without deleting your existing servers.

### Claude Code

In the terminal, one command adds BeatAPI MCP to Claude Code.

1. Open your terminal.
2. Replace `sk-YOUR-BEATAPI-KEY` with your BeatAPI API key, then run:

```bash
claude mcp add --transport http beatapi https://beatapi.io/mcp \
  --header "Authorization: Bearer sk-YOUR-BEATAPI-KEY"
```

3. Run `claude mcp list`. Seeing `beatapi` in the output confirms Claude Code registered the server.
4. Start Claude Code and type `/mcp`. If Claude Code prompts for project approval, confirm the server URL is `https://beatapi.io/mcp` and approve.

If you prefer a project config file instead of the command, create or open `.mcp.json` in your project root and add the block below (replace `sk-YOUR-BEATAPI-KEY` with your BeatAPI API key, and never commit a file with a raw key to a public Git repository):

```json
{
  "mcpServers": {
    "beatapi": {
      "type": "http",
      "url": "https://beatapi.io/mcp",
      "headers": {
        "Authorization": "Bearer sk-YOUR-BEATAPI-KEY"
      }
    }
  }
}
```

### Codex (CLI and Desktop)

Codex reads MCP servers from `~/.codex/config.toml` and reads your BeatAPI API key from the `BEATAPI_API_KEY` environment variable.

1. Save your BeatAPI API key as `BEATAPI_API_KEY`:
   * **macOS / Linux:** Add `export BEATAPI_API_KEY="sk-YOUR-BEATAPI-KEY"` to the end of `~/.zshrc` (or `~/.bashrc` on Linux), save the file, and run `source ~/.zshrc`.
   * **Windows (PowerShell):** Run `[System.Environment]::SetEnvironmentVariable("BEATAPI_API_KEY", "sk-YOUR-BEATAPI-KEY", "User")`, then close PowerShell and open a new PowerShell window.
2. Open `~/.codex/config.toml` (create `~/.codex/config.toml` if the file does not exist).
3. Add these three lines to `~/.codex/config.toml` and save the file:

```toml
[mcp_servers.beatapi]
url = "https://beatapi.io/mcp"
bearer_token_env_var = "BEATAPI_API_KEY"
```

4. Start a new Codex session. Run `codex mcp list` in the terminal or type `/mcp` inside Codex to confirm `beatapi` is loaded.

### Cursor

Adding BeatAPI MCP to `~/.cursor/mcp.json` makes BeatAPI MCP available in every Cursor workspace.

1. Open Cursor and click the gear icon to open **Cursor Settings → Tools & Integrations → MCP**.
2. Click **Add new global MCP server**. Cursor opens `~/.cursor/mcp.json`.
3. Add the block below to `~/.cursor/mcp.json` and replace `sk-YOUR-BEATAPI-KEY` with your BeatAPI API key:

```json
{
  "mcpServers": {
    "beatapi": {
      "url": "https://beatapi.io/mcp",
      "headers": {
        "Authorization": "Bearer sk-YOUR-BEATAPI-KEY"
      }
    }
  }
}
```

4. Save `~/.cursor/mcp.json`, then fully quit Cursor and reopen Cursor.
5. Open **Cursor Settings → Tools & Integrations → MCP** again. Seeing a green dot and 7 tools next to `beatapi` confirms the connection works.

### Gemini CLI

Gemini CLI reads remote MCP servers from `~/.gemini/settings.json` using the `httpUrl` field.

1. Open `~/.gemini/settings.json` (create `~/.gemini/settings.json` if the file does not exist).
2. Add `beatapi` inside `mcpServers` and replace `sk-YOUR-BEATAPI-KEY` with your BeatAPI API key:

```json
{
  "mcpServers": {
    "beatapi": {
      "httpUrl": "https://beatapi.io/mcp",
      "headers": {
        "Authorization": "Bearer sk-YOUR-BEATAPI-KEY"
      }
    }
  }
}
```

3. Save `~/.gemini/settings.json` and start a new Gemini CLI session.
4. Type `/mcp` inside Gemini CLI. Seeing `beatapi` connected confirms setup is complete.

### Antigravity

Antigravity reads remote MCP servers from `mcp_config.json` using the `serverUrl` field.

1. Open Antigravity's MCP panel and click **Manage MCP Servers → View raw config** to open `mcp_config.json`.
2. Add `beatapi` inside `mcpServers` and replace `sk-YOUR-BEATAPI-KEY` with your BeatAPI API key:

```json
{
  "mcpServers": {
    "beatapi": {
      "serverUrl": "https://beatapi.io/mcp",
      "headers": {
        "Authorization": "Bearer sk-YOUR-BEATAPI-KEY"
      }
    }
  }
}
```

3. Save `mcp_config.json`, return to Antigravity's MCP panel, and click **Refresh**.
4. Confirm that Antigravity shows `beatapi` as connected with 7 tools.

### OpenCode

OpenCode reads remote MCP servers from `opencode.json`.

1. Open or create `opencode.json` in your project root (or global OpenCode config folder).
2. Add `beatapi` and replace `sk-YOUR-BEATAPI-KEY` with your BeatAPI API key (or write `Bearer {env:BEATAPI_API_KEY}` if you store the key in an environment variable):

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "beatapi": {
        "type": "remote",
        "url": "https://beatapi.io/mcp",
        "oauth": false,
        "headers": {
          "Authorization": "Bearer sk-YOUR-BEATAPI-KEY"
        }
      }
    }
  }
}
```

3. Save `opencode.json`. Run `opencode mcp list` in the terminal to confirm `beatapi` appears.

### VS Code (GitHub Copilot)

VS Code reads workspace MCP servers from `.vscode/mcp.json` and collects your BeatAPI API key through a hidden password prompt, without storing a plaintext key in `.vscode/mcp.json`.

1. Create or open `.vscode/mcp.json` in your workspace and paste the block below as-is:

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "beatapi_api_key",
      "description": "BeatAPI API Key",
      "password": true
    }
  ],
  "servers": {
    "beatapi": {
      "type": "http",
      "url": "https://beatapi.io/mcp",
      "headers": {
        "Authorization": "Bearer ${input:beatapi_api_key}"
      }
    }
  }
}
```

2. Save `.vscode/mcp.json`, then click the **Start** button above `beatapi` inside `.vscode/mcp.json`.
3. Paste your BeatAPI API key into the VS Code password box and press **Enter**.

### Hermes

Open your Hermes YAML config and add `beatapi` under `mcp_servers` (replace `sk-YOUR-BEATAPI-KEY` with your BeatAPI API key):

```yaml
mcp_servers:
  beatapi:
    url: "https://beatapi.io/mcp"
    headers:
      Authorization: "Bearer sk-YOUR-BEATAPI-KEY"
```

### Other clients (WorkBuddy, Doubao Work, QwenWork, and generic HTTP MCP apps)

Any client that supports **Remote MCP / Streamable HTTP** with custom HTTP headers uses these four steps:

1. Open the client's **MCP** or **Connectors** settings and choose **Add custom MCP server**.
2. Enter `https://beatapi.io/mcp` as the server URL.
3. Add one custom header: header name `Authorization`, header value `Bearer sk-YOUR-BEATAPI-KEY`.
4. Save the configuration and refresh the tool list.

> **Using Muse, Grok Bot, Manus, or OpenClaw?** Cloud chat clients do not use local MCP config files. Follow the [Agent Skill Integration](/integrations/skill) and send `set up https://beatapi.io/SKILL.md` in chat.

## Step 3: Verify the connection for free

Send this test prompt to your connected AI client. Verification costs `$0`:

> List the BeatAPI tools you can see. Then search BeatAPI for Xiaohongshu note search, check the required inputs and single-call price, and stop before running a paid call.

All three outcomes confirm BeatAPI MCP is working:

1. Your AI client lists the 7 BeatAPI tools.
2. Your AI client returns a real Xiaohongshu note search capability ID.
3. Your AI client shows the required inputs and single-call price without charging your BeatAPI balance.

## Billing and cost control

Once connected to BeatAPI MCP, your AI client can run data queries, read web pages, or generate media directly. Paid runs deduct from your BeatAPI balance at the same rates as direct API calls.

* **Searching and price checks are free:** `capabilities_search` and `capabilities_inspect` cost `$0`. Failed calls also cost `$0`.
* **Check the price first and start small:** Ask your AI client to show the price first, wait for your approval, and fetch 1 page or generate 1 test output before scaling up.
* **Retrieve full results free within 1 hour:** BeatAPI MCP returns a 10-item preview first to save chat tokens. If you want the remaining items from that same batch, ask your AI client to fetch the full saved result from the previous request — BeatAPI returns the saved result for free within 1 hour.

## Key management and disconnecting

Create one key per AI client in [BeatAPI Dashboard → API Keys](https://beatapi.io/dashboard/apikeys) so you can view spending per client.

To revoke an AI client's access completely, delete or disable that client's key in [BeatAPI Dashboard → API Keys](https://beatapi.io/dashboard/apikeys). Deleting the local MCP config file inside Cursor or Claude Code does not revoke the key on BeatAPI.

> **Optional tip for shared Git repositories:** Never commit a raw `sk-...` key to Git. Store your key in the `BEATAPI_API_KEY` environment variable and reference the variable using your client's syntax: `${BEATAPI_API_KEY}` in Claude Code, `${env:BEATAPI_API_KEY}` in Cursor, `{env:BEATAPI_API_KEY}` in OpenCode, or `$BEATAPI_API_KEY` in Gemini CLI.

## The 7 tools exposed by BeatAPI MCP

After connecting to `https://beatapi.io/mcp`, your AI client receives 7 hosted tools. You can describe your goal in plain language without typing tool names:

* `capabilities_search` (free): search BeatAPI for social data, SEO data, ads data, AI models, and media workflows.
* `capabilities_inspect` (free): check the required inputs and single-call price of a capability before running it.
* `capabilities_run` (paid per call): execute the selected BeatAPI capability and check status on slower image or video jobs.
* `web_search` (paid per call): search the live web and return titles, URLs, and snippets.
* `web_read` (paid per call): fetch and read the main text of a webpage URL.
* `web_map` (paid per call): list URLs inside a website so your AI client knows which pages to read.
* `web_research` (paid per call): run multi-source web research and return cited findings.

## Example prompts

After free verification succeeds, try any of these prompts:

* "Use BeatAPI to search Xiaohongshu notes about 'portable espresso maker'. Tell me the price for 1 page first. After I confirm, fetch 1 page and summarize the top 5 user complaints with note links."
* "Use BeatAPI to check the SEO domain overview and top pages for `redis.io`, and present the findings in a table."
* "Use `web_search` and `web_read` to check Cloudflare Workers' current pricing tiers and list the official URLs you actually read."
* "Search BeatAPI for a product-demo video model, show me the required inputs and single-clip price, and wait for my approval before generating."

## Troubleshooting

* **No `beatapi` tools appear in your AI client:** Check your JSON or TOML file for missing quotes or extra commas, then fully quit and restart the AI client. Confirm the client supports remote HTTP MCP (stdio-only clients cannot connect to a remote URL).
* **401 error (missing or invalid key):** Confirm `Authorization` starts with `Bearer ` with one space before `sk-...`. If you use an environment variable, fully restart your desktop app after setting the variable. If the error continues, create a fresh key in [BeatAPI Dashboard → API Keys](https://beatapi.io/dashboard/apikeys).
* **400 error (missing required inputs):** Your AI client skipped checking the inputs. Tell your AI client to call `capabilities_inspect` first and retry. Installing the [Agent Skill](/integrations/skill) alongside MCP prevents skipped checks.
* **Only 10 results appear:** BeatAPI MCP returns a 10-item preview by default. Ask your AI client to fetch the full saved result from the previous request (free within 1 hour) instead of running a second search.
* **Video generation or deep research times out:** Slow jobs can exceed a single request timeout without failing. Ask your AI client to check the status of the returned task ID instead of starting a second paid run.

## Related pages

* [Agent Skill Integration](/integrations/skill) — pair with MCP so your AI client checks prices before running, or connect Muse, Grok Bot, Manus, and OpenClaw.
* [CLI Integration](/integrations/cli) — run BeatAPI from the terminal and upload local media files to public URLs.
* [Capabilities API Reference](/capabilities) — full developer reference for the underlying HTTP endpoints.