Testing AdCP via MCP
You can test AdCP tasks using the reference implementation at testing.adcontextprotocol.org. This endpoint implements all AdCP tasks as MCP tools and is useful for development and integration testing.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-Specific Fields
- context_id: Session identifier that you must manually manage
- context: Opaque initiator-provided metadata echoed by agents
- data: Direct JSON structure (vs. A2A’s artifact parts)
- status: Same values as A2A protocol for consistency
Available Tools
All AdCP tasks are available as MCP tools:Media Buy Tools
Task Management Tools
Signals Tools
Context Management (MCP-Specific)
Critical: MCP requires manual context management. You must passcontext_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
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
Themcp-webhook-payload.json envelope includes:
Required fields:
task_id— Unique task identifier for correlationstatus— Current task status (completed, failed, working, input-required, etc.)timestamp— ISO 8601 timestamp when webhook was generated
domain— AdCP domain (“media-buy” or “signals”)context_id— Conversation/session identifiermessage— Human-readable context about the status change
task_type— Task name (e.g., “create_media_buy”, “sync_creatives”) - ⚠️ Deprecated: See URL-Based Routingoperation_id— Correlates a sequence of updates for the same operation - ⚠️ Deprecated: See URL-Based Routing
result— Task-specific AdCP payload (see Data Schema Validation below)
Webhook Trigger Rules
Webhooks are sent when all of these conditions are met:- Task type supports async (e.g.,
create_media_buy,sync_creatives,get_products) pushNotificationConfigis provided in the request- Task runs asynchronously — initial response is
workingorsubmitted
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 neededcompleted→ Final result availablefailed→ Error details
Data Schema Validation
Theresult field in MCP webhooks uses status-specific schemas:
| Status | Schema | Contents |
|---|---|---|
completed | [task]-response.json | Full task response (success branch) |
failed | [task]-response.json | Full task response (error branch) |
working | [task]-async-response-working.json | Progress info (percentage, step) |
input-required | [task]-async-response-input-required.json | Requirements, approval data |
submitted | [task]-async-response-submitted.json | Acknowledgment (usually minimal) |
async-response-data.json
Webhook Handler Example
Task Management and Polling
Context Expiration Handling
Handling Async Operations
When a task returnsworking or submitted status, you have two options for receiving updates:
| Approach | Best For | Trade-offs |
|---|---|---|
| Polling | Simple integrations, short tasks | Easy to implement, but inefficient for long waits |
| Webhooks | Production systems, long-running tasks | More efficient, but requires a public endpoint |
Option 1: Polling
Usetasks/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.Handling Different Statuses
Integration Example
MCP-Specific Considerations
Tool Discovery
AdCP Extension (Future)
Status: MCP server cards are expected in a future MCP release. When available, AdCP servers will include the AdCP extension.Parameter Validation
Error Handling
Best Practices
- Use session wrapper for automatic context management
- Check status field before processing response data
- Handle context expiration gracefully with retries
- Reference Core Concepts for status handling patterns
- Validate parameters using MCP tool schemas when available
Next Steps
- Core Concepts: Read Core Concepts for status handling and workflows
- Task Reference: See Media Buy Tasks and Signals
- Protocol Comparison: Compare with A2A integration
- Examples: Find complete workflow examples in Core Concepts