OpenAI Ads MCP

io.github.trakkr-aisearch由 GitHub 帳號 trakkr-aisearch 發布v0.1.7更新於 Nov 1, 2026

OpenAI Ads MCP for ChatGPT Ads campaigns, creatives, audiences, insights, and conversions.

已驗證Streamable HTTP可網頁執行資料與分析商業與電商

概覽

AI 產生的概覽

針對 OpenAI Ads(ChatGPT 廣告)的 MCP 伺服器,讓助理檢視廣告帳戶、讀取投放數據,並建立暫停狀態的廣告活動、素材、受眾與轉換。

可以做什麼
  • 讀取帳戶、廣告活動、廣告群組與廣告詳情,以及自訂受眾和地理定向目標
  • 讀取帳戶、活動、群組或廣告層級的成效數據,支援欄位、篩選、排序、區隔、時間範圍與分頁
  • 建立與更新廣告活動、廣告群組和廣告,上傳素材,並分別啟用或暫停各層級
  • 管理轉換像素、事件設定與轉換報表,並送出經驗證的轉換事件
  • 產生 context_hints,並透過受保護的工作流程一次建立整套暫停狀態的廣告活動
適用情境
適合需要管理 OpenAI Ads / ChatGPT Ads 的使用者,讓助理檢視投放成效、草擬廣告結構,或準備素材與受眾,而不必在 Ads Manager 中逐項操作。建議先以唯讀模式確認金鑰並檢視現有資料,再開啟寫入。
執行需求
可作為本機程序透過 uvx 或 npx 執行(Python 或 Node),也可連線託管的 Streamable HTTP 端點。需要 Ads Manager 中的 OpenAI Ads API 金鑰,透過 OPENAI_ADS_API_KEY 或 X-OpenAI-Ads-API-Key 標頭傳入;託管端點允許匿名探索,但呼叫 Ads API 工具必須提供該標頭。可選用 OPENAI_ADS_BUDGET_CEILING_USD 與 OPENAI_ADS_MCP_READONLY。
安裝前請注意
此金鑰僅限單一廣告帳戶,且可動用真實廣告預算。寫入類工具可建立廣告活動、上傳素材、啟用廣告並送出轉換事件;啟用與預算變更被標示為破壞性操作。預算受 OPENAI_ADS_BUDGET_CEILING_USD(預設 100)限制,除非傳入 confirm_budget。轉換事件包含使用者資料。首次連線請設定 OPENAI_ADS_MCP_READONLY=1,公開託管端點應保持寫入關閉。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 OpenAI Ads MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.trakkr-aisearch%2Fopenai-ads-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "openai-ads": {
      "type": "http",
      "url": "https://openai-ads-mcp.trakkr.ai/mcp"
    }
  }
}

README

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.

People often search for this as a ChatGPT Ads MCP because the ads appear in ChatGPT. The package keeps the OpenAI Ads MCP name because ChatGPT Ads are managed through OpenAI Ads, Ads Manager, and the OpenAI Advertiser API.

Current public release: 0.1.7.

It ships in two runtimes with the same tool names, arguments, defaults, safety model, and vendored OpenAPI reference:

RuntimeBest installPackage path
Pythonuvx openai-ads-mcppython/
Nodenpx -y openai-ads-mcptypescript/

The goal is simple: make OpenAI Ads workable from an AI assistant without making spend easy to trigger by accident.

Install

Python with uvx:

bash
export OPENAI_ADS_API_KEY="..."export OPENAI_ADS_MCP_READONLY=1uvx openai-ads-mcp

Python with pip:

bash
python -m pip install openai-ads-mcpexport OPENAI_ADS_API_KEY="..."export OPENAI_ADS_MCP_READONLY=1openai-ads-mcp

Node with npx:

bash
export OPENAI_ADS_API_KEY="..."export OPENAI_ADS_MCP_READONLY=1npx -y openai-ads-mcp

Node with npm:

