Openai Ads Mcp

io.github.HYPD-AI由 GitHub 账号 HYPD-AI 发布v0.1.3更新于 Oct 24, 2026

Read-only MCP server for the OpenAI Ads API: campaigns, ad groups, ads, and insights.

已验证STDIO仅桌面数据与分析商业与电商

概览

AI 生成的概览

只读 MCP 服务器,让助手查询 OpenAI Ads 的广告账户、广告系列、广告组、广告和效果数据。

可以做什么
查询当前密钥绑定的广告账户并验证连通性,列出或获取单个广告系列和广告组,包括预算、定向和出价设置,列出或获取广告及其创意与审核状态,按日期范围获取账户、广告系列、广告组或单条广告的效果数据,支持按日或汇总粒度、字段选择、排序、筛选和游标分页,原样返回 API 的 JSON,并透出 HTTP 状态码和错误内容。
适用场景
适合用自然语言向助手询问 OpenAI Ads 的投放情况,例如在投广告系列及其预算、某段时间的花费、点击和点击率,或哪些广告仍在审核中,而无需打开广告后台。
运行要求
以 stdio 方式在本机运行,通常通过 npx 启动,需要 Node.js 20 或更高版本。需要 OpenAI Ads API 密钥,通过环境变量 OPENAI_ADS_API_KEY 提供;每个密钥仅限一个广告账户,账户目前仅限美国。需要能访问 OpenAI Ads API 的网络;可选 OPENAI_ADS_BASE_URL 覆盖接口地址。
安装前请注意
服务器环境中保存 OpenAI Ads API 密钥,请妥善保管客户端配置。当前版本只读,不能创建、修改、暂停或删除任何内容,也不会花费预算,但 README 说明后续将加入写操作。这是非官方社区项目,与 OpenAI 无关联,API 使用仍受 OpenAI 条款约束。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Openai Ads Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

openai-ads-mcp

A Model Context Protocol (MCP) server for the OpenAI Ads (Advertiser) API. It lets MCP-compatible clients — Claude Desktop, Cursor, VS Code, and others — read your OpenAI Ads campaigns, ad groups, ads, and performance insights through natural language.

[npm] [CI] [License: MIT] [Node] [MCP]

Read-only. This first release only reads data — it never creates, edits, or pauses anything and never spends budget. Write actions are on the roadmap.

Unofficial. This is a community project and is not affiliated with or endorsed by OpenAI. See the disclaimer.


Overview

The OpenAI Ads API exposes an advertiser's account, campaigns, ad groups, ads, and reporting. This server wraps the read endpoints of that API as MCP tools so an AI assistant can answer questions like:

  • "Is my OpenAI Ads API key working? What account is it tied to?"
  • "List my active campaigns and their budgets."
  • "Show spend, clicks, and CTR for campaign cmp_123 over the last 30 days, by day."
  • "Which ads in ad group adg_456 are still pending review?"

Features

  • 11 read-only tools covering the account, campaigns, ad groups, ads, and insights at every level.
  • Faithful responses — the API's JSON is returned as-is, so nothing is lost in translation.
  • Clear errors — HTTP status and the API error body are surfaced to the model instead of being swallowed.
  • Micros-aware — every tool description explains the micros convention so the assistant can present human-readable currency.
  • Cursor pagination passthrough (limit, order, after, before).
  • Zero-install via npx — npx -y @hypd-ai/openai-ads-mcp, no clone or build.

Tools

ToolWhat it does
get_ad_accountFetch the ad account for the configured key. Great as a connectivity check.
list_campaignsList campaigns (objective, budget, country targeting).
get_campaignFetch a single campaign by ID.
list_ad_groupsList ad groups, optionally filtered by campaign.
get_ad_groupFetch a single ad group by ID (bidding config, context hints).
list_adsList ads, optionally filtered by ad group.
get_adFetch a single ad by ID (creative + review status).
get_account_insightsPerformance insights for the whole account.
get_campaign_insightsPerformance insights for one campaign.
get_ad_group_insightsPerformance insights for one ad group.
get_ad_insightsPerformance insights for one ad.

Insights tools accept since/until (YYYY-MM-DD) for the reporting window, plus time_granularity (daily/none), aggregation_level, fields, sort, filters, limit (1–10000), and after/before cursors.

Prerequisites

Installation & configuration

MCP clients launch the server as a subprocess and pass your API key via an environment variable.

Published on npm as @hypd-ai/openai-ads-mcp — npx fetches it for you, so there's nothing to clone or build. To run the latest unreleased main instead, replace @hypd-ai/openai-ads-mcp with github:HYPD-AI/openai-ads-mcp (its first launch builds from source — see Running from source).

Add the snippet for your client below.

Claude Desktop

Edit your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "openai-ads": {      "command": "npx",      "args": ["-y", "@hypd-ai/openai-ads-mcp"],      "env": {        "OPENAI_ADS_API_KEY": "your-openai-ads-api-key"      }    }  }}

Restart Claude Desktop, then ask: "Use the openai-ads tools to look up my ad account."

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):

json
{  "mcpServers": {    "openai-ads": {      "command": "npx",      "args": ["-y", "@hypd-ai/openai-ads-mcp"],      "env": {        "OPENAI_ADS_API_KEY": "your-openai-ads-api-key"      }    }  }}

