Developer Documentation

MCP Server (AI Agents)

Integrating with an AI coding agent?
Point Claude Code, Cursor, or Codex at https://adsrouter.ai/llms-full.txt — it contains every endpoint, auth header, JSON schema, Koah bridge snippet, and beacon rule in one self-contained file.

Connect Antigravity, Cursor, Windsurf, Claude Desktop, or Claude Code directly to AdsRouter's hosted Streamable HTTP MCP server at https://api.adsrouter.ai/mcp — giving your AI agent 21 workspace-scoped tools to create properties, launch or pause campaigns, configure mediation, and pull reports.

Endpoint & Authentication

  • Endpoint: https://api.adsrouter.ai/mcp (JSON-RPC 2.0 Streamable HTTP, MCP protocol 2025-03-26)
  • Key type: Workspace-scoped Management API Key (ar_mgmt_...) created at https://app.adsrouter.ai/api-keys.
  • Dual auth: Authenticate using either Authorization: Bearer ar_mgmt_... header or ?api_key=ar_mgmt_... query string (for MCP clients that only accept a URL).
  • Security & auditing: All 21 tools are strictly scoped to the key's workspace, never return decrypted BYOK network secrets, and log every mutation to ar_audit_logs with actor_type: "mcp".

Client Configuration

Pick your MCP client below and replace ar_mgmt_YOUR_KEY with a key from Dashboard → API Keys:

{
  "mcpServers": {
    "adsrouter": {
      "url": "https://api.adsrouter.ai/mcp",
      "headers": {
        "Authorization": "Bearer ar_mgmt_YOUR_KEY"
      }
    }
  }
}
{
  "mcpServers": {
    "adsrouter": {
      "url": "https://api.adsrouter.ai/mcp?api_key=ar_mgmt_YOUR_KEY"
    }
  }
}
# Option 1: Authorization header (recommended)
claude mcp add --transport http adsrouter https://api.adsrouter.ai/mcp \
  --header "Authorization: Bearer ar_mgmt_YOUR_KEY"

# Option 2: Querystring URL
claude mcp add --transport http adsrouter "https://api.adsrouter.ai/mcp?api_key=ar_mgmt_YOUR_KEY"

Complete Tool Catalog (21 Tools)

Properties (7 tools)

ToolKey InputsEffect
list_propertiesnoneLists all properties in your workspace.
get_propertyproperty_idFetches full metadata for one property.
create_propertyname, kind, domain / app_id, optional freq capsCreates a property and returns its one-time ar_sec_ secret.
update_propertyproperty_id + fields to patchUpdates domain, allowed_origins, test_mode, status, or freq caps.
rotate_property_secretproperty_idIssues a new ar_sec_ secret with a grace window for the old one.
archive_propertyproperty_idSets property status to archived (disables ad serving).
delete_propertyproperty_idPermanently deletes a property.

Campaigns — Direct-Sold & House (6 tools)

ToolKey InputsEffect
list_campaignsoptional scope, statusLists workspace direct-sold and house campaigns.
get_campaigncampaign_idFetches full targeting, dayparting, pacing, caps, and creative JSON.
create_campaignname, scope (direct|house), creative, optional targeting/dayparting/capsCreates a new campaign (defaults to draft unless status: "active" is passed). External creative.image_url and favicon_url are automatically mirrored to AdsRouter's CDN.
update_campaigncampaign_id + fields to patchUpdates targeting, schedule, pacing, caps, or creative (external creative images are mirrored to AdsRouter's CDN).
set_campaign_statuscampaign_id, status (active|paused|draft|archived)Starts, pauses, drafts, or archives a campaign in one call.
delete_campaigncampaign_idPermanently deletes a workspace campaign.

Mediation & BYOK Networks (6 tools)

ToolKey InputsEffect
list_networksnoneLists configured BYOK network credentials (secrets masked as ••••last4).
upsert_network_credentialnetwork (gravity|thrad|velocity|koah), config_public, secrets, optional property_id, enabledEncrypts and stores BYOK credentials; never echoes plaintext secrets back.
delete_network_credentialcredential_idDeletes a BYOK network credential row.
get_property_routingproperty_idReturns default and placement-specific mediation rules for a property.
save_property_routingproperty_id, strategy (priority|split), targets[], optional placementSaves waterfall priority or seeded weighted split targets.
delete_property_routingproperty_id, rule_idDeletes a mediation rule (reverts to default waterfall).

Reporting (2 tools)

ToolKey InputsEffect
get_reporting_summaryoptional days (default 30), property_idReturns totals and breakdowns by property, source, and day (requests, fills, fill rate, impressions, clicks, CTR).
get_recent_impressionsoptional limit, property_idReturns recent impression records (source, placement, device, country, viewed/clicked timestamps).

Example Prompts for Your AI Agent

Provision & Launch

"Create a web property for chat.myapp.com with a daily freq cap of 10, set up an active direct-sold campaign for Acme Cloud targeting US mobile users who mention Postgres, and pause my old Q3 promo."

Mediation & Performance

"Show me the last 7 days of fill rate and CTR by demand source for my main chat property, then update its chat_below_answer waterfall to put Direct first, Gravity second, and House last."