bash
npm install -g openai-ads-mcpexport OPENAI_ADS_API_KEY="..."export OPENAI_ADS_MCP_READONLY=1openai-ads-mcp

For local development from this monorepo:

bash
cd services/openai-ads-mcp/pythonpython -m pip install -e .python -m openai_ads_mcp
cd ../typescriptnpm installnpm run buildnode dist/index.js

Configuration

Create an Ads API key in OpenAI Ads Manager, then pass it as an environment variable.

bash
export OPENAI_ADS_API_KEY="..."

Recommended first connection:

bash
export OPENAI_ADS_MCP_READONLY=1uvx openai-ads-mcp

Or with Node:

bash
export OPENAI_ADS_MCP_READONLY=1npx -y openai-ads-mcp

Readonly 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:

VariablePurpose
OPENAI_ADS_API_KEYRequired bearer key for https://api.ads.openai.com/v1.
OPENAI_ADS_API_BASE_URLOptional HTTPS override for tests or proxies.
OPENAI_ADS_MCP_READONLYSet to 1 or true to register read tools only.
OPENAI_ADS_BUDGET_CEILING_USDOptional budget guard. Default 100.

Discovery Metadata

This repo includes server.json for the official MCP Registry and downstream MCP directories. The canonical registry name is:

text
io.github.trakkr-aisearch/openai-ads-mcp

The Node package includes the matching mcpName, and the Python package README includes the matching mcp-name marker for PyPI ownership verification.

The registry metadata also advertises the hosted read-only Streamable HTTP endpoint:

text
https://openai-ads-mcp.trakkr.ai/mcp

That hosted endpoint is for discovery and read-only usage. It does not store or use a Trakkr-owned OpenAI Ads API key. The hosted endpoint allows anonymous initialize and tools/list; Ads API tool calls require the caller to send X-OpenAI-Ads-API-Key.

MCP client examples

Claude Code, Python runtime

bash
claude mcp add openai-ads \  -e OPENAI_ADS_API_KEY=your_ads_key_here \  -e OPENAI_ADS_MCP_READONLY=1 \  -- uvx openai-ads-mcp

Claude Code, Node runtime

bash
claude mcp add openai-ads \  -e OPENAI_ADS_API_KEY=your_ads_key_here \  -e OPENAI_ADS_MCP_READONLY=1 \  -- npx -y openai-ads-mcp

Cursor or Claude Desktop

