meta-ads-mcp 1.0.18__py3-none-any.whl → 1.0.21__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 +1 -1
- meta_ads_mcp/core/ads.py +26 -9
- meta_ads_mcp/core/insights.py +12 -5
- {meta_ads_mcp-1.0.18.dist-info → meta_ads_mcp-1.0.21.dist-info}/METADATA +2 -1
- {meta_ads_mcp-1.0.18.dist-info → meta_ads_mcp-1.0.21.dist-info}/RECORD +8 -8
- {meta_ads_mcp-1.0.18.dist-info → meta_ads_mcp-1.0.21.dist-info}/WHEEL +0 -0
- {meta_ads_mcp-1.0.18.dist-info → meta_ads_mcp-1.0.21.dist-info}/entry_points.txt +0 -0
- {meta_ads_mcp-1.0.18.dist-info → meta_ads_mcp-1.0.21.dist-info}/licenses/LICENSE +0 -0
meta_ads_mcp/__init__.py
CHANGED
meta_ads_mcp/core/ads.py
CHANGED
|
@@ -759,6 +759,7 @@ async def create_ad_creative(
|
|
|
759
759
|
descriptions: Optional[List[str]] = None,
|
|
760
760
|
dynamic_creative_spec: Optional[Dict[str, Any]] = None,
|
|
761
761
|
call_to_action_type: Optional[str] = None,
|
|
762
|
+
lead_gen_form_id: Optional[str] = None,
|
|
762
763
|
instagram_actor_id: Optional[str] = None
|
|
763
764
|
) -> str:
|
|
764
765
|
"""
|
|
@@ -778,6 +779,8 @@ async def create_ad_creative(
|
|
|
778
779
|
descriptions: List of descriptions for dynamic creative testing (cannot be used with description)
|
|
779
780
|
dynamic_creative_spec: Dynamic creative optimization settings
|
|
780
781
|
call_to_action_type: Call to action button type (e.g., 'LEARN_MORE', 'SIGN_UP', 'SHOP_NOW')
|
|
782
|
+
lead_gen_form_id: Lead generation form ID for lead generation campaigns. Required when using
|
|
783
|
+
lead generation CTAs like 'SIGN_UP', 'GET_OFFER', 'SUBSCRIBE', etc.
|
|
781
784
|
instagram_actor_id: Optional Instagram account ID for Instagram placements
|
|
782
785
|
|
|
783
786
|
Returns:
|
|
@@ -910,9 +913,13 @@ async def create_ad_creative(
|
|
|
910
913
|
|
|
911
914
|
# Add call_to_action to link_data for simple creatives
|
|
912
915
|
if call_to_action_type:
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
+
cta_data = {"type": call_to_action_type}
|
|
917
|
+
|
|
918
|
+
# Add lead form ID to value object if provided (required for lead generation campaigns)
|
|
919
|
+
if lead_gen_form_id:
|
|
920
|
+
cta_data["value"] = {"lead_gen_form_id": lead_gen_form_id}
|
|
921
|
+
|
|
922
|
+
creative_data["object_story_spec"]["link_data"]["call_to_action"] = cta_data
|
|
916
923
|
|
|
917
924
|
# Add dynamic creative spec if provided
|
|
918
925
|
if dynamic_creative_spec:
|
|
@@ -965,7 +972,8 @@ async def update_ad_creative(
|
|
|
965
972
|
description: Optional[str] = None,
|
|
966
973
|
descriptions: Optional[List[str]] = None,
|
|
967
974
|
dynamic_creative_spec: Optional[Dict[str, Any]] = None,
|
|
968
|
-
call_to_action_type: Optional[str] = None
|
|
975
|
+
call_to_action_type: Optional[str] = None,
|
|
976
|
+
lead_gen_form_id: Optional[str] = None
|
|
969
977
|
) -> str:
|
|
970
978
|
"""
|
|
971
979
|
Update an existing ad creative with new content or settings.
|
|
@@ -981,6 +989,8 @@ async def update_ad_creative(
|
|
|
981
989
|
descriptions: New list of descriptions for dynamic creative testing (cannot be used with description)
|
|
982
990
|
dynamic_creative_spec: New dynamic creative optimization settings
|
|
983
991
|
call_to_action_type: New call to action button type
|
|
992
|
+
lead_gen_form_id: Lead generation form ID for lead generation campaigns. Required when using
|
|
993
|
+
lead generation CTAs like 'SIGN_UP', 'GET_OFFER', 'SUBSCRIBE', etc.
|
|
984
994
|
|
|
985
995
|
Returns:
|
|
986
996
|
JSON response with updated creative details
|
|
@@ -1045,7 +1055,7 @@ async def update_ad_creative(
|
|
|
1045
1055
|
update_data["asset_feed_spec"] = asset_feed_spec
|
|
1046
1056
|
else:
|
|
1047
1057
|
# Use traditional object_story_spec with link_data for simple creatives
|
|
1048
|
-
if message or headline or description or call_to_action_type:
|
|
1058
|
+
if message or headline or description or call_to_action_type or lead_gen_form_id:
|
|
1049
1059
|
update_data["object_story_spec"] = {"link_data": {}}
|
|
1050
1060
|
|
|
1051
1061
|
if message:
|
|
@@ -1060,10 +1070,17 @@ async def update_ad_creative(
|
|
|
1060
1070
|
update_data["object_story_spec"]["link_data"]["description"] = description
|
|
1061
1071
|
|
|
1062
1072
|
# Add call_to_action to link_data for simple creatives
|
|
1063
|
-
if call_to_action_type:
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1073
|
+
if call_to_action_type or lead_gen_form_id:
|
|
1074
|
+
cta_data = {}
|
|
1075
|
+
if call_to_action_type:
|
|
1076
|
+
cta_data["type"] = call_to_action_type
|
|
1077
|
+
|
|
1078
|
+
# Add lead form ID to value object if provided (required for lead generation campaigns)
|
|
1079
|
+
if lead_gen_form_id:
|
|
1080
|
+
cta_data["value"] = {"lead_gen_form_id": lead_gen_form_id}
|
|
1081
|
+
|
|
1082
|
+
if cta_data:
|
|
1083
|
+
update_data["object_story_spec"]["link_data"]["call_to_action"] = cta_data
|
|
1067
1084
|
|
|
1068
1085
|
# Add dynamic creative spec if provided
|
|
1069
1086
|
if dynamic_creative_spec:
|
meta_ads_mcp/core/insights.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Insights and Reporting functionality for Meta Ads API."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
-
from typing import Optional, Union, Dict
|
|
4
|
+
from typing import Optional, Union, Dict, List
|
|
5
5
|
from .api import meta_api_tool, make_api_request
|
|
6
6
|
from .utils import download_image, try_multiple_download_methods, ad_creative_images, create_resource_from_image
|
|
7
7
|
from .server import mcp_server
|
|
@@ -11,9 +11,10 @@ import datetime
|
|
|
11
11
|
|
|
12
12
|
@mcp_server.tool()
|
|
13
13
|
@meta_api_tool
|
|
14
|
-
async def get_insights(object_id: str, access_token: Optional[str] = None,
|
|
15
|
-
time_range: Union[str, Dict[str, str]] = "maximum", breakdown: str = "",
|
|
16
|
-
level: str = "ad", limit: int = 25, after: str = ""
|
|
14
|
+
async def get_insights(object_id: str, access_token: Optional[str] = None,
|
|
15
|
+
time_range: Union[str, Dict[str, str]] = "maximum", breakdown: str = "",
|
|
16
|
+
level: str = "ad", limit: int = 25, after: str = "",
|
|
17
|
+
action_attribution_windows: Optional[List[str]] = None) -> str:
|
|
17
18
|
"""
|
|
18
19
|
Get performance insights for a campaign, ad set, ad or account.
|
|
19
20
|
|
|
@@ -51,6 +52,8 @@ async def get_insights(object_id: str, access_token: Optional[str] = None,
|
|
|
51
52
|
level: Level of aggregation (ad, adset, campaign, account)
|
|
52
53
|
limit: Maximum number of results to return per page (default: 25, Meta API allows much higher values)
|
|
53
54
|
after: Pagination cursor to get the next set of results. Use the 'after' cursor from previous response's paging.next field.
|
|
55
|
+
action_attribution_windows: Optional list of attribution windows (e.g., ["1d_click", "7d_click", "1d_view"]).
|
|
56
|
+
When specified, actions include additional fields for each window. The 'value' field always shows 7d_click.
|
|
54
57
|
"""
|
|
55
58
|
if not object_id:
|
|
56
59
|
return json.dumps({"error": "No object ID provided"}, indent=2)
|
|
@@ -78,7 +81,11 @@ async def get_insights(object_id: str, access_token: Optional[str] = None,
|
|
|
78
81
|
|
|
79
82
|
if after:
|
|
80
83
|
params["after"] = after
|
|
81
|
-
|
|
84
|
+
|
|
85
|
+
if action_attribution_windows:
|
|
86
|
+
# Meta API expects single-quote format: ['1d_click','7d_click']
|
|
87
|
+
params["action_attribution_windows"] = "[" + ",".join(f"'{w}'" for w in action_attribution_windows) + "]"
|
|
88
|
+
|
|
82
89
|
data = await make_api_request(endpoint, access_token, params)
|
|
83
90
|
|
|
84
91
|
return json.dumps(data, indent=2)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.21
|
|
4
4
|
Summary: Model Context Protocol (MCP) server for Meta Ads - Use Remote MCP at pipeboard.co for easiest setup
|
|
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
|
|
@@ -389,6 +389,7 @@ For advanced users who need to self-host, the package can be installed from sour
|
|
|
389
389
|
- `time_range`: Time range for insights (default: maximum)
|
|
390
390
|
- `breakdown`: Optional breakdown dimension (e.g., age, gender, country)
|
|
391
391
|
- `level`: Level of aggregation (ad, adset, campaign, account)
|
|
392
|
+
- `action_attribution_windows` (optional): List of attribution windows for conversion data (e.g., ["1d_click", "1d_view", "7d_click", "7d_view"]). When specified, actions and cost_per_action_type include additional fields for each window. The 'value' field always shows 7d_click attribution.
|
|
392
393
|
- Returns: Performance metrics for the specified object
|
|
393
394
|
|
|
394
395
|
21. `mcp_meta_ads_get_login_link`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
meta_ads_mcp/__init__.py,sha256=
|
|
1
|
+
meta_ads_mcp/__init__.py,sha256=sauxtzAb9-OLhcjlqj63XQN_rQkL_tkK8edYVgqua3M,1477
|
|
2
2
|
meta_ads_mcp/__main__.py,sha256=XaQt3iXftG_7f0Zu7Wop9SeFgrD2WBn0EQOaPMc27d8,207
|
|
3
3
|
meta_ads_mcp/core/__init__.py,sha256=IEJtqpyUo0CZSUWeQPljQ-D2vKorTFwXnpBQWSi1hIM,1819
|
|
4
4
|
meta_ads_mcp/core/accounts.py,sha256=7Zoqq0zMIJi_Xsxe9-_b3EYx-UTeieJJvO7HxVRuUS0,4327
|
|
5
|
-
meta_ads_mcp/core/ads.py,sha256=
|
|
5
|
+
meta_ads_mcp/core/ads.py,sha256=Hv6CYgYz85yUJ_OtxLMFH2Q4gZdQKiWEvxQs39oslfU,63116
|
|
6
6
|
meta_ads_mcp/core/ads_library.py,sha256=smGz9FhM6RIUjlQT4Jv1BaZmXahGdK21eRCB7QMhK-4,3228
|
|
7
7
|
meta_ads_mcp/core/adsets.py,sha256=3Ok3EwPTReKshtsVs4gRMlws6LMTUJTb4ZeGPPM8JR8,16570
|
|
8
8
|
meta_ads_mcp/core/api.py,sha256=RvEbXpVO_SxKJeuqsiQhpGYLZuhQlYKCd9hNv7AIZac,16856
|
|
@@ -13,7 +13,7 @@ meta_ads_mcp/core/callback_server.py,sha256=LIAJv9DW--83kdZ7VWWZal8xEprYjRZ8iug4
|
|
|
13
13
|
meta_ads_mcp/core/campaigns.py,sha256=LKo5B8hNUUmfVQ1iu88o8HoU9ixOlGS9lwmPu6x9keA,15604
|
|
14
14
|
meta_ads_mcp/core/duplication.py,sha256=pJ41pI9bIxNf21TSy6KkpcUsc3aSr4KIiO__sunNoq0,18909
|
|
15
15
|
meta_ads_mcp/core/http_auth_integration.py,sha256=lGpKhfzJcyWugBcYEvypY-qnlt-3UDBLqh7xAUH0DGw,12473
|
|
16
|
-
meta_ads_mcp/core/insights.py,sha256=
|
|
16
|
+
meta_ads_mcp/core/insights.py,sha256=eN9jVMyoA0CaJ76x8GZZfwJOdMvs25U4RjJUrzznFPU,5606
|
|
17
17
|
meta_ads_mcp/core/openai_deep_research.py,sha256=68ayGopnBSPEYhN9R1sFvTXtyWtM0lji9aWS3uSXnLY,18649
|
|
18
18
|
meta_ads_mcp/core/pipeboard_auth.py,sha256=vv0yc4RBcGOm7VOovud-QNV1JmvBF-njOKICzAOlyf0,24602
|
|
19
19
|
meta_ads_mcp/core/reports.py,sha256=2pXYCCjYc3MZ8GlrbSHND436W62WlbfbtMll1dfJdqE,5750
|
|
@@ -21,8 +21,8 @@ meta_ads_mcp/core/resources.py,sha256=-zIIfZulpo76vcKv6jhAlQq91cR2SZ3cjYZt3ek3x0
|
|
|
21
21
|
meta_ads_mcp/core/server.py,sha256=9SlgM_qvdlxo24ctnZzLgW1e1nfAspCSx3YyJQkKP64,17856
|
|
22
22
|
meta_ads_mcp/core/targeting.py,sha256=d2uLWbIEtucRuTgwZEdtVKLDZJgaxQ1lDtZ0ZgkBJC4,25150
|
|
23
23
|
meta_ads_mcp/core/utils.py,sha256=ytj41yC5SqduLrAiZYBSd6OUwlJRaIClTwnnYKpNFds,9387
|
|
24
|
-
meta_ads_mcp-1.0.
|
|
25
|
-
meta_ads_mcp-1.0.
|
|
26
|
-
meta_ads_mcp-1.0.
|
|
27
|
-
meta_ads_mcp-1.0.
|
|
28
|
-
meta_ads_mcp-1.0.
|
|
24
|
+
meta_ads_mcp-1.0.21.dist-info/METADATA,sha256=TaQcg4cOHgRz7qSIbogEt1A4NEQSTCwJ_l0yalfudUs,25201
|
|
25
|
+
meta_ads_mcp-1.0.21.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
26
|
+
meta_ads_mcp-1.0.21.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
|
|
27
|
+
meta_ads_mcp-1.0.21.dist-info/licenses/LICENSE,sha256=E2d762fbhwKRYn8o7J6Szr6vyBPrHVDlK3jbHPx-d84,3851
|
|
28
|
+
meta_ads_mcp-1.0.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|