# X Ads

Connects X Ads accounts to your MCP client via direct stdio. Inspect campaign stats, check targeting parameters, and prepare guarded updates.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI
- Author: get-mcp-ads
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/get-mcp-ads/x-ads-mcp-server
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/x-ads

## What it does

This MCP server links your assistant directly to the X Ads API over stdio. It provides 25 read operations and 21 write operations. The assistant can pull delivery metrics, check line-item targeting settings, and inspect accounts filtered through an explicit allowlist.

Mutations stay off out of the box. Exposing write tools demands setting `X_ADS_ENABLE_WRITES` strictly to `true` alongside the `ads.write` permission scope. Every mutation runs in preview mode first; actually applying an update requires sending `confirm: true`. Newly drafted entities begin in a paused state.

The server will fail on app-only bearer tokens because the official API demands a user OAuth 2.0 token. No browser authorization flow or refresh token loop exists here: you must provide fresh tokens manually and restart the process. The runtime requires Node.js 22.23.4, 24.22.1, or 26.12.1 at minimum.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `X_ADS_ACCESS_TOKEN`, `X_ADS_ACCOUNT_IDS`, `X_ADS_SCOPES`, `X_ADS_ENABLE_WRITES` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env X_ADS_ACCESS_TOKEN=<X_ADS_ACCESS_TOKEN> --env X_ADS_ACCOUNT_IDS=<X_ADS_ACCOUNT_IDS> --env X_ADS_SCOPES=<X_ADS_SCOPES> --env X_ADS_ENABLE_WRITES=<X_ADS_ENABLE_WRITES> --transport stdio x-ads -- npx -y @getmcpads/x-ads-mcp-server
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add x-ads --env X_ADS_ACCESS_TOKEN=<X_ADS_ACCESS_TOKEN> --env X_ADS_ACCOUNT_IDS=<X_ADS_ACCOUNT_IDS> --env X_ADS_SCOPES=<X_ADS_SCOPES> --env X_ADS_ENABLE_WRITES=<X_ADS_ENABLE_WRITES> -- npx -y @getmcpads/x-ads-mcp-server
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "x-ads": {
            "command": "npx",
            "args": [
                "-y",
                "@getmcpads/x-ads-mcp-server"
            ],
            "env": {
                "X_ADS_ACCESS_TOKEN": "<X_ADS_ACCESS_TOKEN>",
                "X_ADS_ACCOUNT_IDS": "<X_ADS_ACCOUNT_IDS>",
                "X_ADS_SCOPES": "<X_ADS_SCOPES>",
                "X_ADS_ENABLE_WRITES": "<X_ADS_ENABLE_WRITES>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "x-ads": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@getmcpads/x-ads-mcp-server"
            ],
            "env": {
                "X_ADS_ACCESS_TOKEN": "<X_ADS_ACCESS_TOKEN>",
                "X_ADS_ACCOUNT_IDS": "<X_ADS_ACCOUNT_IDS>",
                "X_ADS_SCOPES": "<X_ADS_SCOPES>",
                "X_ADS_ENABLE_WRITES": "<X_ADS_ENABLE_WRITES>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e X_ADS_ACCESS_TOKEN=<X_ADS_ACCESS_TOKEN> -e X_ADS_ACCOUNT_IDS=<X_ADS_ACCOUNT_IDS> -e X_ADS_SCOPES=<X_ADS_SCOPES> -e X_ADS_ENABLE_WRITES=<X_ADS_ENABLE_WRITES> x-ads npx -y @getmcpads/x-ads-mcp-server
```
Replace <…> with your own values

## When to use it
- retrieve campaign performance and spend figures from X Ads
- audit targeting parameters across specified ad account IDs
- preview and apply campaign or line item renames safely
- upload media files under 4 MB directly to the ad library

## Example prompts
- Inspect performance metrics for all active campaigns in my configured accounts.
- Preview a name change for line item 987654 to Retargeting Tier 1.
- Apply the renamed campaign 123456 with confirm set to true.

## Similar
- [ads-x](https://affpapa.org/en/nevibecode/skills/ads-x.md) — skill · 567 installs
- [paid-ads-x](https://affpapa.org/en/nevibecode/skills/paid-ads-x.md) — skill · ★ 4071
- [google-ads-report](https://affpapa.org/en/nevibecode/skills/google-ads-report.md) — skill · 476 installs
- [LinkedIn Ads MCP by AdPlug](https://affpapa.org/en/nevibecode/mcp/linkedin-ads-mcp-by-adplug.md) — MCP server · ★ 41
- [Google Ads MCP by Markifact](https://affpapa.org/en/nevibecode/mcp/google-ads-mcp-by-markifact.md) — MCP server · ★ 1
- [Amazon Ads](https://affpapa.org/en/nevibecode/mcp/get-mcp-ads-amazon-ads.md) — MCP server

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
