Meta Ads (Facebook/Instagram) MCP server for Claude, ChatGPT, Perplexity & Cursor — the Meta node of Pipeboard’s 5-platform family (+ Google, TikTok, Snap, Reddit). Hosted remote MCP, badged Meta Business Partner, free plan — no self-hosting required.
Python advertisingai-agentschatgptclaudefacebook-adsinstagram-adsmcpmeta-adsmodel-context-protocolpipeboard
Refactor authentication function and update documentation
Yves Junqueiraef78c52815e7
diff --git a/README.md b/README.mdindex 72f428d..b963f5e 100644--- a/README.md+++ b/README.md@@ -174,7 +174,7 @@ Add this to your `claude_desktop_config.json` to integrate with Claude in Cursor- `ad_id`: Meta Ads ad ID (optional, used if url is not provided)- Returns: Diagnostic information about image download attempts-14. `mcp_meta_ads_get_login_link`+14. `mcp_meta_ads_authenticate`- Get a clickable login link for Meta Ads authentication- Inputs:- `access_token` (optional): Meta API access token (will use cached token if not provided)@@ -256,7 +256,7 @@ python test_meta_ads_auth.py --app-id YOUR_APP_ID --force-loginWhen using the Meta Ads MCP with an LLM interface (like Claude):-1. Test authentication by calling the `mcp_meta_ads_get_login_link` tool+1. Test authentication by calling the `mcp_meta_ads_authenticate` tool2. Verify account access by calling `mcp_meta_ads_get_ad_accounts`3. Check specific account details with `mcp_meta_ads_get_account_info`@@ -269,7 +269,7 @@ These functions will automatically handle authentication if needed and provide aIf you encounter authentication issues:1. When using the LLM interface:- - Use the `mcp_meta_ads_get_login_link` tool to generate a fresh authentication link+ - Use the `mcp_meta_ads_authenticate` tool to generate a fresh authentication link- Ensure you click the link and complete the authorization flow in your browser- Check that the callback server is running properly (the tool will report this)diff --git a/future_improvements.md b/future_improvements.mdindex 6b7d5a9..6783202 100644--- a/future_improvements.md+++ b/future_improvements.md@@ -11,7 +11,7 @@ Don't share it ever with the LLM, only update the auth cache.## Planned Improvement: Ad Set Update Confirmation Flow### Overview-Currently, the `update_adset` function directly applies changes to Meta Ad Sets without user confirmation. This is potentially risky as users may not fully understand the impact of their changes before they're applied. We plan to implement a confirmation flow similar to the authentication flow that already exists for the `get_login_link` function.+Currently, the `update_adset` function directly applies changes to Meta Ad Sets without user confirmation. This is potentially risky as users may not fully understand the impact of their changes before they're applied. We plan to implement a confirmation flow similar to the authentication flow that already exists for the `authenticate` function.### Requirementsdiff --git a/meta_ads_mcp/__init__.py b/meta_ads_mcp/__init__.pyindex 840ffd5..c355656 100644--- a/meta_ads_mcp/__init__.py+++ b/meta_ads_mcp/__init__.py@@ -24,7 +24,7 @@ __all__ = ['get_ad_image','get_insights','debug_image_download',- 'get_login_link',+ 'authenticate','login_cli','main']@@ -45,7 +45,7 @@ from .core import (get_ad_image,get_insights,debug_image_download,- get_login_link,+ authenticate,login_cli,main)diff --git a/meta_ads_mcp/api.py b/meta_ads_mcp/api.pyindex 31c39aa..b2aca7d 100644--- a/meta_ads_mcp/api.py+++ b/meta_ads_mcp/api.py@@ -1347,7 +1347,7 @@ async def debug_image_download(url="", ad_id="", access_token=None):@mcp_server.tool()@meta_api_tool-async def get_login_link(access_token: str = None) -> str:+async def authenticate(access_token: str = None) -> str:"""Get a clickable login link for Meta Ads authentication.diff --git a/meta_ads_mcp/core/__init__.py b/meta_ads_mcp/core/__init__.pyindex 9b6c081..1c36596 100644--- a/meta_ads_mcp/core/__init__.py+++ b/meta_ads_mcp/core/__init__.py@@ -6,7 +6,7 @@ from .campaigns import get_campaigns, get_campaign_details, create_campaignfrom .adsets import get_adsets, get_adset_details, update_adsetfrom .ads import get_ads, get_ad_details, get_ad_creatives, get_ad_imagefrom .insights import get_insights, debug_image_download-from .authentication import get_login_link+from .authentication import authenticatefrom .server import login_cli, mainfrom .auth import login@@ -26,7 +26,7 @@ __all__ = ['get_ad_image','get_insights','debug_image_download',- 'get_login_link',+ 'authenticate','login_cli','login','main',diff --git a/meta_ads_mcp/core/authentication.py b/meta_ads_mcp/core/authentication.pyindex 017c2a8..ea7cf67 100644--- a/meta_ads_mcp/core/authentication.py+++ b/meta_ads_mcp/core/authentication.py@@ -9,7 +9,7 @@ from .server import mcp_server@mcp_server.tool()@meta_api_tool-async def get_login_link(access_token: str = None) -> str:+async def authenticate(access_token: str = None) -> str:"""Get a clickable login link for Meta Ads authentication.