meta-ads-mcp 0.9.0__py3-none-any.whl → 0.9.2__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/accounts.py +2 -2
- meta_ads_mcp/core/adsets.py +68 -1
- meta_ads_mcp/core/server.py +1 -1
- {meta_ads_mcp-0.9.0.dist-info → meta_ads_mcp-0.9.2.dist-info}/METADATA +3 -3
- {meta_ads_mcp-0.9.0.dist-info → meta_ads_mcp-0.9.2.dist-info}/RECORD +9 -9
- {meta_ads_mcp-0.9.0.dist-info → meta_ads_mcp-0.9.2.dist-info}/WHEEL +0 -0
- {meta_ads_mcp-0.9.0.dist-info → meta_ads_mcp-0.9.2.dist-info}/entry_points.txt +0 -0
- {meta_ads_mcp-0.9.0.dist-info → meta_ads_mcp-0.9.2.dist-info}/licenses/LICENSE +0 -0
meta_ads_mcp/__init__.py
CHANGED
meta_ads_mcp/core/accounts.py
CHANGED
|
@@ -8,14 +8,14 @@ from .server import mcp_server
|
|
|
8
8
|
|
|
9
9
|
@mcp_server.tool()
|
|
10
10
|
@meta_api_tool
|
|
11
|
-
async def get_ad_accounts(access_token: str = None, user_id: str = "me", limit: int =
|
|
11
|
+
async def get_ad_accounts(access_token: str = None, user_id: str = "me", limit: int = 200) -> str:
|
|
12
12
|
"""
|
|
13
13
|
Get ad accounts accessible by a user.
|
|
14
14
|
|
|
15
15
|
Args:
|
|
16
16
|
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
17
17
|
user_id: Meta user ID or "me" for the current user
|
|
18
|
-
limit: Maximum number of accounts to return (default:
|
|
18
|
+
limit: Maximum number of accounts to return (default: 200)
|
|
19
19
|
"""
|
|
20
20
|
endpoint = f"{user_id}/adaccounts"
|
|
21
21
|
params = {
|
meta_ads_mcp/core/adsets.py
CHANGED
|
@@ -104,6 +104,8 @@ async def create_adset(
|
|
|
104
104
|
start_time: str = None,
|
|
105
105
|
end_time: str = None,
|
|
106
106
|
dsa_beneficiary: str = None,
|
|
107
|
+
promoted_object: Dict[str, Any] = None,
|
|
108
|
+
destination_type: str = None,
|
|
107
109
|
access_token: str = None
|
|
108
110
|
) -> str:
|
|
109
111
|
"""
|
|
@@ -118,13 +120,18 @@ async def create_adset(
|
|
|
118
120
|
lifetime_budget: Lifetime budget in account currency (in cents) as a string
|
|
119
121
|
targeting: Targeting specifications including age, location, interests, etc.
|
|
120
122
|
Use targeting_automation.advantage_audience=1 for automatic audience finding
|
|
121
|
-
optimization_goal: Conversion optimization goal (e.g., 'LINK_CLICKS', 'REACH', 'CONVERSIONS')
|
|
123
|
+
optimization_goal: Conversion optimization goal (e.g., 'LINK_CLICKS', 'REACH', 'CONVERSIONS', 'APP_INSTALLS')
|
|
122
124
|
billing_event: How you're charged (e.g., 'IMPRESSIONS', 'LINK_CLICKS')
|
|
123
125
|
bid_amount: Bid amount in account currency (in cents)
|
|
124
126
|
bid_strategy: Bid strategy (e.g., 'LOWEST_COST', 'LOWEST_COST_WITH_BID_CAP')
|
|
125
127
|
start_time: Start time in ISO 8601 format (e.g., '2023-12-01T12:00:00-0800')
|
|
126
128
|
end_time: End time in ISO 8601 format
|
|
127
129
|
dsa_beneficiary: DSA beneficiary (person/organization benefiting from ads) for European compliance
|
|
130
|
+
promoted_object: Mobile app configuration for APP_INSTALLS campaigns. Required fields: application_id, object_store_url.
|
|
131
|
+
Optional fields: custom_event_type, pixel_id, page_id.
|
|
132
|
+
Example: {"application_id": "123456789012345", "object_store_url": "https://apps.apple.com/app/id123456789"}
|
|
133
|
+
destination_type: Where users are directed after clicking the ad (e.g., 'APP_STORE', 'DEEPLINK', 'APP_INSTALL').
|
|
134
|
+
Required for mobile app campaigns.
|
|
128
135
|
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
129
136
|
"""
|
|
130
137
|
# Check required parameters
|
|
@@ -143,6 +150,59 @@ async def create_adset(
|
|
|
143
150
|
if not billing_event:
|
|
144
151
|
return json.dumps({"error": "No billing event provided"}, indent=2)
|
|
145
152
|
|
|
153
|
+
# Validate mobile app parameters for APP_INSTALLS campaigns
|
|
154
|
+
if optimization_goal == "APP_INSTALLS":
|
|
155
|
+
if not promoted_object:
|
|
156
|
+
return json.dumps({
|
|
157
|
+
"error": "promoted_object is required for APP_INSTALLS optimization goal",
|
|
158
|
+
"details": "Mobile app campaigns must specify which app is being promoted",
|
|
159
|
+
"required_fields": ["application_id", "object_store_url"]
|
|
160
|
+
}, indent=2)
|
|
161
|
+
|
|
162
|
+
# Validate promoted_object structure
|
|
163
|
+
if not isinstance(promoted_object, dict):
|
|
164
|
+
return json.dumps({
|
|
165
|
+
"error": "promoted_object must be a dictionary",
|
|
166
|
+
"example": {"application_id": "123456789012345", "object_store_url": "https://apps.apple.com/app/id123456789"}
|
|
167
|
+
}, indent=2)
|
|
168
|
+
|
|
169
|
+
# Validate required promoted_object fields
|
|
170
|
+
if "application_id" not in promoted_object:
|
|
171
|
+
return json.dumps({
|
|
172
|
+
"error": "promoted_object missing required field: application_id",
|
|
173
|
+
"details": "application_id is the Facebook app ID for your mobile app"
|
|
174
|
+
}, indent=2)
|
|
175
|
+
|
|
176
|
+
if "object_store_url" not in promoted_object:
|
|
177
|
+
return json.dumps({
|
|
178
|
+
"error": "promoted_object missing required field: object_store_url",
|
|
179
|
+
"details": "object_store_url should be the App Store or Google Play URL for your app"
|
|
180
|
+
}, indent=2)
|
|
181
|
+
|
|
182
|
+
# Validate store URL format
|
|
183
|
+
store_url = promoted_object["object_store_url"]
|
|
184
|
+
valid_store_patterns = [
|
|
185
|
+
"apps.apple.com", # iOS App Store
|
|
186
|
+
"play.google.com", # Google Play Store
|
|
187
|
+
"itunes.apple.com" # Alternative iOS format
|
|
188
|
+
]
|
|
189
|
+
|
|
190
|
+
if not any(pattern in store_url for pattern in valid_store_patterns):
|
|
191
|
+
return json.dumps({
|
|
192
|
+
"error": "Invalid object_store_url format",
|
|
193
|
+
"details": "URL must be from App Store (apps.apple.com) or Google Play (play.google.com)",
|
|
194
|
+
"provided_url": store_url
|
|
195
|
+
}, indent=2)
|
|
196
|
+
|
|
197
|
+
# Validate destination_type if provided
|
|
198
|
+
if destination_type:
|
|
199
|
+
valid_destination_types = ["APP_STORE", "DEEPLINK", "APP_INSTALL"]
|
|
200
|
+
if destination_type not in valid_destination_types:
|
|
201
|
+
return json.dumps({
|
|
202
|
+
"error": f"Invalid destination_type: {destination_type}",
|
|
203
|
+
"valid_values": valid_destination_types
|
|
204
|
+
}, indent=2)
|
|
205
|
+
|
|
146
206
|
# Basic targeting is required if not provided
|
|
147
207
|
if not targeting:
|
|
148
208
|
targeting = {
|
|
@@ -187,6 +247,13 @@ async def create_adset(
|
|
|
187
247
|
if dsa_beneficiary:
|
|
188
248
|
params["dsa_beneficiary"] = dsa_beneficiary
|
|
189
249
|
|
|
250
|
+
# Add mobile app parameters if provided
|
|
251
|
+
if promoted_object:
|
|
252
|
+
params["promoted_object"] = json.dumps(promoted_object)
|
|
253
|
+
|
|
254
|
+
if destination_type:
|
|
255
|
+
params["destination_type"] = destination_type
|
|
256
|
+
|
|
190
257
|
try:
|
|
191
258
|
data = await make_api_request(endpoint, access_token, params, method="POST")
|
|
192
259
|
return json.dumps(data, indent=2)
|
meta_ads_mcp/core/server.py
CHANGED
|
@@ -14,7 +14,7 @@ from .pipeboard_auth import pipeboard_auth_manager
|
|
|
14
14
|
import time
|
|
15
15
|
|
|
16
16
|
# Initialize FastMCP server
|
|
17
|
-
mcp_server = FastMCP("meta-ads"
|
|
17
|
+
mcp_server = FastMCP("meta-ads")
|
|
18
18
|
|
|
19
19
|
# Register resource URIs
|
|
20
20
|
mcp_server.resource(uri="meta-ads://resources")(list_resources)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
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
|
|
@@ -13,7 +13,7 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Requires-Python: >=3.10
|
|
15
15
|
Requires-Dist: httpx>=0.26.0
|
|
16
|
-
Requires-Dist: mcp[cli]
|
|
16
|
+
Requires-Dist: mcp[cli]<=1.12.2,>=1.10.1
|
|
17
17
|
Requires-Dist: pathlib>=1.0.1
|
|
18
18
|
Requires-Dist: pillow>=10.0.0
|
|
19
19
|
Requires-Dist: pytest-asyncio>=1.0.0
|
|
@@ -136,7 +136,7 @@ For local installation configuration, authentication options, and advanced techn
|
|
|
136
136
|
- Inputs:
|
|
137
137
|
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
138
138
|
- `user_id`: Meta user ID or "me" for the current user
|
|
139
|
-
- `limit`: Maximum number of accounts to return (default:
|
|
139
|
+
- `limit`: Maximum number of accounts to return (default: 200)
|
|
140
140
|
- Returns: List of accessible ad accounts with their details
|
|
141
141
|
|
|
142
142
|
2. `mcp_meta_ads_get_account_info`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
meta_ads_mcp/__init__.py,sha256=
|
|
1
|
+
meta_ads_mcp/__init__.py,sha256=LHub3AAf0DNSjHSLFEDeCMwK-zSb3cEjkJ3rtH_y9J4,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=
|
|
4
|
+
meta_ads_mcp/core/accounts.py,sha256=Xu_fA44wL7eWtDkdZ8Nt5gnILXOLTl4MT1YfAfnChuw,4032
|
|
5
5
|
meta_ads_mcp/core/ads.py,sha256=3UpoktML-5hJ_k2u5KOk3-VcFe_goz531jLi6-qJhqU,54929
|
|
6
6
|
meta_ads_mcp/core/ads_library.py,sha256=BBGVbtjO5eFV42iiY3XPU-wIV8HupzUKpHgPBrydSvU,3232
|
|
7
|
-
meta_ads_mcp/core/adsets.py,sha256=
|
|
7
|
+
meta_ads_mcp/core/adsets.py,sha256=mqB7u-6HY3QHSQo-zStan7IBjksdcvzcyOC_wVXFvJY,15863
|
|
8
8
|
meta_ads_mcp/core/api.py,sha256=kWpIafvSsxnesfb5TqndA7ozKoIspby5e_6Jl23L7hY,16447
|
|
9
9
|
meta_ads_mcp/core/auth.py,sha256=2CjFbxpJM3OR3OzCipB8l_-l2xQ1nioGfdI3ZDMnjHM,23629
|
|
10
10
|
meta_ads_mcp/core/authentication.py,sha256=-AJxa3a5ZshRCvmJThBaNwCAJ1D2_qOgUkvu539c_MY,10159
|
|
@@ -18,11 +18,11 @@ meta_ads_mcp/core/openai_deep_research.py,sha256=gLQlzIUBd-VyBMYjJ4vchMadQ-4aT3P
|
|
|
18
18
|
meta_ads_mcp/core/pipeboard_auth.py,sha256=ZwEQy8r0TwobFRQ5gmlSjhIfvlUmMtfWNlpQjXCUhl0,24582
|
|
19
19
|
meta_ads_mcp/core/reports.py,sha256=Dv3hfsPOR7IZ9WrYrKd_6SNgZl-USIphg7knva3UYAw,5747
|
|
20
20
|
meta_ads_mcp/core/resources.py,sha256=-zIIfZulpo76vcKv6jhAlQq91cR2SZ3cjYZt3ek3x0w,1236
|
|
21
|
-
meta_ads_mcp/core/server.py,sha256=
|
|
21
|
+
meta_ads_mcp/core/server.py,sha256=9SlgM_qvdlxo24ctnZzLgW1e1nfAspCSx3YyJQkKP64,17856
|
|
22
22
|
meta_ads_mcp/core/targeting.py,sha256=3HW1qirEdwaQurlBZGenbIwawcb5J06ghJKRfgu9ZEs,6318
|
|
23
23
|
meta_ads_mcp/core/utils.py,sha256=ytj41yC5SqduLrAiZYBSd6OUwlJRaIClTwnnYKpNFds,9387
|
|
24
|
-
meta_ads_mcp-0.9.
|
|
25
|
-
meta_ads_mcp-0.9.
|
|
26
|
-
meta_ads_mcp-0.9.
|
|
27
|
-
meta_ads_mcp-0.9.
|
|
28
|
-
meta_ads_mcp-0.9.
|
|
24
|
+
meta_ads_mcp-0.9.2.dist-info/METADATA,sha256=G9HUQNkhGri-gZ8jBgdAcZi9DUwf_8xlrXz19V93TIY,22444
|
|
25
|
+
meta_ads_mcp-0.9.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
26
|
+
meta_ads_mcp-0.9.2.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
|
|
27
|
+
meta_ads_mcp-0.9.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
28
|
+
meta_ads_mcp-0.9.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|