OpenAI Ads MCP
Allows interaction with OpenAI Ads, ChatGPT Ads, and OpenAI's Advertiser API, providing tools for managing ad accounts, campaigns, ad groups, ads, creatives, audiences, and conversion events.
openai-ads-mcp
Trakkr tracks the full AI-visibility funnel, organic and paid. This is the open-source paid-side companion.
openai-ads-mcp is a typed Model Context Protocol server for OpenAI Ads, ChatGPT Ads, and OpenAI's Advertiser API. It lets Claude, Cursor, Codex, VS Code, and other MCP clients inspect Ads accounts, read performance insights, build paused campaigns, upload creatives, manage audiences, and send conversion events.
It ships in two runtimes with the same tool names, arguments, defaults, safety model, and vendored OpenAPI reference:
Runtime | Best install | Package path |
Python |
|
|
Node |
|
|
The goal is simple: make OpenAI Ads workable from an AI assistant without making spend easy to trigger by accident.
Install
Python with uvx:
uvx openai-ads-mcpPython with pip:
python -m pip install openai-ads-mcp
openai-ads-mcpNode with npx:
npx -y openai-ads-mcpNode with npm:
npm install -g openai-ads-mcp
openai-ads-mcpFor local development from this monorepo:
cd services/openai-ads-mcp/python
python -m pip install -e .
python -m openai_ads_mcp
cd ../typescript
npm install
npm run build
node dist/index.jsRelated MCP server: facebook-business-mcp
Configuration
Create an Ads API key in OpenAI Ads Manager, then pass it as an environment variable.
export OPENAI_ADS_API_KEY="..."Recommended first connection:
export OPENAI_ADS_MCP_READONLY=1
uvx openai-ads-mcpOr with Node:
export OPENAI_ADS_MCP_READONLY=1
npx -y openai-ads-mcpReadonly mode hides every write tool. They are absent from tools/list and cannot be called. Once you have confirmed the account and inspected data, unset OPENAI_ADS_MCP_READONLY to enable writes.
Optional environment variables:
Variable | Purpose |
| Required bearer key for |
| Optional HTTPS override for tests or proxies. |
| Set to |
| Optional budget guard. Default |
Discovery Metadata
This repo includes server.json for the official MCP Registry and downstream MCP directories. The canonical registry name is:
io.github.trakkr-aisearch/openai-ads-mcpThe Node package includes the matching mcpName, and the Python package README includes the matching mcp-name marker for PyPI ownership verification.
MCP client examples
Claude Code, Python runtime
claude mcp add openai-ads \
-e OPENAI_ADS_API_KEY=your_ads_key_here \
-e OPENAI_ADS_MCP_READONLY=1 \
-- uvx openai-ads-mcpClaude Code, Node runtime
claude mcp add openai-ads \
-e OPENAI_ADS_API_KEY=your_ads_key_here \
-e OPENAI_ADS_MCP_READONLY=1 \
-- npx -y openai-ads-mcpCursor or Claude Desktop
{
"mcpServers": {
"openai-ads": {
"command": "uvx",
"args": ["openai-ads-mcp"],
"env": {
"OPENAI_ADS_API_KEY": "your_ads_key_here",
"OPENAI_ADS_MCP_READONLY": "1"
}
}
}
}Use "command": "npx" and "args": ["-y", "openai-ads-mcp"] for the Node runtime.
Codex CLI
[mcp_servers.openai_ads]
command = "uvx"
args = ["openai-ads-mcp"]
env = { OPENAI_ADS_API_KEY = "your_ads_key_here", OPENAI_ADS_MCP_READONLY = "1" }Docker
The repository includes a root Dockerfile for directories and scanners that build MCP servers directly from source:
docker build -t openai-ads-mcp .
docker run --rm -i -e OPENAI_ADS_MCP_READONLY=1 openai-ads-mcpThe container starts the stdio MCP transport by default so MCP registries can introspect tools, resources, and prompts. For local use, pass OPENAI_ADS_API_KEY and keep OPENAI_ADS_MCP_READONLY=1 for first connection.
Streamable HTTP
The Node runtime can also serve MCP over Streamable HTTP for hosted or team deployments:
export OPENAI_ADS_MCP_HTTP_TOKEN="choose_a_long_random_token"
npx -y openai-ads-mcp --httpDefaults:
URL:
http://127.0.0.1:8080/mcplocally, orhttps://your-host/mcpbehind a proxy.Health check:
GET /healthz.Remote mode forces
OPENAI_ADS_MCP_READONLY=1unlessOPENAI_ADS_MCP_HTTP_ALLOW_WRITES=1is set.OPENAI_ADS_MCP_HTTP_TOKENprotects the MCP endpoint withAuthorization: Bearer <token>.Clients may send
X-OpenAI-Ads-API-Keyper request, or the server can use a server-sideOPENAI_ADS_API_KEY.
Useful hosted env vars:
Variable | Purpose |
| HTTP port. Default |
| MCP path. Default |
| Health path. Default |
| Optional bearer token required by hosted clients. |
| Set to |
| Optional CORS origin. Default |
For public hosted endpoints, keep writes disabled by default and inject Ads API keys server-side through your own OAuth or credential vault. Do not put a shared Ads API key in browser-visible config.
Tool Surface
The Python and Node runtimes expose the same 27 tools.
Group | Tools |
Account |
|
Campaigns |
|
AdGroups |
|
Ads |
|
Insights |
|
Audiences |
|
Conversions |
|
Helpers |
|
High-use tools
Tool | What it does |
| Gets the ad account and confirms the API key works. |
| Reads account, campaign, ad group, or ad insights with fields, filters, sort, segments, and cursor pagination. |
| Creates a paused campaign with a guarded lifetime budget. |
| Uploads an image URL or local image file and returns |
| Creates a paused ad. |
| Creates one paused campaign, one paused ad group, and paused ads in a guarded workflow. |
| Deterministically drafts API-shaped |
| Sends conversion events to |
Safety Model
This server can affect real ad spend, so the defaults are deliberately cautious.
Create tools default to paused.
build_campaigncreates every object paused.Activations are separate tools:
set_campaign_state,set_ad_group_state, andset_ad_state.Budget-setting paths enforce
OPENAI_ADS_BUDGET_CEILING_USD, default100.To exceed the ceiling, pass
confirm_budget=True.OPENAI_ADS_MCP_READONLY=1hides every write tool entirely.Conversion ingest validates at most 1000 events per call, timestamps no older than 7 days, and timestamps no more than 10 minutes in the future.
The server never logs API keys or conversion user data.
MCP annotations are set on every tool. Read tools use readOnlyHint. Write tools use readOnlyHint=false. Activation and budget-changing tools are marked destructive and open-world so hosts can prompt before running them.
Worked Example
First, connect safely:
export OPENAI_ADS_API_KEY="..."
export OPENAI_ADS_MCP_READONLY=1
uvx openai-ads-mcpAsk your assistant:
Call get_account and list_campaigns. Confirm the Ads key works and show me what already exists.Then restart without readonly mode and build a paused campaign:
Use draft_context_hints for "AI visibility monitoring software" aimed at growth teams with comparison intent.
Then call build_campaign with:
- name: "AI visibility category test"
- budget_usd: 50
- ad_group: name "Growth teams", billing_event "click", max_bid_usd 1.25, context_hints from the draft
- ads: two chat_card variants using my uploaded file_id
Do not activate anything.Review the returned campaign, ad group, ads, budget, targeting, and review status. When you are ready to go live, activate each layer explicitly:
Call set_campaign_state with state="activate".
Call set_ad_group_state with state="activate".
Call set_ad_state for the approved ad with state="activate".The Organic Half
Paid placements answer: where did you buy attention?
Trakkr answers: where does your brand show up organically across ChatGPT, Perplexity, Gemini, Claude, Google AI Overviews, Reddit, citations, rankings, competitors, sentiment, prompts, reports, and actions?
Track the organic side at trakkr.ai. Use the Trakkr generator at trakkr.ai/create when you want to turn AI-search gaps into content briefs.
This MCP also exposes one optional resource:
openai-ads://trakkr-visibilityIt returns a short paste-ready briefing that connects buying ChatGPT ad placements with tracking organic ChatGPT visibility. It is never injected into tool results.
Development
Python:
cd services/openai-ads-mcp/python
python -m pytest -q
python -c "import openai_ads_mcp; print('ok')"Node:
cd services/openai-ads-mcp/typescript
npm install
npm run build
npm test
OPENAI_ADS_MCP_READONLY=1 node dist/index.jsOpenAPI drift check:
cd services/openai-ads-mcp/typescript
npm run check:openapiRelease Status
This package is beta. Before the first public release, confirm that the PyPI and npm package names openai-ads-mcp are available. See RELEASING.md.
License
MIT, copyright Trakkr.
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/trakkr-aisearch/openai-ads-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server