VS Code

Add to .vscode/mcp.json. VS Code can prompt for the key and store it as a secret via inputs:

json
{  "inputs": [    {      "type": "promptString",      "id": "openai_ads_api_key",      "description": "OpenAI Ads API key",      "password": true    }  ],  "servers": {    "openai-ads": {      "command": "npx",      "args": ["-y", "@hypd-ai/openai-ads-mcp"],      "env": {        "OPENAI_ADS_API_KEY": "${input:openai_ads_api_key}"      }    }  }}

Other MCP clients

Any client that speaks MCP over stdio works. Run npx -y @hypd-ai/openai-ads-mcp (or node /path/to/dist/index.js) with OPENAI_ADS_API_KEY set in the environment.

Configuration

VariableRequiredDefaultDescription
OPENAI_ADS_API_KEYYes—Your OpenAI Ads API key, sent as a Bearer token.
OPENAI_ADS_BASE_URLNohttps://api.ads.openai.com/v1Override the API base URL (useful for testing or a proxy).

See .env.example.

A note on "micros"

Fields whose names end in _micros — for example a campaign's lifetime_spend_limit_micros or an ad group's max_bid_micros — are expressed in micros:

1,000,000 micros = 1 unit of the account's currency   (e.g. $1.00 = 1,000,000 micros)

So a lifetime_spend_limit_micros of 25000000 is $25.00. Divide a _micros value by 1,000,000 to display a human amount, or multiply by 1,000,000 to convert the other way.

Insights metrics are not micros. Reporting values like spend, cpc, and cpm are already in the account's currency as decimals (e.g. spend: 42.75 means $42.75).

Read-only by design

This release registers only read (GET) tools — and each one is annotated with the MCP readOnlyHint, so well-behaved clients know it cannot mutate state. There is no tool here that can create, edit, pause, or delete anything, and nothing that can spend budget. Write actions will arrive as a deliberate, separately reviewed step (see Roadmap).

Running from source

bash
git clone https://github.com/hypd-ai/openai-ads-mcp.gitcd openai-ads-mcpnpm installnpm run build

Then point your MCP client at the built entry file:

json
{  "mcpServers": {    "openai-ads": {      "command": "node",      "args": ["/absolute/path/to/openai-ads-mcp/dist/index.js"],      "env": {        "OPENAI_ADS_API_KEY": "your-openai-ads-api-key"      }    }  }}

Try it with the MCP Inspector

bash
OPENAI_ADS_API_KEY=your-key npx @modelcontextprotocol/inspector node dist/index.js

Development

bash
npm install          # install dependenciesnpm run dev          # rebuild on change (tsup --watch)npm run typecheck    # tsc --noEmitnpm run lint         # eslintnpm run format       # prettier --writenpm test             # vitestnpm run build        # bundle to dist/

Project layout:

src/  index.ts        # bin entry: load config, build server, connect stdio  server.ts       # buildServer(): McpServer + register all tools  client.ts       # OpenAIAdsClient: auth, URL building, errors  config.ts       # environment parsing & validation  schemas.ts      # shared zod shapes (pagination, insights) + micros note  tools/          # one file per resource (account, campaigns, ad-groups, ads, insights)test/             # vitest specs (config, client, in-memory server)

How tools map to the API

All endpoints are under the base URL (default https://api.ads.openai.com/v1).

ToolMethodEndpoint
get_ad_accountGET/ad_account
list_campaignsGET/campaigns
get_campaignGET/campaigns/{campaign_id}
list_ad_groupsGET/ad_groups
get_ad_groupGET/ad_groups/{ad_group_id}
list_adsGET/ads
get_adGET/ads/{ad_id}
get_account_insightsGET/ad_account/insights
get_campaign_insightsGET/campaigns/{campaign_id}/insights
get_ad_group_insightsGET/ad_groups/{ad_group_id}/insights
get_ad_insightsGET/ads/{ad_id}/insights

Roadmap

  • ✍️ Write actions — create & update (via POST) campaigns, ad groups, and ads, plus the dedicated state transitions (POST .../activate, .../pause, .../archive). The HTTP client already supports POST; these will be gated behind an explicit opt-in, since they change delivery and spend.
  • 🖼️ Creative uploads — POST /upload (JSON image_url or multipart/form-data) to attach images to ad creatives.
  • 🌍 Campaign targeting — country include/exclude (targeting.locations.countries).
  • 📈 Conversions API support.
  • 🌐 Remote/HTTP transport for hosted deployments.
  • 📦 Published npm release so npx -y openai-ads-mcp works out of the box.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md. In short: open an issue to discuss substantial changes, keep npm run lint && npm run typecheck && npm test green, and add tests for new behavior.

Disclaimer

This is an unofficial, community-built project. It is not affiliated with, endorsed by, or sponsored by OpenAI. "OpenAI" and related names and logos are trademarks of OpenAI. Your use of the OpenAI Ads API through this tool is subject to OpenAI's terms and policies. The tool is provided "as is", without warranty of any kind — see the license.

License

MIT © HYPD AI

来源:README.md,提交 d96ee62

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

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

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分