gravity-ads-mcp
gravity-ads-mcp
适用于 Gravity 广告主仪表盘 API 的本地 MCP 服务器。你可以从任何支持 MCP 的代理中创建、编辑、暂停和归档广告系列,并拉取所有报告数据,而无需将 API 密钥带离你的机器。
Gravity 在 https://platform.trygravity.ai/mcp 提供了一个托管的 MCP 服务器,但它是只读的。本包将完整的 Gravity Dashboard API(包括创建/编辑)封装为一个通过 npx 运行的本地 stdio MCP 服务器,因此请求会直接从你的计算机发送到 platform.trygravity.ai——不会经过任何第三方。
前提条件
Node.js ≥ 18(运行
node --version检查)npx(随 npm 捆绑;Node 自带)
Gravity 广告主 API 密钥——在 https://app.trygravity.ai 的 设置 → API 密钥 下获取
Related MCP server: Nitrosend
快速开始
将以下内容添加到你的 MCP 客户端配置文件中。将 your-gravity-api-key 替换为你的实际密钥。
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%\Claude\claude_desktop_config.json(Windows):
{
"mcpServers": {
"gravity": {
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}Windows 用户: 如果找不到
npx,请尝试使用"command": "cmd"并设置"args": ["/c", "npx", "-y", "gravity-ads-mcp"]。
Claude Code
在你的项目根目录创建 .mcp.json 文件(或添加到 ~/.claude/mcp.json 以进行全局配置):
{
"mcpServers": {
"gravity": {
"type": "stdio",
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}或者通过 CLI 添加:
claude mcp add gravity --env GRAVITY_API_KEY=your-gravity-api-key -- npx -y gravity-ads-mcpCursor
~/.cursor/mcp.json:
{
"mcpServers": {
"gravity": {
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}opencode
在你的项目根目录中的 opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"gravity": {
"type": "local",
"command": ["npx", "-y", "gravity-ads-mcp"],
"environment": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}注意:opencode 使用
"environment"(而不是"env")。
Windsurf
~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"gravity": {
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}其他客户端
任何支持 mcpServers JSON 格式(与 Claude Desktop 相同结构)的 MCP 客户端都可以使用此服务器。将以下内容添加到你的客户端的 MCP 配置文件中:
{
"mcpServers": {
"gravity": {
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}环境变量
变量 | 是否必需 | 默认值 | 说明 |
| 是 | — | 你的 Gravity 广告主 API 密钥 |
| 否 |
| 覆盖基础 URL(用于测试/预发布环境) |
工具
账户
工具 | 说明 |
| 获取广告主资料(ID、名称、邮箱) |
| 列出已连接的 Shopify 商店 |
| 列出所有跟踪像素 |
| 为网站 URL 创建转化像素 |
广告系列
工具 | 说明 |
| 列出所有广告系列及生命周期统计 |
| 完整的广告系列详情及定向配置 |
| 创建包含内联广告组的广告系列 |
| 编辑现有广告系列的字段 |
| 暂停广告系列 |
| 激活广告系列(可能触发计费检查) |
| 切换归档状态 |
广告组与广告
工具 | 说明 |
| 列出广告组及其中嵌入的广告 |
| 单个广告组及其广告 |
| 创建生成式或手动广告组 |
| 更新广告组字段或状态 |
| 归档广告组及其广告 |
| 向手动广告组添加手动广告 |
| 编辑手动广告的文案、CTA 等 |
| 归档手动广告 |
报告
工具 | 说明 |
| 每日时间序列:展示次数、点击次数、花费、转化次数、CTR、CPC、CPM、CPA、ROAS |
| 每个广告单元的每日指标 |
| 每个广告组的每日指标(分页) |
| 最近的转化记录(支持游标分页) |
| 计费摘要(花费、已计费、未计费、积分) |
| 像素事件分析(域名、小时、事件类型) |
| 按事件类型统计的转化时间序列 |
示例提示
配置完成后,你可以尝试向代理提问:
列出我活跃的广告系列
我最近 14 天的 ROAS 是多少?
创建一个名为“夏季促销”的广告系列,每日预算 100 美元,定向美国和加拿大,使用针对跑鞋的生成式广告组
暂停所有花费超过 500 美元的广告系列
以 America/New_York 时区显示广告系列 camp-456 过去 7 天的广告组表现
创建一个手动广告组,包含以下广告:标题“跑鞋五折”,文案“所有跑鞋夏季促销。”,CTA“立即购买”
我昨天获得了哪些转化?
为 https://acme.com 创建一个像素
安全与隐私
你的
GRAVITY_API_KEY作为进程环境变量传递,绝不会被记录或传输到除platform.trygravity.ai以外的任何服务器。所有 API 请求都直接从你的机器发送到 Gravity 的 API——没有中间方。
通过
npx运行意味着无需全局安装;服务器会在每次会话中全新启动。随时在 https://app.trygravity.ai 的 设置 → API 密钥 下重新生成你的密钥。
故障排除
问题 | 修复方法 |
| npx 会在首次调用时下载包——请给它 10–20 秒。 |
401 身份验证错误 | 请仔细检查你的 |
402 广告系列激活被阻止 | 你的计费需要处理——请查看 Gravity 仪表盘中的计费页面。 |
422 验证错误 | 服务器响应中包含详细信息。请让代理检查错误并调整请求负载。 |
OpenAI 账户:每日总计与仪表盘不一致 | 在请求中设置 |
Windows:在 Claude Desktop 中找不到 | 在配置中使用 |
贡献者
有关本地设置、构建、测试和发布的说明,请参阅 DEVELOPMENT.md。
许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server for AI agents to manage ad campaigns across Google, Meta, LinkedIn, Microsoft, Reddit, TikTok, and more217116MIT
- AlicenseNot gradedqualityBmaintenanceAI-native email marketing platform built for agents. Control campaigns, automations, contacts, templates, and analytics via MCP with OAuth authentication.772MIT
- AlicenseAqualityAmaintenanceMCP server for Microsoft Advertising (Bing Ads) REST API enabling agent-led campaign management and reporting. It provides tools to manage campaigns, ad groups, keywords, ads, budgets, and pull performance reports.66MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Google Ads API through MCP, allowing search and listing of accessible customers.Apache 2.0
Related MCP Connectors
AgentIQ MCP for MoltAd: AI agent ads — placements, campaigns, coupons, attribution, cash out.
MCP Server for agents to onboard, pay, and provision services autonomously with InFlow
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/niyogi/gravity-ads-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server