json
{  "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

toml
[mcp_servers.openai_ads]command = "uvx"args = ["openai-ads-mcp"]env = { OPENAI_ADS_API_KEY = "your_ads_key_here", OPENAI_ADS_MCP_READONLY = "1" }

MCP Registry

Registry-compatible clients should discover this server by name:

text
io.github.trakkr-aisearch/openai-ads-mcp

The registry metadata lists npm, PyPI, and the hosted Streamable HTTP endpoint. The hosted endpoint does not require an API key for discovery, but it does require X-OpenAI-Ads-API-Key for Ads API tool calls.

Docker

The repository includes production Dockerfiles for hosted Streamable HTTP deployments:

bash
docker build -t openai-ads-mcp .docker run --rm -p 8080:8080 \  -e OPENAI_ADS_MCP_HOSTED_PUBLIC=1 \  -e OPENAI_ADS_MCP_TELEMETRY_SALT="local-test-salt" \  openai-ads-mcp

The narrower typescript/Dockerfile is used by the Cloud Run deploy script. For local stdio use, prefer uvx openai-ads-mcp or npx -y openai-ads-mcp.

Streamable HTTP

The Node runtime can also serve MCP over Streamable HTTP for hosted or team deployments:

bash
export OPENAI_ADS_MCP_HTTP_TOKEN="choose_a_long_random_token"export OPENAI_ADS_MCP_READONLY=1npx -y openai-ads-mcp --http

Defaults:

  • URL: http://127.0.0.1:8080/mcp locally, or https://your-host/mcp behind a proxy.
  • Health checks: GET /healthz, GET /health, and GET /ready.
  • Remote mode forces OPENAI_ADS_MCP_READONLY=1 unless OPENAI_ADS_MCP_HTTP_ALLOW_WRITES=1 is set.
  • OPENAI_ADS_MCP_HTTP_TOKEN protects the MCP endpoint with Authorization: Bearer <token>.
  • Clients may send X-OpenAI-Ads-API-Key per request, or the server can use a server-side OPENAI_ADS_API_KEY.

Useful hosted env vars:

VariablePurpose
PORT or OPENAI_ADS_MCP_HTTP_PORTHTTP port. Default 8080.
OPENAI_ADS_MCP_HTTP_PATHMCP path. Default /mcp.
OPENAI_ADS_MCP_HEALTH_PATHHealth path. Default /healthz.
OPENAI_ADS_MCP_HTTP_TOKENOptional bearer token required by hosted clients.
OPENAI_ADS_MCP_HTTP_ALLOW_WRITESSet to 1 only when you want write tools exposed over HTTP.
OPENAI_ADS_MCP_HTTP_CORS_ORIGINOptional CORS origin. Default *.

For public hosted endpoints, keep writes disabled and require users to bring their own Ads API key per request. Do not put a shared Ads API key in browser-visible config.

Public hosted mode

For a public discovery endpoint, use:

bash
export OPENAI_ADS_MCP_HOSTED_PUBLIC=1export OPENAI_ADS_MCP_TELEMETRY_SALT="long_random_value"npx -y openai-ads-mcp --http

Hosted public mode:

  • forces readonly mode
  • refuses to start if OPENAI_ADS_MCP_HTTP_ALLOW_WRITES=1
  • refuses to start if OPENAI_ADS_API_KEY is present
  • rejects X-OpenAI-Ads-API-Base-Url
  • allows anonymous initialize and tools/list
  • requires X-OpenAI-Ads-API-Key for Ads API tool calls
  • rate-limits discovery and tool calls
  • logs only redacted summaries, hashes, counts, status, latency, and client metadata

The production runbook is in HOSTED_DEPLOY.md.

Tool Surface

The Python and Node runtimes expose the same 27 tools.

GroupTools
Accountget_account
Campaignslist_campaigns, get_campaign, create_campaign, update_campaign, set_campaign_state
AdGroupslist_ad_groups, get_ad_group, create_ad_group, update_ad_group, set_ad_group_state
Adslist_ads, get_ad, upload_creative, create_ad, update_ad, set_ad_state
Insightsget_insights
Audienceslist_audiences, get_audience, search_geo, manage_audience
Conversionsmanage_conversions, send_conversions
Helpersbuild_campaign, draft_context_hints, bulk_ab_test_hints

High-use tools

ToolWhat it does
get_accountGets the ad account and confirms the API key works.
get_insightsReads account, campaign, ad group, or ad insights with fields, filters, sort, segments, and cursor pagination.
create_campaignCreates a paused campaign with a guarded lifetime budget, including conversion-optimized campaigns with one event setting.
upload_creativeUploads an image URL or local image file and returns file_id.
create_adCreates a paused ad. chat_card requires target_url and file_id.
build_campaignCreates one paused campaign, one paused ad group, and paused ads in a guarded workflow.
draft_context_hintsDeterministically drafts API-shaped context_hints with no hidden LLM call.
send_conversionsSends conversion events to https://bzr.openai.com/v1/events?pid=... after local validation, with optional validate_only. Supports obref and mobile app lifecycle events.

get_insights accepts the current tagged time-range shape, for example:

json
{"type":"unix_range","start":1764547200,"end":1765152000}

The older nested shape is normalized for backward compatibility.

For conversion optimization, pass bidding_type="conversions" and exactly one conversion_event_setting_ids value to create_campaign. The campaign cannot use product-feed mode, and child ad groups must bill by click. build_campaign offers the same path through its singular conversion_event_setting_id helper argument. The bid is a CPA input even though OpenAI bills the child ad group per click.

OpenAI's Bulk API remains a limited preview and is not exposed as a general MCP tool. Product-feed campaign objects are supported, but feed connection and catalog upload still happen in Ads Manager or through OpenAI's supported SFTP flow.

Safety Model

This server can affect real ad spend, so the defaults are deliberately cautious.

  1. Create tools default to paused. build_campaign creates every object paused.
  2. Activations are separate tools: set_campaign_state, set_ad_group_state, and set_ad_state.
  3. Budget-setting paths enforce OPENAI_ADS_BUDGET_CEILING_USD, default 100.
  4. To exceed the ceiling, pass confirm_budget=True.
  5. OPENAI_ADS_MCP_READONLY=1 hides every write tool entirely.
  6. 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.
  7. Use validate_only=true to validate a conversion batch without ingesting it.
  8. 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:

bash
export OPENAI_ADS_API_KEY="..."export OPENAI_ADS_MCP_READONLY=1uvx openai-ads-mcp

Ask your assistant:

text
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:

text
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:

text
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:

text
openai-ads://trakkr-visibility

It 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:

bash
cd services/openai-ads-mcp/pythonpython -m pytest -qpython -c "import openai_ads_mcp; print('ok')"

Node:

bash
cd services/openai-ads-mcp/typescriptnpm installnpm run buildnpm testOPENAI_ADS_MCP_READONLY=1 node dist/index.js

OpenAPI drift check:

bash
cd services/openai-ads-mcp/typescriptnpm run check:openapinpm run check:docs

The scheduled workflow runs both checks weekly. The OpenAPI comparison catches schema drift. The guide check covers current behavior documented outside the downloadable schema, including tagged insight ranges, obref, mobile app events, conversion optimization, advertiser readiness, required chat-card images, and the limited-preview Bulk API.

Release Status

0.1.7 is the current public beta release for npm, PyPI, the hosted endpoint, and the live MCP Registry entry. Registry metadata versions are immutable, so registry-only corrections in this repo should ship with the next package release version. Release work is synced to the dedicated public repository before publishing. See RELEASING.md.

License

MIT, copyright Trakkr.

來源:README.md,提交 4c18f69

工具

13

get_account

Get the authenticated OpenAI Ads account. Use this first to verify that OPENAI_ADS_API_KEY works and to read account id, name, timezone, currency, and settings.

無需輸入參數。

list_campaigns

List campaigns in the authenticated ad account with cursor pagination.

輸入參數afterlimitorderbefore

get_campaign

Get one campaign by id.

輸入參數campaign_id必填

list_ad_groups

List ad groups for a campaign.

輸入參數afterlimitorderbeforecampaign_id必填

get_ad_group

Get one ad group by id.

輸入參數ad_group_id必填

list_ads

List ads in an ad group.

輸入參數afterlimitorderbeforead_group_id必填

get_ad

Get one ad by id, including review_status and creative metadata.

輸入參數ad_id必填

get_insights

Get performance insights for account, campaign, ad group, or ad scope. Supports fields, filters, sort, product/country/device segments, time ranges, and cursor pagination.

輸入參數sortafterlimitscope必填beforefieldsfiltersincludessegmentsentity_idtime_rangeresponse_format另有 3 個

list_audiences

List custom audiences for the authenticated ad account.

輸入參數afterlimitorderbefore

get_audience

Get one custom audience by id.

輸入參數audience_id必填

search_geo

Search geo targets for targeting.locations.include and return ids usable in campaign targeting.

輸入參數query必填

manage_conversions

Manage conversion pixels, API keys, event settings, and conversion reporting.

輸入參數nameafterlimitorderaction必填beforeentity_idsevent_typesource_idsclient_typetime_rangesaggregation_level另有 2 個

draft_context_hints

Draft deterministic context_hints for an ad group from product, audience, intent, and keywords.

輸入參數intentproduct必填audiencekeywords

版本歷史

1
  1. v0.1.7最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分