Skip to main content
Transport-specific guide for integrating AdCP using the Model Context Protocol. For task handling, status management, and workflow patterns, see Task Lifecycle.

Testing AdCP via MCP

You can test AdCP tasks using the CLI or by chatting with Addie, the AgenticAdvertising.org assistant.

Tool Call Patterns

Basic Tool Invocation

Tool Call with Filters

Tool Call with Application-Level Context

MCP Response Format

New in AdCP 1.6.0: All responses include unified status field. MCP responses use a flat structure where task-specific fields are at the top level alongside protocol fields:

MCP-Specific Fields

  • context_id: Session identifier that you must manually manage
  • context: Opaque initiator-provided metadata echoed by agents
  • status: Same values as A2A protocol for consistency
  • Task-specific fields (e.g., products, media_buy_id, creatives) are at the top level, not wrapped in a data object
Status Handling: See Task Lifecycle for complete status handling patterns.

Available Tools

All AdCP tasks are available as MCP tools:

Protocol Tools

Media Buy Tools

Task Management Tools

Signals Tools

Task Parameters: See individual task documentation in Media Buy and Signals sections. Task Management: For comprehensive guidance on tracking async operations, polling patterns, and webhook integration, see Webhooks.

Context Management (MCP-Specific)

Critical: MCP requires manual context management. You must pass context_id to maintain conversation state.

Context Session Pattern

Usage Examples

Basic Session with Context

Async Operations with Webhooks

MCP doesn’t define push notifications. AdCP fills this gap by specifying the webhook configuration (pushNotificationConfig) and payload format (mcp-webhook-payload.json). When you configure a webhook, the server will POST task updates to your URL instead of requiring you to poll. Webhook Envelope: mcp-webhook-payload.json
Best Practice: URL-Based Routing
Recommended: Encode routing information (task_type, operation_id) in the webhook URL, not the payload. Why this approach?
  • Industry standard pattern - Widely adopted for webhook routing across major APIs
  • Separation of concerns - URLs handle routing, payloads contain data
  • Protocol-agnostic - Same pattern works for MCP, A2A, REST, future protocols
  • Simpler handlers - Route with URL framework, not payload parsing
URL Pattern Options:
Example Configuration:
Webhook POST format:
Note: This example follows the recommended URL-based routing pattern where task_type and operation_id are passed in the URL (e.g., /webhooks/adcp/create_media_buy/op_456). While the schema still supports these fields in the payload for backward compatibility, they are deprecated. The result field contains the AdCP data payload. For completed/failed statuses, this is the full task response (e.g., create-media-buy-response.json). For other statuses, use the status-specific schemas (e.g., create-media-buy-async-response-working.json).

MCP Webhook Envelope Fields

The mcp-webhook-payload.json envelope includes: Required fields:
  • task_id — Unique task identifier for correlation
  • status — Current task status (completed, failed, working, input-required, etc.)
  • timestamp — ISO 8601 timestamp when webhook was generated
Optional fields:
  • domain — AdCP domain (“media-buy” or “signals”)
  • context_id — Conversation/session identifier
  • message — Human-readable context about the status change
Deprecated fields (supported but not recommended):
  • task_type — Task name (e.g., “create_media_buy”, “sync_creatives”) - ⚠️ Deprecated: See URL-Based Routing
  • operation_id — Correlates a sequence of updates for the same operation - ⚠️ Deprecated: See URL-Based Routing
Data field:
  • result — Task-specific AdCP payload (see Data Schema Validation below)

Webhook Trigger Rules

Webhooks are sent when all of these conditions are met:
  1. Task type supports async (e.g., create_media_buy, sync_creatives, get_products)
  2. pushNotificationConfig is provided in the request
  3. Task runs asynchronously — initial response is working or submitted
If the initial response is already terminal (completed, failed, rejected), no webhook is sent—you already have the result. Status changes that trigger webhooks:
  • working → Progress update (task actively processing)
  • input-required → Human input needed
  • completed → Final result available
  • failed → Error details

Data Schema Validation

The result field in MCP webhooks uses status-specific schemas: Schema reference: async-response-data.json

Webhook Handler Example

Task Management and Polling

Context Expiration Handling

Key Difference: Unlike A2A which manages context automatically, MCP requires explicit context_id management.

Handling Async Operations

When a task returns working or submitted status, you have two options for receiving updates:

Option 1: Polling

Use tasks/get to check task status periodically:

Option 2: Webhooks

Configure a webhook URL and the server will POST updates to you directly. This is more efficient for long-running tasks since you don’t need to keep polling.
See Webhooks for webhook payload formats and handling examples.

Handling Different Statuses

Integration Example

MCP-Specific Considerations

Tool Discovery

AdCP Extension via MCP Server Card

Recommended: Use get_adcp_capabilities for runtime capability discovery. The server card extension provides static metadata for tool catalogs and registries.
MCP servers can declare AdCP support via a server card at /.well-known/mcp.json (or /.well-known/server.json). AdCP-specific metadata goes in the _meta field using the adcontextprotocol.org namespace.
Discovering AdCP support:
Benefits:
  • Clients can discover AdCP capabilities without making test calls
  • Declare which protocol domains you implement (media_buy, creative, signals)
  • Declare which typed extensions you support (see Context & Sessions)
  • Enable compatibility checks based on version
Note: The _meta field uses reverse DNS namespacing per the MCP server.json spec. AdCP servers should support both /.well-known/mcp.json and /.well-known/server.json locations.

Parameter Validation

Error Handling

Best Practices

  1. Use session wrapper for automatic context management
  2. Check status field before processing response data
  3. Handle context expiration gracefully with retries
  4. Reference Core Concepts for status handling patterns
  5. Validate parameters using MCP tool schemas when available

Next Steps

For status handling, async operations, and clarification patterns, see Task Lifecycle - this guide focuses on MCP transport specifics only.