How to Add an MCP Server to Claude Code & Desktop in 2026 — Meta Ads Setup, Compliance Layer & Troubleshooting
MCP support landed everywhere in 2026. Here is the actual setup for Claude Code and Claude Desktop, with a Meta Ads walkthrough and the compliance gap that catches every team.
Inside This Compliance Report
Why MCP Servers Matter in 2026
The Model Context Protocol turned from niche developer specification into mainstream advertiser infrastructure during the first half of 2026. Anthropic published the protocol in late 2024, but the inflection point arrived on April 29, 2026 when Meta launched its official MCP server at mcp.facebook.com/ads for both Claude and ChatGPT users. The Meta launch turned a developer protocol into a marketing automation surface that runs against live ad budgets.
Before April 2026, MCP installs were mostly engineering experiments — connecting Claude to GitHub, Linear, Postgres, or local file systems. Marketing and advertising teams treated MCP as something engineers played with on weekends. The Meta Ads MCP shifted that posture. With twenty-nine production-grade tools spanning campaign creation, catalog management, performance reporting, and signal diagnostics, MCP became the way ad operators actually use Claude on production accounts.
The setup, however, remains under-documented for non-developer audiences. Adding a server to Claude Code is a single command. Adding one to Claude Desktop is a single JSON edit. But the differences between transports, scopes, and authentication models trip up first-time installers — and the compliance implications of running automation against live ad accounts are larger than most teams realize.
"The Meta Ads MCP turned MCP from a developer convenience into operating infrastructure for advertising teams. The setup is simple. The compliance posture is not."
— AuditSocials connector brief, May 2026
This guide covers the actual commands and JSON for both Claude Code and Claude Desktop, walks through Meta Ads MCP installation end-to-end, and surfaces the compliance gap that vendor MCP servers cannot close on their own. Track ongoing changes through the Policy Tracker.
Adding an MCP Server to Claude Code
Claude Code (Anthropic's command-line agent) supports MCP through the claude mcp add command. The syntax accepts a transport flag, a server name, a URL or executable command, and optional scope, headers, and environment variables. All flags must come before the server name; on stdio servers a literal -- separates options from the launch command.
Command Syntax
| Element | Value | Notes |
|---|---|---|
| Command | claude mcp add | Available in Claude Code v2.1.64 and later |
| Transport | --transport http | Use http for remote vendor servers; stdio for local processes |
| Name | Short identifier | Lowercase, hyphenated; how you reference the server in chat |
| URL | Vendor endpoint | For example mcp.notion.com/mcp or mcp.facebook.com/ads |
| Headers | --header "Name: value" | Used for static API keys or bearer tokens |
| Env vars | --env KEY=VALUE | Used by stdio servers for runtime configuration |
| Scope | --scope local|project|user | Determines where the configuration is stored and shared |
Scope Behaviour
- Local (default): Stored in
~/.claude.json. Visible only to the current project on the current machine. Best for personal testing. - Project: Stored in
.mcp.jsonat the project root. Tracked in git, shared with the team. Best for shared engineering tools. - User: Stored in
~/.claude.jsonbut available across every project on the machine. Best for personal productivity servers and compliance layers.
Authentication Patterns
- OAuth (interactive): Most modern vendor MCP servers — including Meta Ads — use browser-based OAuth. After running
claude mcp add, run/mcpinside Claude Code to trigger the OAuth flow. - Static headers: Older or simpler servers accept a bearer token via
--header. Useful for internal tools or self-hosted MCP wrappers. - Environment variables: Stdio servers expect API keys passed at launch via
--env.
For a deeper compliance check on whatever the server lets Claude do against your ad accounts, run AI Compliance Audit before authorising production access.
Verifying Installation
After adding a server, run claude mcp list to confirm it appears in the registry. The list shows status (connected, pending, error), transport type, and scope. Run claude mcp get <name> to see configuration details and OAuth state. To remove a server, use claude mcp remove <name>. To import existing servers from a Claude Desktop installation on the same machine, use claude mcp add-from-claude-desktop.
Adding an MCP Server to Claude Desktop
Claude Desktop uses a single JSON configuration file rather than a CLI. Edit the file directly, save it, and restart Claude Desktop to pick up the change. The file path varies by operating system and the JSON format is unforgiving — invalid syntax silently disables every server in the file rather than just the broken entry.
Configuration File Paths
| Operating System | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
JSON Structure
The file is a JSON object with a single top-level mcpServers property. Each server is a key under that object, with a value that depends on transport.
- Stdio entries include
type: "stdio",command, anargsarray, and an optionalenvobject for credentials. - HTTP entries include
type: "http", aurl, and an optionalheadersobject for static authentication.
Stdio Server Example
Stdio servers run as a local subprocess. Claude Desktop launches the command, passes the args, sets the environment, and communicates over stdin and stdout. Use stdio for local tools such as a self-hosted Postgres or Airtable wrapper. Verify the command path resolves before saving — a broken command string surfaces as a connector error after restart.
HTTP Server Example
HTTP servers run remotely. The configuration only needs a URL and optional headers. Use HTTP for vendor servers such as Meta Ads, Notion, Linear, Stripe, or any compliance MCP hosted on a public endpoint. Authentication for HTTP servers is usually OAuth, which Claude Desktop launches automatically the first time the server is needed.
After Editing
Save the file with valid JSON syntax, then quit and relaunch Claude Desktop. The server appears under the connector list inside any new conversation. If a server fails to start, Claude Desktop surfaces the error in the connector tray with a status indicator. For multi-jurisdiction risk review on whatever automation those servers enable, route the workflow through Legal Compliance Scan.
Real-World Walkthrough: Meta Ads MCP
Meta launched its official MCP server on April 29, 2026 at mcp.facebook.com/ads. The server exposes twenty-nine tools across five families covering the full ad lifecycle. Setup takes a single command in Claude Code or a five-line JSON block in Claude Desktop. Authentication is OAuth, scoped to a Meta Business account.
Installation in Claude Code
- Command:
claude mcp add --transport http meta-ads https://mcp.facebook.com/ads - Authenticate: Run
/mcpinside Claude Code, select the meta-ads server, and complete the OAuth flow in the browser window that opens. - Verify: Run
claude mcp listand confirm the server status shows as connected.
Installation in Claude Desktop
Add a single entry to the mcpServers object in claude_desktop_config.json with the following fields, save, and restart Claude Desktop. The first conversation after restart prompts for OAuth.
- Server name: meta-ads (or any unique label)
- type: http
- url: https://mcp.facebook.com/ads
No developer app, no API token, no Graph API allowlist. The OAuth flow grants Claude access to whichever ad accounts the authenticating user already controls inside Meta Business Manager.
The Twenty-Nine Tools
| Family | Approx. Count | Examples |
|---|---|---|
| Dataset and pixel | 4 | Pixel quality, event drop diagnostics, error retrieval |
| Campaign management | 8 | Create, pause, update campaigns, ad sets, and ads |
| Catalog and audience | 8 | Product catalog management, custom audiences, lookalike segments |
| Performance insights | 5 | Spend metrics, benchmarks, attribution windows |
| Diagnostics | 4 | Account health, signal validation, restriction checks |
Common Workflows
- Performance review: "Summarise spend, ROAS, and frequency for last week's campaigns broken down by ad set."
- Creative iteration: "Pause the worst-performing ad in each ad set and duplicate the best performer with a 20% budget increase."
- Catalog hygiene: "List products with broken image URLs or missing GTIN values."
- Diagnostic triage: "Why did pixel events drop on the checkout page yesterday?"
The tools cover Facebook, Instagram (feed, story, reel), and Audience Network uniformly. For policy-specific risk before campaign creation, route copy and creative through Meta Rejection Predictor first.
The Compliance Gap MCP Leaves Behind
An MCP server gives Claude the ability to act. It does not give Claude the knowledge to act safely. This distinction is the largest gap that Meta's official server, and every vendor MCP that follows, leave behind. Claude has general safety training but no internalised understanding of platform-specific advertising policies, regional regulatory frameworks, or the rejection patterns of specific ad accounts.
When a user asks Claude to publish a creative through Meta Ads MCP, Claude calls create_ad_creative and submit_for_review in sequence. There is no intermediate step that asks whether the copy violates Meta's misleading claims policy, whether the image triggers the personal attribute targeting rule, whether the audience definition implicates Special Ad Categories, or whether the regional flight schedule conflicts with the EU Digital Services Act. Claude submits, Meta reviews, and the rejection arrives twenty-four to forty-eight hours later — after the budget slot is already spent.
What Vendor MCPs Cannot Reasonably Do
| Capability | Why Vendor MCPs Skip It |
|---|---|
| Predict rejection probability | Self-incrimination risk; vendor liability for stated probability |
| Surface policy change alerts | Vendors cannot proactively warn about their own policies without admitting risk |
| Cross-platform comparison | Meta cannot reference TikTok, Google, or LinkedIn enforcement |
| DSA enforcement intelligence | EU Transparency Database is third-party regulator data |
| Independent audit trail | Vendor-controlled history is not regulator-defensible |
Closing the Gap with a Compliance Layer
The MCP protocol supports a server-side instructions field. When loaded into Claude, the field becomes part of the system prompt for every conversation. A compliance-focused MCP can use this field to instruct Claude that any campaign-creation tool call must first route through a risk check. With the right instructions, Claude will automatically call the compliance tool before any vendor publish tool, even when the user does not explicitly ask for review.
The pattern is straightforward and transparent. The compliance server exposes tools such as predict_rejection, cross_platform_risk, and policy_change_lookup. Its instructions field tells Claude to call those tools in front of any Meta, TikTok, Google, LinkedIn, or X publish action. The user installs the compliance server alongside the vendor server and benefits from the chained workflow without changing prompt habits.
For the AuditSocials approach to this layer — including cross-platform risk scoring, DSA enforcement context, and policy-change alerts — see the AI Compliance Audit tool. For background on the regulatory frame, see EU DSA Compliance.
A lighter-weight workaround until a compliance MCP is in place: paste the relevant policy bundle into the conversation before asking Claude to draft creatives. The Meta Ad Compliance Rules bundle covers Facebook and Instagram policy text formatted for direct injection across seven regions and six regulated industries, raising Claude's policy literacy from general to Meta-specific in a single paste.
Common Errors and Fixes
Most MCP setup failures fall into four families: configuration syntax, authentication, transport, and tool output limits. The fixes are usually mechanical once the symptom is identified.
Diagnostic Table
| Symptom | Likely Cause | Fix |
|---|---|---|
Server does not appear in claude mcp list | Missing flag order or invalid scope | Place flags before name; run with --scope user for cross-project visibility |
| Server status shows error in Claude Desktop | Invalid JSON in config file | Validate config with a JSON linter; common issues are trailing commas and unquoted keys |
| OAuth window never opens | Browser callback port blocked | Use --callback-port 8080 or open the firewall on the printed port |
| OAuth completes but tools do not appear | Token scope mismatch or stale session | Run claude mcp remove then re-add; clear OAuth state through the /mcp menu |
| Tool output cut off mid-response | Default 10,000 token cap | Set MAX_MCP_OUTPUT_TOKENS=50000 before launching Claude Code |
| Stdio server fails to launch | Command path or missing dependency | Run the command directly in a terminal; verify Node, Python, or system dependencies |
| Server connects but tools error on call | Insufficient OAuth scopes | Re-authorise with the right Meta Business or vendor permissions |
Where to Look for Logs
- Claude Code: Run
/mcpfor a status summary; the~/.claude/logs/directory contains transport and session logs - Claude Desktop: The connector tray surfaces the most recent error; deeper logs live alongside the config file in the Claude application support directory
Persistent failures are usually an authentication scope issue rather than a transport bug. Confirm that the OAuth-authorised account actually has access to the resources the tool needs.
MCP Setup Checklist
- [ ] Confirm Claude Code v2.1.64 or later (run
claude --version) - [ ] Decide scope before adding the server (local for testing, project for team, user for cross-project)
- [ ] Use
--transport httpfor vendor servers; reserve stdio for local tools - [ ] Validate
claude_desktop_config.jsonwith a JSON linter before saving - [ ] Restart Claude Desktop after every config change
- [ ] Run
/mcpto complete OAuth for any newly added server - [ ] Verify connection with
claude mcp listbefore relying on the server - [ ] Layer a compliance MCP in front of any publish-capable vendor server
- [ ] Set
MAX_MCP_OUTPUT_TOKENSif a tool returns large reports - [ ] Document approved MCP servers and scopes in your team's runbook
- [ ] Subscribe to vendor changelogs and the Policy Tracker for ongoing updates
Don't miss the next policy change.
Subscribe to the Policy Tracker — get weekly digests or instant Pro alerts across all 8 platforms. Or try our free Keyword Risk Checker first.
Report Keywords — Run AI Compliance Audit
Related Posts
Cannabis & CBD Social Media Ad Compliance Guide 2026 — Platform-by-Platform Rules, State Laws & Safe Advertising Strategies
A comprehensive 2026 compliance guide to cannabis, CBD, and hemp advertising on every major social media platform. Covers what's allowed, what's banned, topical vs ingestible rules, US state-by-state legal impact, and actionable strategies to run compliant campaigns without getting flagged.
The Ultimate Influencer Compliance Guide 2026 — FTC Rules, Platform Tools & Disclosure Best Practices
The definitive influencer compliance guide for 2026 covering FTC endorsement rules, EU DSA obligations, platform-by-platform disclosure tools, and the most common mistakes that lead to enforcement actions. Everything creators and brands need to stay compliant across Meta, TikTok, YouTube, and beyond.
UGC Creator Ad Compliance Guide 2026 — Disclosure Rules for User-Generated Content Campaigns
UGC creators face unique disclosure obligations when brands run their content as paid ads. This guide covers whitelisting compliance, spark ads rules, contract requirements, and platform-specific UGC ad policies for 2026.