What is MCP? The Protocol Connecting AI to Ad Platforms
A plain-English explanation of the Model Context Protocol (MCP), how it differs from REST APIs for AI agents, and which tools support it today.
The Problem MCP Solves
Large language models are good at reasoning, summarizing, and generating text. But they cannot do anything in the real world on their own. They cannot check your ad spend, pause a campaign, or pull a performance report. They are brains without hands.
To give AI models the ability to take actions, you need a structured interface -- a way for the model to discover what tools are available, understand what parameters each tool accepts, call those tools, and process the results. Various approaches have been tried: function calling, plugin systems, custom tool use protocols. Most are proprietary and incompatible.
The Model Context Protocol (MCP) is an open standard that solves this. It defines a universal way for AI models to interact with external tools and data sources.
How MCP Works
MCP follows a client-server architecture:
MCP Client (AI application)
|
| JSON-RPC over stdio/SSE
|
MCP Server (tool provider)
|
| HTTP/native calls
|
External Service (Meta Ads API, database, etc.)
The MCP client is the AI application -- Claude Desktop, Cursor, ChatGPT, or your custom agent. It speaks the MCP protocol to discover and invoke tools.
The MCP server is the tool provider. It exposes a set of tools with typed schemas and handles the actual work of calling external services. Xylo's MCP server, for example, translates tool calls into Xylo REST API requests.
Communication happens over JSON-RPC, typically through stdio (for local servers) or Server-Sent Events (for remote servers).
The Three Primitives
MCP defines three core primitives:
1. Tools
Tools are functions that the AI can call. Each tool has a name, a description, and an input schema. The AI uses the description to decide when to call the tool and the schema to construct valid arguments.
Example tool definition:
{
"name": "list_campaigns",
"description": "List all advertising campaigns with performance metrics for the connected ad account. Supports filtering by status and date range.",
"inputSchema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": ["active", "paused", "archived"],
"description": "Filter by campaign status"
},
"date_preset": {
"type": "string",
"enum": ["today", "yesterday", "last_7d", "last_30d"],
"description": "Time range for performance metrics"
}
}
}
}
When the AI decides it needs campaign data, it calls this tool with appropriate arguments. The MCP server executes the request and returns the results.
2. Resources
Resources are data that the AI can read. Unlike tools (which perform actions), resources provide context. Think of them as files or documents the AI can access.
For ad management, resources might include:
- Account-level settings and limits
- Targeting option catalogs
- Creative asset libraries
3. Prompts
Prompts are reusable templates that help structure AI interactions for specific tasks. An MCP server can provide prompts like "Daily performance review" or "Campaign optimization suggestions" that guide the AI's approach to common workflows.
MCP vs. REST APIs for AI
Why not just have AI agents make HTTP requests directly? Here is a practical comparison:
REST API Approach
User: "How are my campaigns doing?"
AI thinks: "I need to make an HTTP GET request to some endpoint.
What's the URL? What headers do I need? What query parameters
are available? Let me try to construct this..."
AI generates:
GET https://api.example.com/v1/campaigns?fields=name,status,spend
Headers: Authorization: Bearer ...
Problems:
- AI has to know or guess the exact URL structure
- No discovery mechanism for available endpoints
- Error responses are unstructured text
- No type safety on parameters
- AI may hallucinate endpoints that don't exist
MCP Approach
User: "How are my campaigns doing?"
AI thinks: "I have a list_campaigns tool available. Its description
says it returns campaigns with performance metrics. I'll use the
last_7d date preset for a weekly view."
AI calls:
tool: list_campaigns
args: { date_preset: "last_7d" }
Advantages:
- AI discovers available tools automatically
- Typed schemas prevent invalid parameters
- Structured responses are easy to process
- No URL construction or header management
- Tools are documented in-context
The key difference is discoverability. With MCP, the AI knows exactly what it can do because the tools are explicitly listed with descriptions and schemas. With raw REST, the AI has to know (or guess) the API structure.
Which AI Tools Support MCP?
MCP adoption has grown rapidly. As of early 2026, these tools support MCP:
Desktop Applications:
- Claude Desktop -- full MCP support with local server management
- Cursor -- MCP support for code-related tools
- Windsurf -- MCP integration for development workflows
API-Based Models:
- Claude API (Anthropic) -- native MCP tool use
- GPT-4/GPT-4o (OpenAI) -- MCP support through compatible function calling
- Various open-source models through frameworks like LangChain
Development Frameworks:
- LangChain -- MCP tool adapters
- LlamaIndex -- MCP integration
- Vercel AI SDK -- MCP client support
Setting Up an MCP Server
If you are building your own MCP server (or just want to understand how they work), here is the basic structure using the official TypeScript SDK:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({
name: "my-ads-server",
version: "1.0.0",
});
// Define a tool
server.tool(
"list_campaigns",
"List all advertising campaigns with metrics",
{
date_preset: {
type: "string",
description: "Time range for metrics",
},
},
async ({ date_preset }) => {
// Call your API here
const campaigns = await fetchCampaigns(date_preset);
return {
content: [
{
type: "text",
text: JSON.stringify(campaigns, null, 2),
},
],
};
}
);
// Start the server
const transport = new StdioServerTransport();
await server.connect(transport);
The server defines tools with schemas, implements the handler logic, and communicates over stdio. The MCP client (Claude, Cursor, etc.) connects to this server and presents the tools to the AI model.
MCP for Ad Management: Why It Matters
Traditional ad management requires either manual work in the platform UI or custom code that calls APIs directly. MCP opens a third option: conversational ad management through AI agents.
This is not about replacing ad managers. It is about giving them a faster interface. Instead of navigating through the Meta Ads Manager to find underperforming campaigns, you ask your AI agent. Instead of writing a Python script to pull weekly reports, you describe what you want.
The workflow looks like:
- Morning review: "Show me campaigns with CPA above $20 this week"
- Quick optimization: "Pause the bottom 3 performers and redistribute their budget"
- Reporting: "Generate a weekly performance summary for the team"
- Audience management: "Create a lookalike audience from our top converters"
Each of these would take 10-30 minutes in the Meta Ads Manager UI. Through an AI agent with MCP access, they take seconds.
Getting Started with MCP and Xylo
The fastest way to experience MCP for ad management:
- Install Claude Desktop (or your preferred MCP-compatible tool).
- Sign up for Xylo at xyloapi.dev and connect your Meta ad account.
- Configure the MCP server by adding Xylo to your Claude Desktop config:
{
"mcpServers": {
"xylo-ads": {
"command": "npx",
"args": ["-y", "@xylo/mcp-server"],
"env": {
"XYLO_API_KEY": "your_key_here",
"XYLO_AD_ACCOUNT": "act_123456789"
}
}
}
}
- Start a conversation about your ad campaigns. The AI agent will use the MCP tools to fetch real data and execute changes.
For a deeper walkthrough, read our guide on building AI agents for Facebook ads. For the REST API approach, check out the Meta Ads API developer guide.
The Future of MCP
MCP is still early, but the trajectory is clear. As more services provide MCP servers and more AI tools support the protocol, the friction of connecting AI to external services will continue to decrease. For advertising specifically, MCP enables a shift from "build integrations" to "describe what you want" -- and the tools are available today.
Ready to simplify your ads API integration?
Get started with Xylo in minutes. One API key for every ad platform.