meta-ads-mcp 0.7.5__py3-none-any.whl → 0.7.7__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.7.5"
10
+ __version__ = "0.7.7"
11
11
 
12
12
  __all__ = [
13
13
  'get_ad_accounts',
@@ -59,4 +59,14 @@ async def get_account_info(access_token: str = None, account_id: str = None) ->
59
59
 
60
60
  data = await make_api_request(endpoint, access_token, params)
61
61
 
62
+ # Add DSA requirement detection
63
+ if "business_country_code" in data:
64
+ european_countries = ["DE", "FR", "IT", "ES", "NL", "BE", "AT", "IE", "DK", "SE", "FI", "NO"]
65
+ if data["business_country_code"] in european_countries:
66
+ data["dsa_required"] = True
67
+ data["dsa_compliance_note"] = "This account is subject to European DSA (Digital Services Act) requirements"
68
+ else:
69
+ data["dsa_required"] = False
70
+ data["dsa_compliance_note"] = "This account is not subject to European DSA requirements"
71
+
62
72
  return json.dumps(data, indent=2)
@@ -73,7 +73,7 @@ async def get_adset_details(access_token: str = None, adset_id: str = None) -> s
73
73
  endpoint = f"{adset_id}"
74
74
  # Explicitly prioritize frequency_control_specs in the fields request
75
75
  params = {
76
- "fields": "id,name,campaign_id,status,frequency_control_specs{event,interval_days,max_frequency},daily_budget,lifetime_budget,targeting,bid_amount,bid_strategy,optimization_goal,billing_event,start_time,end_time,created_time,updated_time,attribution_spec,destination_type,promoted_object,pacing_type,budget_remaining"
76
+ "fields": "id,name,campaign_id,status,frequency_control_specs{event,interval_days,max_frequency},daily_budget,lifetime_budget,targeting,bid_amount,bid_strategy,optimization_goal,billing_event,start_time,end_time,created_time,updated_time,attribution_spec,destination_type,promoted_object,pacing_type,budget_remaining,dsa_beneficiary"
77
77
  }
78
78
 
79
79
  data = await make_api_request(endpoint, access_token, params)
@@ -103,6 +103,7 @@ async def create_adset(
103
103
  bid_strategy: str = None,
104
104
  start_time: str = None,
105
105
  end_time: str = None,
106
+ dsa_beneficiary: str = None,
106
107
  access_token: str = None
107
108
  ) -> str:
108
109
  """
@@ -123,6 +124,7 @@ async def create_adset(
123
124
  bid_strategy: Bid strategy (e.g., 'LOWEST_COST', 'LOWEST_COST_WITH_BID_CAP')
124
125
  start_time: Start time in ISO 8601 format (e.g., '2023-12-01T12:00:00-0800')
125
126
  end_time: End time in ISO 8601 format
127
+ dsa_beneficiary: DSA beneficiary (person/organization benefiting from ads) for European compliance
126
128
  access_token: Meta API access token (optional - will use cached token if not provided)
127
129
  """
128
130
  # Check required parameters
@@ -181,16 +183,44 @@ async def create_adset(
181
183
  if end_time:
182
184
  params["end_time"] = end_time
183
185
 
186
+ # Add DSA beneficiary if provided
187
+ if dsa_beneficiary:
188
+ params["dsa_beneficiary"] = dsa_beneficiary
189
+
184
190
  try:
185
191
  data = await make_api_request(endpoint, access_token, params, method="POST")
186
192
  return json.dumps(data, indent=2)
187
193
  except Exception as e:
188
194
  error_msg = str(e)
189
- return json.dumps({
190
- "error": "Failed to create ad set",
191
- "details": error_msg,
192
- "params_sent": params
193
- }, indent=2)
195
+
196
+ # Enhanced error handling for DSA beneficiary issues
197
+ if "permission" in error_msg.lower() or "insufficient" in error_msg.lower():
198
+ return json.dumps({
199
+ "error": "Insufficient permissions to set DSA beneficiary. Please ensure you have business_management permissions.",
200
+ "details": error_msg,
201
+ "params_sent": params,
202
+ "permission_required": True
203
+ }, indent=2)
204
+ elif "dsa_beneficiary" in error_msg.lower() and ("not supported" in error_msg.lower() or "parameter" in error_msg.lower()):
205
+ return json.dumps({
206
+ "error": "DSA beneficiary parameter not supported in this API version. Please set DSA beneficiary manually in Facebook Ads Manager.",
207
+ "details": error_msg,
208
+ "params_sent": params,
209
+ "manual_setup_required": True
210
+ }, indent=2)
211
+ elif "benefits from ads" in error_msg or "DSA beneficiary" in error_msg:
212
+ return json.dumps({
213
+ "error": "DSA beneficiary required for European compliance. Please provide the person or organization that benefits from ads in this ad set.",
214
+ "details": error_msg,
215
+ "params_sent": params,
216
+ "dsa_required": True
217
+ }, indent=2)
218
+ else:
219
+ return json.dumps({
220
+ "error": "Failed to create ad set",
221
+ "details": error_msg,
222
+ "params_sent": params
223
+ }, indent=2)
194
224
 
195
225
 
196
226
  @mcp_server.tool()
@@ -33,7 +33,7 @@ async def get_insights(access_token: str = None, object_id: str = None,
33
33
 
34
34
  endpoint = f"{object_id}/insights"
35
35
  params = {
36
- "fields": "account_id,account_name,campaign_id,campaign_name,adset_id,adset_name,ad_id,ad_name,impressions,clicks,spend,cpc,cpm,ctr,reach,frequency,actions,conversions,unique_clicks,cost_per_action_type",
36
+ "fields": "account_id,account_name,campaign_id,campaign_name,adset_id,adset_name,ad_id,ad_name,impressions,clicks,spend,cpc,cpm,ctr,reach,frequency,actions,action_values,conversions,unique_clicks,cost_per_action_type",
37
37
  "level": level
38
38
  }
39
39
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meta-ads-mcp
3
- Version: 0.7.5
3
+ Version: 0.7.7
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
@@ -1,10 +1,10 @@
1
- meta_ads_mcp/__init__.py,sha256=6q-iZb-0TjRTI3Pz2mdCt8mGubBzhZbdVUCT601s5KY,1492
1
+ meta_ads_mcp/__init__.py,sha256=QqUl7E3XnhXF-mwxUWeKy6BW2_Ta1NreFhlvF2MK_BI,1492
2
2
  meta_ads_mcp/__main__.py,sha256=XaQt3iXftG_7f0Zu7Wop9SeFgrD2WBn0EQOaPMc27d8,207
3
3
  meta_ads_mcp/core/__init__.py,sha256=6nYdue6yRepkt6JTAoPGhGbS51qfDSvmczRrDwYOG6A,1709
4
- meta_ads_mcp/core/accounts.py,sha256=Nmp7lPxO9wmq25jWV7_H0LIqnEbBhpCVBlLGW2HUaq0,2277
4
+ meta_ads_mcp/core/accounts.py,sha256=h7opM9SO_2iHZkyZn4O5xWTq9Z78Dy9PNcObGkbPOZc,2840
5
5
  meta_ads_mcp/core/ads.py,sha256=aaK70mgfhBJRXr4cdkKag5mjYzvHuHpRttJvTMzPk4Y,36156
6
6
  meta_ads_mcp/core/ads_library.py,sha256=BBGVbtjO5eFV42iiY3XPU-wIV8HupzUKpHgPBrydSvU,3232
7
- meta_ads_mcp/core/adsets.py,sha256=yyOS5k_DPlwZERJmzUf3UBVwvE9KsA9E9gdMyHP2ZBY,10870
7
+ meta_ads_mcp/core/adsets.py,sha256=vY5JNHmGK1a_sQ5B1LnjxLYXzs5_jOajTTjWHRDJ4_Y,12518
8
8
  meta_ads_mcp/core/api.py,sha256=aAzM6Q75VQOFXtr5D-mDmBRhxWK4wsiODsJYnR3mpDI,14994
9
9
  meta_ads_mcp/core/auth.py,sha256=H-0s0O2fLo14rmi81Hh5S64pyRl1HS7dm9Q_8UCa3Jg,21622
10
10
  meta_ads_mcp/core/authentication.py,sha256=-AJxa3a5ZshRCvmJThBaNwCAJ1D2_qOgUkvu539c_MY,10159
@@ -13,7 +13,7 @@ meta_ads_mcp/core/callback_server.py,sha256=LIAJv9DW--83kdZ7VWWZal8xEprYjRZ8iug4
13
13
  meta_ads_mcp/core/campaigns.py,sha256=0yDVgi7rN4eMQk1_w0A2vnoXd8y0t8R77Ji4gna1Gj4,14030
14
14
  meta_ads_mcp/core/duplication.py,sha256=UUmTDFx9o5ZsPQG2Rb9c4ZyuKUVN3FfTjebfTIHHdo4,18984
15
15
  meta_ads_mcp/core/http_auth_integration.py,sha256=lGpKhfzJcyWugBcYEvypY-qnlt-3UDBLqh7xAUH0DGw,12473
16
- meta_ads_mcp/core/insights.py,sha256=U7KYdWQpGcdykE1WUtdJdYR3VTwKrXUzIzCREwWbf48,2599
16
+ meta_ads_mcp/core/insights.py,sha256=Qr1wq-1VT9HwF4w11rIRM4IBYdrksJ-6EOv3p33ZtKw,2613
17
17
  meta_ads_mcp/core/openai_deep_research.py,sha256=Ocs8bmNNBLZQLmWfL6azlC3RNzevVzV5WgcEp4H2wdY,13240
18
18
  meta_ads_mcp/core/pipeboard_auth.py,sha256=VvbxEB8ZOhnMccLU7HI1HgaPWHCl5NGrzZCm-zzHze4,22798
19
19
  meta_ads_mcp/core/reports.py,sha256=Dv3hfsPOR7IZ9WrYrKd_6SNgZl-USIphg7knva3UYAw,5747
@@ -21,8 +21,8 @@ meta_ads_mcp/core/resources.py,sha256=-zIIfZulpo76vcKv6jhAlQq91cR2SZ3cjYZt3ek3x0
21
21
  meta_ads_mcp/core/server.py,sha256=WhbAag7xdhbGcp7rnU4sKhqXJ8Slapa_ba3T23Yp_2U,17889
22
22
  meta_ads_mcp/core/targeting.py,sha256=3HW1qirEdwaQurlBZGenbIwawcb5J06ghJKRfgu9ZEs,6318
23
23
  meta_ads_mcp/core/utils.py,sha256=ofKUhyo-5SZoJVuBeTVFPPQCffk0UKpwmDMrd8qQxNc,8715
24
- meta_ads_mcp-0.7.5.dist-info/METADATA,sha256=42uw2yEhgxLqqHEOhAqgiPqfwNYvLjR6qL7rzGYTaAk,20409
25
- meta_ads_mcp-0.7.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
26
- meta_ads_mcp-0.7.5.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
27
- meta_ads_mcp-0.7.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
28
- meta_ads_mcp-0.7.5.dist-info/RECORD,,
24
+ meta_ads_mcp-0.7.7.dist-info/METADATA,sha256=2Ao4wr-v_4w6Ttc4mrJxE4HKDzlwbq_Ygjc_ovZB8eg,20409
25
+ meta_ads_mcp-0.7.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
26
+ meta_ads_mcp-0.7.7.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
27
+ meta_ads_mcp-0.7.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
28
+ meta_ads_mcp-0.7.7.dist-info/RECORD,,