meta-ads-mcp 0.4.4__py3-none-any.whl → 0.4.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
meta_ads_mcp/__init__.py CHANGED
@@ -7,7 +7,7 @@ with the Claude LLM.
7
7
 
8
8
  from meta_ads_mcp.core.server import main
9
9
 
10
- __version__ = "0.4.4"
10
+ __version__ = "0.4.6"
11
11
 
12
12
  __all__ = [
13
13
  'get_ad_accounts',
meta_ads_mcp/core/ads.py CHANGED
@@ -806,11 +806,74 @@ async def get_account_pages(access_token: str = None, account_id: str = None) ->
806
806
  if page_details["data"]:
807
807
  return json.dumps(page_details, indent=2)
808
808
 
809
+ # Approach 4: Extract page IDs from tracking_specs in ads
810
+ # Inspired by praveen92y's implementation for robust page detection
811
+ # This approach is often the most reliable as confirmed by community feedback
812
+ endpoint = f"{account_id}/ads"
813
+ params = {
814
+ "fields": "id,name,adset_id,campaign_id,status,creative,created_time,updated_time,bid_amount,conversion_domain,tracking_specs",
815
+ "limit": 100
816
+ }
817
+
818
+ tracking_ads_data = await make_api_request(endpoint, access_token, params)
819
+
820
+ tracking_page_ids = set()
821
+ if "data" in tracking_ads_data:
822
+ for ad in tracking_ads_data.get("data", []):
823
+ tracking_specs = ad.get("tracking_specs", [])
824
+ if isinstance(tracking_specs, list):
825
+ for spec in tracking_specs:
826
+ # If 'page' key exists, add all page IDs
827
+ if isinstance(spec, dict) and "page" in spec:
828
+ page_list = spec["page"]
829
+ if isinstance(page_list, list):
830
+ for page_id in page_list:
831
+ # Validate page ID format (should be numeric string)
832
+ if isinstance(page_id, (str, int)) and str(page_id).isdigit():
833
+ tracking_page_ids.add(str(page_id))
834
+
835
+ if tracking_page_ids:
836
+ page_details = {"data": [], "source": "tracking_specs", "note": "Page IDs extracted from active ads - these are the most reliable for ad creation"}
837
+ for page_id in tracking_page_ids:
838
+ page_endpoint = f"{page_id}"
839
+ page_params = {
840
+ "fields": "id,name,username,category,fan_count,link,verification_status,picture"
841
+ }
842
+
843
+ page_data = await make_api_request(page_endpoint, access_token, page_params)
844
+ if "id" in page_data:
845
+ # Add additional context about this page ID being suitable for ads
846
+ page_data["_meta"] = {
847
+ "suitable_for_ads": True,
848
+ "found_in_tracking_specs": True,
849
+ "recommended_for_create_ad_creative": True
850
+ }
851
+ page_details["data"].append(page_data)
852
+ else:
853
+ page_details["data"].append({
854
+ "id": page_id,
855
+ "error": "Page details not found",
856
+ "_meta": {
857
+ "suitable_for_ads": True,
858
+ "found_in_tracking_specs": True,
859
+ "note": "Page ID exists in ads but details not accessible - you can still use this ID for ad creation"
860
+ }
861
+ })
862
+
863
+ if page_details["data"]:
864
+ return json.dumps(page_details, indent=2)
865
+
809
866
  # If all approaches failed, return empty data with a message
810
867
  return json.dumps({
811
868
  "data": [],
812
- "message": "No pages found associated with this account",
813
- "suggestion": "You may need to create a page or provide a page_id explicitly when creating ads"
869
+ "message": "No pages found associated with this account using automated methods",
870
+ "troubleshooting": {
871
+ "suggestion_1": "If you have existing ads, run 'get_ads' and look for page IDs in the 'tracking_specs' field",
872
+ "suggestion_2": "Use the exact page ID from existing ads' tracking_specs for creating new ad creatives",
873
+ "suggestion_3": "Verify your page ID format - it should be a numeric string (e.g., '123456789')",
874
+ "suggestion_4": "Check for digit transpositions or formatting errors in your page ID"
875
+ },
876
+ "note": "Based on community feedback, page IDs from existing ads' tracking_specs are the most reliable for ad creation"
814
877
  }, indent=2)
815
878
 
816
879
  except Exception as e:
meta_ads_mcp/core/auth.py CHANGED
@@ -23,7 +23,9 @@ from .callback_server import (
23
23
  from .pipeboard_auth import pipeboard_auth_manager
24
24
 
25
25
  # Auth constants
26
- AUTH_SCOPE = "ads_management,ads_read,business_management,public_profile"
26
+ # Scope includes pages_show_list and pages_read_engagement to fix issue #16
27
+ # where get_account_pages failed for regular users due to missing page permissions
28
+ AUTH_SCOPE = "ads_management,ads_read,business_management,public_profile,pages_show_list,pages_read_engagement"
27
29
  AUTH_REDIRECT_URI = "http://localhost:8888/callback"
28
30
  AUTH_RESPONSE_TYPE = "token"
29
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meta-ads-mcp
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Model Context Protocol (MCP) plugin for interacting with Meta Ads API
5
5
  Project-URL: Homepage, https://github.com/pipeboard-co/meta-ads-mcp
6
6
  Project-URL: Bug Tracker, https://github.com/pipeboard-co/meta-ads-mcp/issues
@@ -49,7 +49,7 @@ A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for in
49
49
 
50
50
  ## Getting started with Remote MCP (Recommended)
51
51
 
52
- The fastest and most reliable way to get started is to **[🚀 Get started with our Meta Ads Remote MCP](https://pipeboard.co)**. No technical setup required - just connect and start analyzing your ad campaigns with AI!
52
+ The fastest and most reliable way to get started is to **[🚀 Get started with our Meta Ads Remote MCP](https://pipeboard.co)**. Our cloud service uses streamable HTTP transport for reliable, scalable access to Meta Ads data. No technical setup required - just connect and start analyzing your ad campaigns with AI!
53
53
 
54
54
  ### For Claude Pro/Max Users
55
55
 
@@ -88,6 +88,8 @@ Use the Remote MCP URL: `https://mcp.pipeboard.co/meta-ads-mcp`
88
88
 
89
89
  If you're a developer or need to customize the installation, you can run Meta Ads MCP locally. **Most marketers should use the Remote MCP above instead!** For complete technical setup instructions, see our **[Local Installation Guide](LOCAL_INSTALLATION.md)**.
90
90
 
91
+ Meta Ads MCP also supports **streamable HTTP transport**, allowing you to run it as a standalone HTTP API for web applications and custom integrations. See **[Streamable HTTP Setup Guide](STREAMABLE_HTTP_SETUP.md)** for complete instructions.
92
+
91
93
  ### Quick Local Setup
92
94
 
93
95
  ```bash
@@ -1,12 +1,12 @@
1
- meta_ads_mcp/__init__.py,sha256=TtiTSlktWk4jj79xcxiBAtUToyuJWIFrszl4SNaen0E,1182
1
+ meta_ads_mcp/__init__.py,sha256=NQtdhkedrnohOGhlooiRjuNIVi3c9Ra9sK34XOZxEew,1182
2
2
  meta_ads_mcp/__main__.py,sha256=XaQt3iXftG_7f0Zu7Wop9SeFgrD2WBn0EQOaPMc27d8,207
3
3
  meta_ads_mcp/core/__init__.py,sha256=XVJjMOfdgnqxy3k8vCn2PCf7za8fMk4BdgJGiSFCVZY,1209
4
4
  meta_ads_mcp/core/accounts.py,sha256=Nmp7lPxO9wmq25jWV7_H0LIqnEbBhpCVBlLGW2HUaq0,2277
5
- meta_ads_mcp/core/ads.py,sha256=Ss0VaSjm7J4g7zUZLPLzz-WGC8h-SdhV_mtBRUNpkgE,29808
5
+ meta_ads_mcp/core/ads.py,sha256=rEekkED-n2SCWAdSm9rzk08aM_L56DEpyVgd869pLgE,33386
6
6
  meta_ads_mcp/core/ads_library.py,sha256=onStn9UkRqYDC60gOPS-iKDtP1plz6DygUb7hUZ0Jw8,2807
7
7
  meta_ads_mcp/core/adsets.py,sha256=k76rm3rkhEebUzvBnM_QaVktrzGTKvTJOtWbBd6s3i8,10399
8
8
  meta_ads_mcp/core/api.py,sha256=aAzM6Q75VQOFXtr5D-mDmBRhxWK4wsiODsJYnR3mpDI,14994
9
- meta_ads_mcp/core/auth.py,sha256=z8HfLbDNB7IzoIcqt-lBGne6P97FF-dubO_cZNe5S_8,21425
9
+ meta_ads_mcp/core/auth.py,sha256=H-0s0O2fLo14rmi81Hh5S64pyRl1HS7dm9Q_8UCa3Jg,21622
10
10
  meta_ads_mcp/core/authentication.py,sha256=4CH2Fe3w7Al7YE2wgoa0DW5qOXTp_5Lsa4T6_Rh55s0,7048
11
11
  meta_ads_mcp/core/budget_schedules.py,sha256=UxseExsvKAiPwfDCY9aycT4kys4xqeNytyq-yyDOxrs,2901
12
12
  meta_ads_mcp/core/callback_server.py,sha256=LIAJv9DW--83kdZ7VWWZal8xEprYjRZ8iug4rMczYbQ,9372
@@ -19,8 +19,8 @@ meta_ads_mcp/core/reports.py,sha256=Dv3hfsPOR7IZ9WrYrKd_6SNgZl-USIphg7knva3UYAw,
19
19
  meta_ads_mcp/core/resources.py,sha256=-zIIfZulpo76vcKv6jhAlQq91cR2SZ3cjYZt3ek3x0w,1236
20
20
  meta_ads_mcp/core/server.py,sha256=mmhtcyB7h1aO6jK4njLztPdAebPDmc3mhA7DksR1nlY,17583
21
21
  meta_ads_mcp/core/utils.py,sha256=DsizDYuJnWUpkbShV1y5Qe8t47Qf59aPZ6O9v0hzdkY,6705
22
- meta_ads_mcp-0.4.4.dist-info/METADATA,sha256=9eJLAhwv-cLyPGEFipIxxQ8AWMeBs4vH4yT4MxrVK14,17239
23
- meta_ads_mcp-0.4.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- meta_ads_mcp-0.4.4.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
25
- meta_ads_mcp-0.4.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
26
- meta_ads_mcp-0.4.4.dist-info/RECORD,,
22
+ meta_ads_mcp-0.4.6.dist-info/METADATA,sha256=ll3IptQlRpXwTtNLah8mDG1FzRhS_OKhIPMsTeA8ikE,17580
23
+ meta_ads_mcp-0.4.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ meta_ads_mcp-0.4.6.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
25
+ meta_ads_mcp-0.4.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
26
+ meta_ads_mcp-0.4.6.dist-info/RECORD,,