4,500+ servers built on MCP Fusion
Vinkius
Meta Ads logo
Vinkius
Mastra AI logo

How to Use the Meta Ads MCP in Mastra AI

Automate your Meta Ads optimization using Mastra AI workflows that pause bad ads and retry failed API calls.

See Vinkius in Action

Works with every AI agent you already use

…and any MCP-compatible client

Meta Ads MCP on Cursor AI Code Editor MCP Client Meta Ads MCP on Claude Desktop App MCP Integration Meta Ads MCP on OpenAI Agents SDK MCP Compatible Meta Ads MCP on Visual Studio Code MCP Extension Client Meta Ads MCP on GitHub Copilot AI Agent MCP Integration Meta Ads MCP on Google Gemini AI MCP Integration Meta Ads MCP on Lovable AI Development MCP Client Meta Ads MCP on Mistral AI Agents MCP Compatible Meta Ads MCP on Amazon AWS Bedrock MCP Support
MCP Servers - Free for Subscribers
Mastra AI

Connect Meta Ads MCP to Mastra AI

Create your Vinkius account to connect Meta Ads to Mastra AI and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.

GDPR Free for Subscribers

Automated Campaign Optimization Workflows

The `pause_campaign` tool allows your Mastra AI agent to halt failing Facebook ad sets automatically. By nesting this tool inside a Mastra workflow, you can set strict rules to stop ads that cross a specific cost-per-click threshold. If Meta's API rate limits hit during optimization, the Mastra AI workflow automatically retries the call with exponential backoff. This ensures you never waste money on a dead Instagram campaign just because an API request failed.

Budget Reallocation via MCP Server

The `get_account_insights` tool monitors your daily spend limits across all active Facebook campaigns. Mastra AI uses this performance data to decide where to shift budget dynamically. Your agent can trigger `activate_campaign` to scale winning Meta ad sets when performance metrics look strong. All of this runs in a self-healing Mastra AI workflow that notifies your team if anything goes wrong.

Human-in-the-Loop Audience Syncing

The `list_audiences` tool pulls your current Meta custom audiences to check for targeting overlap. Mastra AI lets you build an approval step directly into this MCP workflow before modifying any ad group targeting. When the Mastra AI agent wants to update Meta targeting, it pauses and waits for your thumbs-up in Slack. Once approved, the workflow resumes and updates your Facebook parameters using `list_ad_sets`.

Setup guide

Set up Meta Ads MCP in Mastra AI

Prerequisites

  • Node.js 18+ and a TypeScript project
  • @mastra/mcp + @mastra/core packages
  • Active Vinkius subscription with a valid endpoint token
  1. 1

    Install dependencies

    Run npm install @mastra/mcp @mastra/core plus your preferred model provider (e.g. @ai-sdk/openai).

  2. 2

    Configure the MCPClient

    Create an MCPClient with your Vinkius endpoint as a URL object. Replace [YOUR_TOKEN_HERE] with your token from cloud.vinkius.com.

  3. 3

    Discover and inject tools

    Call mcpClient.listTools() and spread the result into your agent's tools object. All Meta Ads tools become native Mastra tools.

  4. 4

    Run with any model

    Swap openai("gpt-4o") for any AI SDK-compatible provider. Call agent.generate() and the agent routes tool calls through MCP automatically.

agent.ts
import { MCPClient } from "@mastra/mcp";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";

const mcpClient = new MCPClient({
  id: "meta-ads-mcp-client",
  servers: {
    "meta-ads-mcp": {
      url: new URL(
        "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
      ),
    },
  },
});

const agent = new Agent({
  name: "Meta Ads Agent",
  model: openai("gpt-4o"),
  instructions: "You have access to Meta Ads tools.",
  tools: {
    ...(await mcpClient.listTools()),
  },
});

const result = await agent.generate(
  "List recent Meta Ads transactions"
);
console.log(result.text);

Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Meta Ads. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.

Why Choose Vinkius

Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.

Real-time monitoring

Live

visibility into every interaction

Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.

Built-in savings

60%

lower AI costs

Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.

Single dashboard

One

place for every integration

Every tool your AI connects to, managed from a single screen. One account, complete control.

Common questions about Meta Ads MCP in Mastra AI

Map `get_campaign_insights` inside a Mastra AI workflow step to monitor Facebook campaign performance, and configure retries for any Meta API hiccups. The Mastra AI workflow automatically triggers fallback logic if a Meta Ads API request fails. This setup keeps your Facebook budget monitoring accurate 24/7 inside the Mastra AI agent.
Yes, design a Mastra AI workflow that queries `get_campaign_insights` and triggers `pause_campaign` if your Facebook cost-per-click spikes. The Mastra AI system evaluates the Meta Ads rules you define inside your agent. You can halt bleeding Facebook ad sets within seconds of a performance drop using Mastra AI.
Instantiate the `MCPClient` in your Mastra AI project and spread the Meta Ads tools returned by `listTools` into your agent configuration. Mastra AI automatically registers every Meta Ads endpoint as a callable tool. Your Mastra AI agent can immediately start querying Facebook metrics using this MCP connection.
Mastra AI features built-in exponential backoff, retrying failed calls to `list_ads` until Meta successfully returns your active ad sets. This prevents Meta API rate limiting errors from breaking your Mastra AI automation. Your Mastra AI workflow handles transient Facebook API errors without crashing.
Your tokens never touch disk, as Vinkius runs the MCP Server in an ephemeral sandbox to fetch `get_account_info` securely for Mastra AI. The session discards all Facebook ad account keys immediately after Mastra AI finishes querying campaign metrics. We adhere to strict zero-trust standards to protect your Meta Ads marketing data inside Mastra AI.

Start using the Meta Ads MCP today

We host it, we monitor it, we maintain it. You just paste one token.

Built & Managed by Vinkius 30s setup 10 tools

We've already built the connector for Meta Ads. Just plug in your AI agents and start using Vinkius.

No hosting. No infrastructure. No complex setup.
All 10 tools are live and waiting. You're up and running in seconds.

Claude Claude
ChatGPT ChatGPT
Cursor Cursor
Gemini Gemini
Windsurf Windsurf
VS Code VS Code
JetBrains JetBrains
Vercel Vercel
+ other MCP clients

Vinkius gives your AI agents access to the full catalog of app connectors, all fully managed, secure, and enterprise-ready. One subscription, every tool you need.

Zero hosting required Full MCP catalog included Enterprise-grade security Auto-updated by Vinkius

Built, hosted, and secured by Vinkius. You just connect and go.