gravity-ads-mcp
Enables MCP-capable agents to create, edit, pause, archive campaigns, and pull advertising reports from the Gravity Ads platform directly, without the API key leaving the local machine.
README
gravity-ads-mcp
Local MCP server for the Gravity advertiser dashboard API. Create, edit, pause, and archive campaigns — and pull all your reporting — from any MCP-capable agent without your API key leaving your machine.
Gravity exposes a hosted MCP server at https://platform.trygravity.ai/mcp, but it is read-only. This package wraps the full Gravity Dashboard API (including create/edit) as a local stdio MCP server that runs via npx, so requests go directly from your computer to platform.trygravity.ai — nothing passes through a third party.
Prerequisites
- Node.js ≥ 18 (
node --versionto check) - npx (bundled with npm; comes with Node)
- A Gravity advertiser API key — get yours at https://app.trygravity.ai under Settings → API Key
Quickstart
Add the following to your MCP client's configuration file. Replace your-gravity-api-key with your actual key.
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %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 users: If
npxis not found, try"command": "cmd"with"args": ["/c", "npx", "-y", "gravity-ads-mcp"].
Claude Code
Create a .mcp.json file in your project root (or add to ~/.claude/mcp.json for global config):
{
"mcpServers": {
"gravity": {
"type": "stdio",
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}
Or add via CLI:
claude mcp add gravity --env GRAVITY_API_KEY=your-gravity-api-key -- npx -y gravity-ads-mcp
Cursor
~/.cursor/mcp.json:
{
"mcpServers": {
"gravity": {
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}
opencode
opencode.json in your project root:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"gravity": {
"type": "local",
"command": ["npx", "-y", "gravity-ads-mcp"],
"environment": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}
Note: opencode uses
"environment"(not"env").
Windsurf
~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"gravity": {
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}
Other Clients
Any MCP client that supports the mcpServers JSON format (same shape as Claude Desktop) can use this server. Add the following to your client's MCP config file:
{
"mcpServers": {
"gravity": {
"command": "npx",
"args": ["-y", "gravity-ads-mcp"],
"env": {
"GRAVITY_API_KEY": "your-gravity-api-key"
}
}
}
}
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
GRAVITY_API_KEY |
Yes | — | Your Gravity advertiser API key |
GRAVITY_BASE_URL |
No | https://platform.trygravity.ai |
Override the base URL (for testing/staging) |
Tools
Account
| Tool | Description |
|---|---|
gravity_get_info |
Get advertiser profile (ID, name, email) |
gravity_list_integrations |
List connected Shopify stores |
gravity_list_pixels |
List all tracking pixels |
gravity_create_pixel |
Create a conversion pixel for a site URL |
Campaigns
| Tool | Description |
|---|---|
gravity_list_campaigns |
List all campaigns with lifetime stats |
gravity_get_campaign |
Full campaign details with targeting config |
gravity_create_campaign |
Create a campaign with inline ad groups |
gravity_update_campaign |
Edit fields on an existing campaign |
gravity_pause_campaign |
Pause a campaign |
gravity_activate_campaign |
Activate a campaign (may trigger billing check) |
gravity_archive_campaign |
Toggle archive state |
Ad Groups & Ads
| Tool | Description |
|---|---|
gravity_list_ad_groups |
List ad groups with embedded ads |
gravity_get_ad_group |
Single ad group with its ads |
gravity_create_ad_group |
Create a generative or manual ad group |
gravity_update_ad_group |
Update ad group fields or status |
gravity_archive_ad_group |
Archive an ad group and its ads |
gravity_create_ad |
Add a manual ad to a manual ad group |
gravity_update_ad |
Edit a manual ad's copy, CTA, etc. |
gravity_archive_ad |
Archive a manual ad |
Reporting
| Tool | Description |
|---|---|
gravity_get_metrics |
Daily time-series: impressions, clicks, spend, conversions, CTR, CPC, CPM, CPA, ROAS |
gravity_get_ad_unit_metrics |
Per-ad-unit daily metrics |
gravity_get_ad_group_metrics |
Per-ad-group daily metrics (paginated) |
gravity_list_conversions |
Recent conversions with cursor pagination |
gravity_get_billing |
Billing summary (spend, billed, unbilled, credits) |
gravity_get_events_analytics |
Pixel event analytics (domains, hourly, event types) |
gravity_get_conversion_stats |
Conversion time-series by event type |
Example Prompts
Once configured, try asking your agent:
- "List my active campaigns"
- "What's my ROAS for the last 14 days?"
- "Create a campaign called 'Summer Sale' with a $100/day budget, targeting US and CA, using a generative ad group for running shoes"
- "Pause all campaigns over $500 spend"
- "Show me ad group performance for campaign camp-456 over the last 7 days in America/New_York"
- "Create a manual ad group with these ads: headline '50% Off Running Shoes', copy 'Summer sale on all running shoes.', CTA 'Shop Now'"
- "What conversions did I get yesterday?"
- "Create a pixel for https://acme.com"
Security & Privacy
- Your
GRAVITY_API_KEYis passed as a process environment variable and never logged or transmitted to any server other thanplatform.trygravity.ai. - All API requests go directly from your machine to Gravity's API — no intermediary.
- Running via
npxmeans no global install; the server starts fresh each session. - Regenerate your key anytime at https://app.trygravity.ai under Settings → API Key.
Troubleshooting
| Problem | Fix |
|---|---|
npx hangs on first run |
npx downloads the package on first invocation — give it 10–20 seconds. |
| 401 Authentication error | Double-check your GRAVITY_API_KEY. Regenerate at https://app.trygravity.ai if needed. |
| 402 Campaign activation blocked | Your billing needs attention — check the Billing page in your Gravity dashboard. |
| 422 Validation error | The server response includes details. Ask your agent to check the error and adjust the payload. |
| OpenAI accounts: daily totals differ from dashboard | Set "tz": "America/New_York" in your request. OpenAI ad accounts report in that timezone. |
Windows: npx not found in Claude Desktop |
Use "command": "cmd" with "args": ["/c", "npx", "-y", "gravity-ads-mcp"] in your config. |
Contributors
For local setup, building, testing, and publishing instructions, see DEVELOPMENT.md.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。