meta-ads-mcp 0.10.6__py3-none-any.whl → 0.10.9__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 +2 -3
- meta_ads_mcp/core/ads.py +49 -1
- meta_ads_mcp/core/campaigns.py +8 -2
- {meta_ads_mcp-0.10.6.dist-info → meta_ads_mcp-0.10.9.dist-info}/METADATA +32 -2
- {meta_ads_mcp-0.10.6.dist-info → meta_ads_mcp-0.10.9.dist-info}/RECORD +8 -8
- {meta_ads_mcp-0.10.6.dist-info → meta_ads_mcp-0.10.9.dist-info}/WHEEL +0 -0
- {meta_ads_mcp-0.10.6.dist-info → meta_ads_mcp-0.10.9.dist-info}/entry_points.txt +0 -0
- {meta_ads_mcp-0.10.6.dist-info → meta_ads_mcp-0.10.9.dist-info}/licenses/LICENSE +0 -0
meta_ads_mcp/__init__.py
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Meta Ads MCP - Python Package
|
|
3
3
|
|
|
4
|
-
This package provides a Meta Ads
|
|
5
|
-
with the Claude LLM.
|
|
4
|
+
This package provides a Meta Ads MCP integration
|
|
6
5
|
"""
|
|
7
6
|
|
|
8
7
|
from meta_ads_mcp.core.server import main
|
|
9
8
|
|
|
10
|
-
__version__ = "0.10.
|
|
9
|
+
__version__ = "0.10.9"
|
|
11
10
|
|
|
12
11
|
__all__ = [
|
|
13
12
|
'get_ad_accounts',
|
meta_ads_mcp/core/ads.py
CHANGED
|
@@ -671,7 +671,55 @@ async def upload_ad_image(
|
|
|
671
671
|
print(f"Uploading image to Facebook Ad Account {account_id}")
|
|
672
672
|
data = await make_api_request(endpoint, access_token, params, method="POST")
|
|
673
673
|
|
|
674
|
-
|
|
674
|
+
# Normalize/structure the response for callers (e.g., to easily grab image_hash)
|
|
675
|
+
# Typical Graph API response shape:
|
|
676
|
+
# { "images": { "<hash>": { "hash": "<hash>", "url": "...", "width": ..., "height": ..., "name": "...", "status": 1 } } }
|
|
677
|
+
if isinstance(data, dict) and "images" in data and isinstance(data["images"], dict) and data["images"]:
|
|
678
|
+
images_dict = data["images"]
|
|
679
|
+
images_list = []
|
|
680
|
+
for hash_key, info in images_dict.items():
|
|
681
|
+
# Some responses may omit the nested hash, so ensure it's present
|
|
682
|
+
normalized = {
|
|
683
|
+
"hash": (info.get("hash") or hash_key),
|
|
684
|
+
"url": info.get("url"),
|
|
685
|
+
"width": info.get("width"),
|
|
686
|
+
"height": info.get("height"),
|
|
687
|
+
"name": info.get("name"),
|
|
688
|
+
}
|
|
689
|
+
# Drop null/None values
|
|
690
|
+
normalized = {k: v for k, v in normalized.items() if v is not None}
|
|
691
|
+
images_list.append(normalized)
|
|
692
|
+
|
|
693
|
+
# Sort deterministically by hash
|
|
694
|
+
images_list.sort(key=lambda i: i.get("hash", ""))
|
|
695
|
+
primary_hash = images_list[0].get("hash") if images_list else None
|
|
696
|
+
|
|
697
|
+
result = {
|
|
698
|
+
"success": True,
|
|
699
|
+
"account_id": account_id,
|
|
700
|
+
"name": final_name,
|
|
701
|
+
"image_hash": primary_hash,
|
|
702
|
+
"images_count": len(images_list),
|
|
703
|
+
"images": images_list
|
|
704
|
+
}
|
|
705
|
+
return json.dumps(result, indent=2)
|
|
706
|
+
|
|
707
|
+
# If the API returned an error-like structure, surface it consistently
|
|
708
|
+
if isinstance(data, dict) and "error" in data:
|
|
709
|
+
return json.dumps({
|
|
710
|
+
"error": "Failed to upload image",
|
|
711
|
+
"details": data.get("error"),
|
|
712
|
+
"account_id": account_id,
|
|
713
|
+
"name": final_name
|
|
714
|
+
}, indent=2)
|
|
715
|
+
|
|
716
|
+
# Fallback: return a wrapped raw response to avoid breaking callers
|
|
717
|
+
return json.dumps({
|
|
718
|
+
"success": True,
|
|
719
|
+
"account_id": account_id,
|
|
720
|
+
"name": final_name,
|
|
721
|
+
"raw_response": data
|
|
722
|
+
}, indent=2)
|
|
675
723
|
|
|
676
724
|
except Exception as e:
|
|
677
725
|
return json.dumps({
|
meta_ads_mcp/core/campaigns.py
CHANGED
|
@@ -109,13 +109,19 @@ async def create_campaign(
|
|
|
109
109
|
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
110
110
|
account_id: Meta Ads account ID (format: act_XXXXXXXXX)
|
|
111
111
|
name: Campaign name
|
|
112
|
-
objective: Campaign objective
|
|
112
|
+
objective: Campaign objective (ODAX, outcome-based). Must be one of:
|
|
113
|
+
OUTCOME_AWARENESS, OUTCOME_TRAFFIC, OUTCOME_ENGAGEMENT,
|
|
114
|
+
OUTCOME_LEADS, OUTCOME_SALES, OUTCOME_APP_PROMOTION.
|
|
115
|
+
Note: Legacy objectives like BRAND_AWARENESS, LINK_CLICKS,
|
|
116
|
+
CONVERSIONS, APP_INSTALLS, etc. are not valid for new
|
|
117
|
+
campaigns and will cause a 400 error. Use the outcome-based
|
|
118
|
+
values above (e.g., BRAND_AWARENESS → OUTCOME_AWARENESS).
|
|
113
119
|
status: Initial campaign status (default: PAUSED)
|
|
114
120
|
special_ad_categories: List of special ad categories if applicable
|
|
115
121
|
daily_budget: Daily budget in account currency (in cents) as a string (only used if use_adset_level_budgets=False)
|
|
116
122
|
lifetime_budget: Lifetime budget in account currency (in cents) as a string (only used if use_adset_level_budgets=False)
|
|
117
123
|
buying_type: Buying type (e.g., 'AUCTION')
|
|
118
|
-
bid_strategy: Bid strategy
|
|
124
|
+
bid_strategy: Bid strategy. Must be one of: 'LOWEST_COST_WITHOUT_CAP', 'LOWEST_COST_WITH_BID_CAP', 'COST_CAP', 'LOWEST_COST_WITH_MIN_ROAS'.
|
|
119
125
|
bid_cap: Bid cap in account currency (in cents) as a string
|
|
120
126
|
spend_cap: Spending limit for the campaign in account currency (in cents) as a string
|
|
121
127
|
campaign_budget_optimization: Whether to enable campaign budget optimization (only used if use_adset_level_budgets=False)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.9
|
|
4
4
|
Summary: Model Context Protocol (MCP) server 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
|
|
@@ -176,13 +176,43 @@ For local installation configuration, authentication options, and advanced techn
|
|
|
176
176
|
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
177
177
|
- `account_id`: Meta Ads account ID (format: act_XXXXXXXXX)
|
|
178
178
|
- `name`: Campaign name
|
|
179
|
-
- `objective`: Campaign objective (
|
|
179
|
+
- `objective`: Campaign objective (ODAX, outcome-based). Must be one of:
|
|
180
|
+
- `OUTCOME_AWARENESS`
|
|
181
|
+
- `OUTCOME_TRAFFIC`
|
|
182
|
+
- `OUTCOME_ENGAGEMENT`
|
|
183
|
+
- `OUTCOME_LEADS`
|
|
184
|
+
- `OUTCOME_SALES`
|
|
185
|
+
- `OUTCOME_APP_PROMOTION`
|
|
186
|
+
|
|
187
|
+
Note: Legacy objectives such as `BRAND_AWARENESS`, `LINK_CLICKS`, `CONVERSIONS`, `APP_INSTALLS`, etc. are no longer valid for new campaigns and will cause a 400 error. Use the outcome-based values above. Common mappings:
|
|
188
|
+
- `BRAND_AWARENESS` → `OUTCOME_AWARENESS`
|
|
189
|
+
- `REACH` → `OUTCOME_AWARENESS`
|
|
190
|
+
- `LINK_CLICKS`, `TRAFFIC` → `OUTCOME_TRAFFIC`
|
|
191
|
+
- `POST_ENGAGEMENT`, `PAGE_LIKES`, `EVENT_RESPONSES`, `VIDEO_VIEWS` → `OUTCOME_ENGAGEMENT`
|
|
192
|
+
- `LEAD_GENERATION` → `OUTCOME_LEADS`
|
|
193
|
+
- `CONVERSIONS`, `CATALOG_SALES`, `MESSAGES` (sales-focused flows) → `OUTCOME_SALES`
|
|
194
|
+
- `APP_INSTALLS` → `OUTCOME_APP_PROMOTION`
|
|
180
195
|
- `status`: Initial campaign status (default: PAUSED)
|
|
181
196
|
- `special_ad_categories`: List of special ad categories if applicable
|
|
182
197
|
- `daily_budget`: Daily budget in account currency (in cents)
|
|
183
198
|
- `lifetime_budget`: Lifetime budget in account currency (in cents)
|
|
199
|
+
- `bid_strategy`: Bid strategy. Must be one of: `LOWEST_COST_WITHOUT_CAP`, `LOWEST_COST_WITH_BID_CAP`, `COST_CAP`, `LOWEST_COST_WITH_MIN_ROAS`.
|
|
184
200
|
- Returns: Confirmation with new campaign details
|
|
185
201
|
|
|
202
|
+
- Example:
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"name": "2025 - Bedroom Furniture - Awareness",
|
|
206
|
+
"account_id": "act_123456789012345",
|
|
207
|
+
"objective": "OUTCOME_AWARENESS",
|
|
208
|
+
"special_ad_categories": [],
|
|
209
|
+
"status": "PAUSED",
|
|
210
|
+
"buying_type": "AUCTION",
|
|
211
|
+
"bid_strategy": "LOWEST_COST_WITHOUT_CAP",
|
|
212
|
+
"daily_budget": 10000
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
186
216
|
7. `mcp_meta_ads_get_adsets`
|
|
187
217
|
- Get ad sets for a Meta Ads account with optional filtering by campaign
|
|
188
218
|
- Inputs:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
meta_ads_mcp/__init__.py,sha256=
|
|
1
|
+
meta_ads_mcp/__init__.py,sha256=Zh3K7XVia0Eh3hCmSqoEJaSwTVxDo3tP5ztVCVl6BhA,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=0lfyvRbhBigFKgNq5Mk3fk4Qh6MtIkKScdOnoc_rQkg,4314
|
|
5
|
-
meta_ads_mcp/core/ads.py,sha256=
|
|
5
|
+
meta_ads_mcp/core/ads.py,sha256=XRaFs60I7kKkBlQyodBCWodQ8-Lef6MVuZF8Vx6XVEs,59456
|
|
6
6
|
meta_ads_mcp/core/ads_library.py,sha256=BBGVbtjO5eFV42iiY3XPU-wIV8HupzUKpHgPBrydSvU,3232
|
|
7
7
|
meta_ads_mcp/core/adsets.py,sha256=kfggH1F2KD19iPDErE0QdKw2aVX7F409EPLDTM7MKnQ,16024
|
|
8
8
|
meta_ads_mcp/core/api.py,sha256=kWpIafvSsxnesfb5TqndA7ozKoIspby5e_6Jl23L7hY,16447
|
|
@@ -10,7 +10,7 @@ meta_ads_mcp/core/auth.py,sha256=2CjFbxpJM3OR3OzCipB8l_-l2xQ1nioGfdI3ZDMnjHM,236
|
|
|
10
10
|
meta_ads_mcp/core/authentication.py,sha256=o5YMW0xmoTDiXDmpgVPo4mYSxCil6aGMQHbIeHxj_kg,10509
|
|
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
|
|
13
|
-
meta_ads_mcp/core/campaigns.py,sha256=
|
|
13
|
+
meta_ads_mcp/core/campaigns.py,sha256=TUPTAvY89uU4REewDtL6EWL2Mk9LQVoaUjbg5rfj5qY,14461
|
|
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
16
|
meta_ads_mcp/core/insights.py,sha256=unhcCaYjgsir62llCdIDg0F-PHISiHune08uYG5IXTM,4707
|
|
@@ -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=nl_JVXNhCu85ho5ssklZiQYC3iL_oosdlpEuyCOVXcM,13824
|
|
23
23
|
meta_ads_mcp/core/utils.py,sha256=ytj41yC5SqduLrAiZYBSd6OUwlJRaIClTwnnYKpNFds,9387
|
|
24
|
-
meta_ads_mcp-0.10.
|
|
25
|
-
meta_ads_mcp-0.10.
|
|
26
|
-
meta_ads_mcp-0.10.
|
|
27
|
-
meta_ads_mcp-0.10.
|
|
28
|
-
meta_ads_mcp-0.10.
|
|
24
|
+
meta_ads_mcp-0.10.9.dist-info/METADATA,sha256=Iz6cmxL8TTF3nyilJwoXRAUDApndnnLtgcnUokEUckU,24265
|
|
25
|
+
meta_ads_mcp-0.10.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
26
|
+
meta_ads_mcp-0.10.9.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
|
|
27
|
+
meta_ads_mcp-0.10.9.dist-info/licenses/LICENSE,sha256=E2d762fbhwKRYn8o7J6Szr6vyBPrHVDlK3jbHPx-d84,3851
|
|
28
|
+
meta_ads_mcp-0.10.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|