meta-ads-mcp 1.0.15__py3-none-any.whl → 1.0.18__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 +14 -11
- meta_ads_mcp/core/campaigns.py +35 -1
- {meta_ads_mcp-1.0.15.dist-info → meta_ads_mcp-1.0.18.dist-info}/METADATA +42 -26
- {meta_ads_mcp-1.0.15.dist-info → meta_ads_mcp-1.0.18.dist-info}/RECORD +8 -8
- {meta_ads_mcp-1.0.15.dist-info → meta_ads_mcp-1.0.18.dist-info}/WHEEL +1 -1
- {meta_ads_mcp-1.0.15.dist-info → meta_ads_mcp-1.0.18.dist-info}/entry_points.txt +0 -0
- {meta_ads_mcp-1.0.15.dist-info → meta_ads_mcp-1.0.18.dist-info}/licenses/LICENSE +0 -0
meta_ads_mcp/__init__.py
CHANGED
meta_ads_mcp/core/ads.py
CHANGED
|
@@ -855,23 +855,25 @@ async def create_ad_creative(
|
|
|
855
855
|
# ONLY use asset_feed_spec when user explicitly provides plural parameters (headlines/descriptions)
|
|
856
856
|
if headlines or descriptions:
|
|
857
857
|
# Use asset_feed_spec for dynamic creatives with multiple variants
|
|
858
|
+
# Structure based on Meta API working example from documentation
|
|
859
|
+
# ad_formats must be specified with exactly one format
|
|
858
860
|
asset_feed_spec = {
|
|
859
|
-
"ad_formats": ["SINGLE_IMAGE"],
|
|
860
861
|
"images": [{"hash": image_hash}],
|
|
861
|
-
"link_urls": [{"website_url": link_url if link_url else "https://facebook.com"}]
|
|
862
|
+
"link_urls": [{"website_url": link_url if link_url else "https://facebook.com"}],
|
|
863
|
+
"ad_formats": ["SINGLE_IMAGE"]
|
|
862
864
|
}
|
|
863
865
|
|
|
864
|
-
# Handle headlines
|
|
866
|
+
# Handle headlines - Meta API uses "titles" not "headlines" in asset_feed_spec
|
|
865
867
|
if headlines:
|
|
866
|
-
asset_feed_spec["
|
|
868
|
+
asset_feed_spec["titles"] = [{"text": headline_text} for headline_text in headlines]
|
|
867
869
|
|
|
868
870
|
# Handle descriptions
|
|
869
871
|
if descriptions:
|
|
870
872
|
asset_feed_spec["descriptions"] = [{"text": description_text} for description_text in descriptions]
|
|
871
873
|
|
|
872
|
-
# Add message as primary_texts
|
|
874
|
+
# Add message as bodies - Meta API uses "bodies" not "primary_texts" in asset_feed_spec
|
|
873
875
|
if message:
|
|
874
|
-
asset_feed_spec["
|
|
876
|
+
asset_feed_spec["bodies"] = [{"text": message}]
|
|
875
877
|
|
|
876
878
|
# Add call_to_action_types if provided
|
|
877
879
|
if call_to_action_type:
|
|
@@ -879,7 +881,8 @@ async def create_ad_creative(
|
|
|
879
881
|
|
|
880
882
|
creative_data["asset_feed_spec"] = asset_feed_spec
|
|
881
883
|
|
|
882
|
-
# For dynamic creatives,
|
|
884
|
+
# For dynamic creatives with asset_feed_spec, object_story_spec only needs page_id
|
|
885
|
+
# Link information is already in asset_feed_spec.link_urls
|
|
883
886
|
creative_data["object_story_spec"] = {
|
|
884
887
|
"page_id": page_id
|
|
885
888
|
}
|
|
@@ -1023,17 +1026,17 @@ async def update_ad_creative(
|
|
|
1023
1026
|
# Add required ad_formats field for dynamic creatives
|
|
1024
1027
|
asset_feed_spec["ad_formats"] = ["SINGLE_IMAGE"]
|
|
1025
1028
|
|
|
1026
|
-
# Handle headlines
|
|
1029
|
+
# Handle headlines - Meta API uses "titles" not "headlines" in asset_feed_spec
|
|
1027
1030
|
if headlines:
|
|
1028
|
-
asset_feed_spec["
|
|
1031
|
+
asset_feed_spec["titles"] = [{"text": headline_text} for headline_text in headlines]
|
|
1029
1032
|
|
|
1030
1033
|
# Handle descriptions
|
|
1031
1034
|
if descriptions:
|
|
1032
1035
|
asset_feed_spec["descriptions"] = [{"text": description_text} for description_text in descriptions]
|
|
1033
1036
|
|
|
1034
|
-
# Add message as primary_texts
|
|
1037
|
+
# Add message as bodies - Meta API uses "bodies" not "primary_texts" in asset_feed_spec
|
|
1035
1038
|
if message:
|
|
1036
|
-
asset_feed_spec["
|
|
1039
|
+
asset_feed_spec["bodies"] = [{"text": message}]
|
|
1037
1040
|
|
|
1038
1041
|
# Add call_to_action_types if provided
|
|
1039
1042
|
if call_to_action_type:
|
meta_ads_mcp/core/campaigns.py
CHANGED
|
@@ -9,7 +9,14 @@ from .server import mcp_server
|
|
|
9
9
|
|
|
10
10
|
@mcp_server.tool()
|
|
11
11
|
@meta_api_tool
|
|
12
|
-
async def get_campaigns(
|
|
12
|
+
async def get_campaigns(
|
|
13
|
+
account_id: str,
|
|
14
|
+
access_token: Optional[str] = None,
|
|
15
|
+
limit: int = 10,
|
|
16
|
+
status_filter: str = "",
|
|
17
|
+
objective_filter: Union[str, List[str]] = "",
|
|
18
|
+
after: str = ""
|
|
19
|
+
) -> str:
|
|
13
20
|
"""
|
|
14
21
|
Get campaigns for a Meta Ads account with optional filtering.
|
|
15
22
|
|
|
@@ -26,6 +33,11 @@ async def get_campaigns(account_id: str, access_token: Optional[str] = None, lim
|
|
|
26
33
|
status_filter: Filter by effective status (e.g., 'ACTIVE', 'PAUSED', 'ARCHIVED').
|
|
27
34
|
Maps to the 'effective_status' API parameter, which expects an array
|
|
28
35
|
(this function handles the required JSON formatting). Leave empty for all statuses.
|
|
36
|
+
objective_filter: Filter by campaign objective(s). Can be a single objective string or a list of objectives.
|
|
37
|
+
Valid objectives: 'OUTCOME_AWARENESS', 'OUTCOME_TRAFFIC', 'OUTCOME_ENGAGEMENT',
|
|
38
|
+
'OUTCOME_LEADS', 'OUTCOME_SALES', 'OUTCOME_APP_PROMOTION'.
|
|
39
|
+
Examples: 'OUTCOME_LEADS' or ['OUTCOME_LEADS', 'OUTCOME_SALES'].
|
|
40
|
+
Leave empty for all objectives.
|
|
29
41
|
after: Pagination cursor to get the next set of results
|
|
30
42
|
"""
|
|
31
43
|
# Require explicit account_id
|
|
@@ -38,10 +50,32 @@ async def get_campaigns(account_id: str, access_token: Optional[str] = None, lim
|
|
|
38
50
|
"limit": limit
|
|
39
51
|
}
|
|
40
52
|
|
|
53
|
+
# Build filtering array for complex filtering
|
|
54
|
+
filters = []
|
|
55
|
+
|
|
41
56
|
if status_filter:
|
|
42
57
|
# API expects an array, encode it as a JSON string
|
|
43
58
|
params["effective_status"] = json.dumps([status_filter])
|
|
44
59
|
|
|
60
|
+
# Handle objective filtering - supports both single string and list of objectives
|
|
61
|
+
if objective_filter:
|
|
62
|
+
# Convert single string to list for consistent handling
|
|
63
|
+
objectives = [objective_filter] if isinstance(objective_filter, str) else objective_filter
|
|
64
|
+
|
|
65
|
+
# Filter out empty strings
|
|
66
|
+
objectives = [obj for obj in objectives if obj]
|
|
67
|
+
|
|
68
|
+
if objectives:
|
|
69
|
+
filters.append({
|
|
70
|
+
"field": "objective",
|
|
71
|
+
"operator": "IN",
|
|
72
|
+
"value": objectives
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
# Add filtering parameter if we have filters
|
|
76
|
+
if filters:
|
|
77
|
+
params["filtering"] = json.dumps(filters)
|
|
78
|
+
|
|
45
79
|
if after:
|
|
46
80
|
params["after"] = after
|
|
47
81
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Model Context Protocol (MCP) server for
|
|
3
|
+
Version: 1.0.18
|
|
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
|
|
7
7
|
Author-email: Yves Junqueira <yves.junqueira@gmail.com>
|
|
@@ -68,6 +68,16 @@ The fastest and most reliable way to get started is to **[🚀 Get started with
|
|
|
68
68
|
|
|
69
69
|
That's it! You can now ask Claude to analyze your Meta ad campaigns, get performance insights, and manage your advertising.
|
|
70
70
|
|
|
71
|
+
#### Advanced: Direct Token Authentication (Claude)
|
|
72
|
+
|
|
73
|
+
For direct token-based authentication without the interactive flow, use this URL format when adding the integration:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
https://mcp.pipeboard.co/meta-ads-mcp?token=YOUR_PIPEBOARD_TOKEN
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Get your token at [pipeboard.co/api-tokens](https://pipeboard.co/api-tokens).
|
|
80
|
+
|
|
71
81
|
### For Cursor Users
|
|
72
82
|
|
|
73
83
|
Add the following to your `~/.cursor/mcp.json`. Once you enable the remote MCP, click on "Needs login" to finish the login process.
|
|
@@ -83,31 +93,43 @@ Add the following to your `~/.cursor/mcp.json`. Once you enable the remote MCP,
|
|
|
83
93
|
}
|
|
84
94
|
```
|
|
85
95
|
|
|
96
|
+
#### Advanced: Direct Token Authentication (Cursor)
|
|
97
|
+
|
|
98
|
+
If you prefer to authenticate without the interactive login flow, you can include your Pipeboard API token directly in the URL:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"meta-ads-remote": {
|
|
104
|
+
"url": "https://mcp.pipeboard.co/meta-ads-mcp?token=YOUR_PIPEBOARD_TOKEN"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Get your token at [pipeboard.co/api-tokens](https://pipeboard.co/api-tokens).
|
|
111
|
+
|
|
86
112
|
### For Other MCP Clients
|
|
87
113
|
|
|
88
114
|
Use the Remote MCP URL: `https://mcp.pipeboard.co/meta-ads-mcp`
|
|
89
115
|
|
|
90
116
|
**[📖 Get detailed setup instructions for your AI client here](https://pipeboard.co)**
|
|
91
117
|
|
|
92
|
-
|
|
118
|
+
#### Advanced: Direct Token Authentication (Other Clients)
|
|
93
119
|
|
|
94
|
-
|
|
120
|
+
For MCP clients that support token-based authentication, you can append your Pipeboard API token to the URL:
|
|
95
121
|
|
|
96
|
-
|
|
122
|
+
```
|
|
123
|
+
https://mcp.pipeboard.co/meta-ads-mcp?token=YOUR_PIPEBOARD_TOKEN
|
|
124
|
+
```
|
|
97
125
|
|
|
98
|
-
|
|
126
|
+
This bypasses the interactive login flow and authenticates immediately. Get your token at [pipeboard.co/api-tokens](https://pipeboard.co/api-tokens).
|
|
99
127
|
|
|
100
|
-
|
|
101
|
-
# Install via uvx (recommended)
|
|
102
|
-
uvx meta-ads-mcp
|
|
128
|
+
## Local Installation (Advanced Technical Users Only)
|
|
103
129
|
|
|
104
|
-
|
|
105
|
-
export PIPEBOARD_API_TOKEN=your_pipeboard_token
|
|
130
|
+
🚀 **We strongly recommend using [Remote MCP](https://pipeboard.co) instead** - it's faster, more reliable, and requires no technical setup.
|
|
106
131
|
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
For detailed step-by-step instructions, authentication setup, debugging, and troubleshooting, visit **[LOCAL_INSTALLATION.md](LOCAL_INSTALLATION.md)**.
|
|
132
|
+
Meta Ads MCP also supports a local 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.
|
|
111
133
|
|
|
112
134
|
## Features
|
|
113
135
|
|
|
@@ -130,9 +152,9 @@ For detailed step-by-step instructions, authentication setup, debugging, and tro
|
|
|
130
152
|
|
|
131
153
|
**[✨ Get started with Remote MCP here](https://pipeboard.co)** - no technical setup required! Just connect your Facebook Ads account and start asking AI to analyze your campaigns.
|
|
132
154
|
|
|
133
|
-
### Local Installation (Technical Users)
|
|
155
|
+
### Local Installation (Advanced Technical Users)
|
|
134
156
|
|
|
135
|
-
For
|
|
157
|
+
For advanced users who need to self-host, the package can be installed from source. Local installations require creating your own Meta Developer App. **We recommend using [Remote MCP](https://pipeboard.co) for a simpler experience.**
|
|
136
158
|
|
|
137
159
|
### Available MCP Tools
|
|
138
160
|
|
|
@@ -458,7 +480,7 @@ The only restriction is that you cannot offer this as a competing hosted service
|
|
|
458
480
|
Meta Ads MCP follows security best practices with secure token management and automatic authentication handling.
|
|
459
481
|
|
|
460
482
|
- **Remote MCP**: All authentication is handled securely in the cloud - no local token storage required
|
|
461
|
-
- **Local Installation**: Tokens are cached securely on your local machine
|
|
483
|
+
- **Local Installation**: Tokens are cached securely on your local machine
|
|
462
484
|
|
|
463
485
|
## Testing
|
|
464
486
|
|
|
@@ -470,7 +492,7 @@ Test your Meta Ads MCP connection with any MCP client:
|
|
|
470
492
|
2. **Check Account Details**: Use `mcp_meta_ads_get_account_info` with your account ID
|
|
471
493
|
3. **List Campaigns**: Try `mcp_meta_ads_get_campaigns` to see your ad campaigns
|
|
472
494
|
|
|
473
|
-
For detailed local installation testing, see
|
|
495
|
+
For detailed local installation testing, see the source repository.
|
|
474
496
|
|
|
475
497
|
## Troubleshooting
|
|
476
498
|
|
|
@@ -480,10 +502,4 @@ The easiest way to avoid any setup issues is to **[🎯 use our Remote MCP inste
|
|
|
480
502
|
|
|
481
503
|
### Local Installation Issues
|
|
482
504
|
|
|
483
|
-
For
|
|
484
|
-
|
|
485
|
-
- Authentication troubleshooting
|
|
486
|
-
- Installation issues and solutions
|
|
487
|
-
- API error resolution
|
|
488
|
-
- Debug logs and diagnostic commands
|
|
489
|
-
- Performance optimization tips
|
|
505
|
+
For local installation issues, refer to the source repository. **For the easiest experience, we recommend using [Remote MCP](https://pipeboard.co) instead.**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
meta_ads_mcp/__init__.py,sha256=
|
|
1
|
+
meta_ads_mcp/__init__.py,sha256=qVIccqA3rZtJUEMjPcFLKFUhyRlnAJyTyP4l29VklAU,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=ED67n5kCcmqk5BDDTOA4zVYUPUsAJw8ZvlM2kVwNQlI,62007
|
|
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
|
|
@@ -10,7 +10,7 @@ meta_ads_mcp/core/auth.py,sha256=l_IvejK2KYXg8yhBiP0ifE6mGwJ6ZujqYQbVw1KOUME,236
|
|
|
10
10
|
meta_ads_mcp/core/authentication.py,sha256=bAdmlSxQpqFN1vup9Wijl-iCfPLPMyFfMhIPdoNOPYg,10540
|
|
11
11
|
meta_ads_mcp/core/budget_schedules.py,sha256=FVyJuKbjUE4cmtlPJEbIwpN6JmU-1WQjc7io1y5JaHE,2911
|
|
12
12
|
meta_ads_mcp/core/callback_server.py,sha256=LIAJv9DW--83kdZ7VWWZal8xEprYjRZ8iug4rMczYbQ,9372
|
|
13
|
-
meta_ads_mcp/core/campaigns.py,sha256=
|
|
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
16
|
meta_ads_mcp/core/insights.py,sha256=ogSGlC0ddh8RFzWydilfDc7GYnjtInFiEQS7cSoyTmw,5061
|
|
@@ -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.18.dist-info/METADATA,sha256=9Dyns9X9nMyMP-ZCMWpFuk6lckX7ApqIAJIfIiYY_vs,24903
|
|
25
|
+
meta_ads_mcp-1.0.18.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
26
|
+
meta_ads_mcp-1.0.18.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
|
|
27
|
+
meta_ads_mcp-1.0.18.dist-info/licenses/LICENSE,sha256=E2d762fbhwKRYn8o7J6Szr6vyBPrHVDlK3jbHPx-d84,3851
|
|
28
|
+
meta_ads_mcp-1.0.18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|