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
fix: normalize page_id to string in create_ad_creative and discovery functions
Yves Junqueira5eee32eb597b
diff --git a/meta_ads_mcp/core/ads.py b/meta_ads_mcp/core/ads.pyindex 9b959af..d9fc29f 100644--- a/meta_ads_mcp/core/ads.py+++ b/meta_ads_mcp/core/ads.py@@ -770,7 +770,7 @@ async def create_ad_creative(image_hash: Hash of the uploaded imageaccess_token: Meta API access token (optional - will use cached token if not provided)name: Creative name- page_id: Facebook Page ID to be used for the ad+ page_id: Facebook Page ID (string or int; coerced to string)link_url: Destination URL for the admessage: Ad copy/textheadline: Single headline for simple ads (cannot be used with headlines)@@ -800,6 +800,10 @@ async def create_ad_creative(if not account_id.startswith("act_"):account_id = f"act_{account_id}"+ # Normalize page_id to string (Meta API and get_account_pages often return id as int in JSON)+ if page_id is not None:+ page_id = str(page_id).strip() or None+# Enhanced page discovery: If no page ID is provided, use robust discovery methodsif not page_id:try:@@ -1175,7 +1179,7 @@ async def _discover_pages_for_account(account_id: str, access_token: str) -> dicpage = client_pages_data["data"][0]return {"success": True,- "page_id": page["id"],+ "page_id": str(page["id"]),"page_name": page.get("name", "Unknown"),"source": "client_pages"}@@ -1193,7 +1197,7 @@ async def _discover_pages_for_account(account_id: str, access_token: str) -> dicpage = pages_data["data"][0]return {"success": True,- "page_id": page["id"],+ "page_id": str(page["id"]),"page_name": page.get("name", "Unknown"),"source": "assigned_pages"}