meta-ads-mcp 0.6.0__py3-none-any.whl → 0.7.0__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 +15 -3
- meta_ads_mcp/core/__init__.py +7 -0
- meta_ads_mcp/core/targeting.py +185 -0
- {meta_ads_mcp-0.6.0.dist-info → meta_ads_mcp-0.7.0.dist-info}/METADATA +49 -1
- {meta_ads_mcp-0.6.0.dist-info → meta_ads_mcp-0.7.0.dist-info}/RECORD +8 -7
- {meta_ads_mcp-0.6.0.dist-info → meta_ads_mcp-0.7.0.dist-info}/WHEEL +0 -0
- {meta_ads_mcp-0.6.0.dist-info → meta_ads_mcp-0.7.0.dist-info}/entry_points.txt +0 -0
- {meta_ads_mcp-0.6.0.dist-info → meta_ads_mcp-0.7.0.dist-info}/licenses/LICENSE +0 -0
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.
|
|
10
|
+
__version__ = "0.7.0"
|
|
11
11
|
|
|
12
12
|
__all__ = [
|
|
13
13
|
'get_ad_accounts',
|
|
@@ -26,7 +26,13 @@ __all__ = [
|
|
|
26
26
|
'get_insights',
|
|
27
27
|
'get_login_link',
|
|
28
28
|
'login_cli',
|
|
29
|
-
'main'
|
|
29
|
+
'main',
|
|
30
|
+
'search_interests',
|
|
31
|
+
'get_interest_suggestions',
|
|
32
|
+
'validate_interests',
|
|
33
|
+
'search_behaviors',
|
|
34
|
+
'search_demographics',
|
|
35
|
+
'search_geo_locations'
|
|
30
36
|
]
|
|
31
37
|
|
|
32
38
|
# Import key functions to make them available at package level
|
|
@@ -47,7 +53,13 @@ from .core import (
|
|
|
47
53
|
get_insights,
|
|
48
54
|
get_login_link,
|
|
49
55
|
login_cli,
|
|
50
|
-
main
|
|
56
|
+
main,
|
|
57
|
+
search_interests,
|
|
58
|
+
get_interest_suggestions,
|
|
59
|
+
validate_interests,
|
|
60
|
+
search_behaviors,
|
|
61
|
+
search_demographics,
|
|
62
|
+
search_geo_locations
|
|
51
63
|
)
|
|
52
64
|
|
|
53
65
|
# Define a main function to be used as a package entry point
|
meta_ads_mcp/core/__init__.py
CHANGED
|
@@ -11,6 +11,7 @@ from .server import login_cli, main
|
|
|
11
11
|
from .auth import login
|
|
12
12
|
from .ads_library import search_ads_archive
|
|
13
13
|
from .budget_schedules import create_budget_schedule
|
|
14
|
+
from .targeting import search_interests, get_interest_suggestions, validate_interests, search_behaviors, search_demographics, search_geo_locations
|
|
14
15
|
from . import reports # Import module to register conditional tools
|
|
15
16
|
from . import duplication # Import module to register conditional duplication tools
|
|
16
17
|
from .openai_deep_research import search, fetch # OpenAI MCP Deep Research tools
|
|
@@ -37,6 +38,12 @@ __all__ = [
|
|
|
37
38
|
'main',
|
|
38
39
|
'search_ads_archive',
|
|
39
40
|
'create_budget_schedule',
|
|
41
|
+
'search_interests',
|
|
42
|
+
'get_interest_suggestions',
|
|
43
|
+
'validate_interests',
|
|
44
|
+
'search_behaviors',
|
|
45
|
+
'search_demographics',
|
|
46
|
+
'search_geo_locations',
|
|
40
47
|
'search', # OpenAI MCP Deep Research search tool
|
|
41
48
|
'fetch', # OpenAI MCP Deep Research fetch tool
|
|
42
49
|
]
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"""Targeting search functionality for Meta Ads API."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Optional, List, Dict, Any
|
|
5
|
+
from .api import meta_api_tool, make_api_request
|
|
6
|
+
from .server import mcp_server
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@mcp_server.tool()
|
|
10
|
+
@meta_api_tool
|
|
11
|
+
async def search_interests(access_token: str = None, query: str = None, limit: int = 25) -> str:
|
|
12
|
+
"""
|
|
13
|
+
Search for interest targeting options by keyword.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
17
|
+
query: Search term for interests (e.g., "baseball", "cooking", "travel")
|
|
18
|
+
limit: Maximum number of results to return (default: 25)
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
JSON string containing interest data with id, name, audience_size, and path fields
|
|
22
|
+
"""
|
|
23
|
+
if not query:
|
|
24
|
+
return json.dumps({"error": "No search query provided"}, indent=2)
|
|
25
|
+
|
|
26
|
+
endpoint = "search"
|
|
27
|
+
params = {
|
|
28
|
+
"type": "adinterest",
|
|
29
|
+
"q": query,
|
|
30
|
+
"limit": limit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
data = await make_api_request(endpoint, access_token, params)
|
|
34
|
+
|
|
35
|
+
return json.dumps(data, indent=2)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@mcp_server.tool()
|
|
39
|
+
@meta_api_tool
|
|
40
|
+
async def get_interest_suggestions(access_token: str = None, interest_list: List[str] = None, limit: int = 25) -> str:
|
|
41
|
+
"""
|
|
42
|
+
Get interest suggestions based on existing interests.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
46
|
+
interest_list: List of interest names to get suggestions for (e.g., ["Basketball", "Soccer"])
|
|
47
|
+
limit: Maximum number of suggestions to return (default: 25)
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
JSON string containing suggested interests with id, name, audience_size, and description fields
|
|
51
|
+
"""
|
|
52
|
+
if not interest_list:
|
|
53
|
+
return json.dumps({"error": "No interest list provided"}, indent=2)
|
|
54
|
+
|
|
55
|
+
endpoint = "search"
|
|
56
|
+
params = {
|
|
57
|
+
"type": "adinterestsuggestion",
|
|
58
|
+
"interest_list": json.dumps(interest_list),
|
|
59
|
+
"limit": limit
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
data = await make_api_request(endpoint, access_token, params)
|
|
63
|
+
|
|
64
|
+
return json.dumps(data, indent=2)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@mcp_server.tool()
|
|
68
|
+
@meta_api_tool
|
|
69
|
+
async def validate_interests(access_token: str = None, interest_list: List[str] = None,
|
|
70
|
+
interest_fbid_list: List[str] = None) -> str:
|
|
71
|
+
"""
|
|
72
|
+
Validate interest names or IDs for targeting.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
76
|
+
interest_list: List of interest names to validate (e.g., ["Japan", "Basketball"])
|
|
77
|
+
interest_fbid_list: List of interest IDs to validate (e.g., ["6003700426513"])
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
JSON string with validation results showing valid status and audience_size for each interest
|
|
81
|
+
"""
|
|
82
|
+
if not interest_list and not interest_fbid_list:
|
|
83
|
+
return json.dumps({"error": "No interest list or FBID list provided"}, indent=2)
|
|
84
|
+
|
|
85
|
+
endpoint = "search"
|
|
86
|
+
params = {
|
|
87
|
+
"type": "adinterestvalid"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if interest_list:
|
|
91
|
+
params["interest_list"] = json.dumps(interest_list)
|
|
92
|
+
|
|
93
|
+
if interest_fbid_list:
|
|
94
|
+
params["interest_fbid_list"] = json.dumps(interest_fbid_list)
|
|
95
|
+
|
|
96
|
+
data = await make_api_request(endpoint, access_token, params)
|
|
97
|
+
|
|
98
|
+
return json.dumps(data, indent=2)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@mcp_server.tool()
|
|
102
|
+
@meta_api_tool
|
|
103
|
+
async def search_behaviors(access_token: str = None, limit: int = 50) -> str:
|
|
104
|
+
"""
|
|
105
|
+
Get all available behavior targeting options.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
109
|
+
limit: Maximum number of results to return (default: 50)
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
JSON string containing behavior targeting options with id, name, audience_size bounds, path, and description
|
|
113
|
+
"""
|
|
114
|
+
endpoint = "search"
|
|
115
|
+
params = {
|
|
116
|
+
"type": "adTargetingCategory",
|
|
117
|
+
"class": "behaviors",
|
|
118
|
+
"limit": limit
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
data = await make_api_request(endpoint, access_token, params)
|
|
122
|
+
|
|
123
|
+
return json.dumps(data, indent=2)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@mcp_server.tool()
|
|
127
|
+
@meta_api_tool
|
|
128
|
+
async def search_demographics(access_token: str = None, demographic_class: str = "demographics", limit: int = 50) -> str:
|
|
129
|
+
"""
|
|
130
|
+
Get demographic targeting options.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
134
|
+
demographic_class: Type of demographics to retrieve. Options: 'demographics', 'life_events',
|
|
135
|
+
'industries', 'income', 'family_statuses', 'user_device', 'user_os' (default: 'demographics')
|
|
136
|
+
limit: Maximum number of results to return (default: 50)
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
JSON string containing demographic targeting options with id, name, audience_size bounds, path, and description
|
|
140
|
+
"""
|
|
141
|
+
endpoint = "search"
|
|
142
|
+
params = {
|
|
143
|
+
"type": "adTargetingCategory",
|
|
144
|
+
"class": demographic_class,
|
|
145
|
+
"limit": limit
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
data = await make_api_request(endpoint, access_token, params)
|
|
149
|
+
|
|
150
|
+
return json.dumps(data, indent=2)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@mcp_server.tool()
|
|
154
|
+
@meta_api_tool
|
|
155
|
+
async def search_geo_locations(access_token: str = None, query: str = None,
|
|
156
|
+
location_types: List[str] = None, limit: int = 25) -> str:
|
|
157
|
+
"""
|
|
158
|
+
Search for geographic targeting locations.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
access_token: Meta API access token (optional - will use cached token if not provided)
|
|
162
|
+
query: Search term for locations (e.g., "New York", "California", "Japan")
|
|
163
|
+
location_types: Types of locations to search. Options: ['country', 'region', 'city', 'zip',
|
|
164
|
+
'geo_market', 'electoral_district']. If not specified, searches all types.
|
|
165
|
+
limit: Maximum number of results to return (default: 25)
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
JSON string containing location data with key, name, type, and geographic hierarchy information
|
|
169
|
+
"""
|
|
170
|
+
if not query:
|
|
171
|
+
return json.dumps({"error": "No search query provided"}, indent=2)
|
|
172
|
+
|
|
173
|
+
endpoint = "search"
|
|
174
|
+
params = {
|
|
175
|
+
"type": "adgeolocation",
|
|
176
|
+
"q": query,
|
|
177
|
+
"limit": limit
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if location_types:
|
|
181
|
+
params["location_types"] = json.dumps(location_types)
|
|
182
|
+
|
|
183
|
+
data = await make_api_request(endpoint, access_token, params)
|
|
184
|
+
|
|
185
|
+
return json.dumps(data, indent=2)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
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
|
|
@@ -331,6 +331,54 @@ For local installation configuration, authentication options, and advanced techn
|
|
|
331
331
|
- `access_token` (optional): Meta API access token.
|
|
332
332
|
- Returns: JSON string with the ID of the created budget schedule or an error message.
|
|
333
333
|
|
|
334
|
+
22. `mcp_meta_ads_search_interests`
|
|
335
|
+
- Search for interest targeting options by keyword
|
|
336
|
+
- Inputs:
|
|
337
|
+
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
338
|
+
- `query`: Search term for interests (e.g., "baseball", "cooking", "travel")
|
|
339
|
+
- `limit`: Maximum number of results to return (default: 25)
|
|
340
|
+
- Returns: Interest data with id, name, audience_size, and path fields
|
|
341
|
+
|
|
342
|
+
23. `mcp_meta_ads_get_interest_suggestions`
|
|
343
|
+
- Get interest suggestions based on existing interests
|
|
344
|
+
- Inputs:
|
|
345
|
+
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
346
|
+
- `interest_list`: List of interest names to get suggestions for (e.g., ["Basketball", "Soccer"])
|
|
347
|
+
- `limit`: Maximum number of suggestions to return (default: 25)
|
|
348
|
+
- Returns: Suggested interests with id, name, audience_size, and description fields
|
|
349
|
+
|
|
350
|
+
24. `mcp_meta_ads_validate_interests`
|
|
351
|
+
- Validate interest names or IDs for targeting
|
|
352
|
+
- Inputs:
|
|
353
|
+
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
354
|
+
- `interest_list`: List of interest names to validate (e.g., ["Japan", "Basketball"])
|
|
355
|
+
- `interest_fbid_list`: List of interest IDs to validate (e.g., ["6003700426513"])
|
|
356
|
+
- Returns: Validation results showing valid status and audience_size for each interest
|
|
357
|
+
|
|
358
|
+
25. `mcp_meta_ads_search_behaviors`
|
|
359
|
+
- Get all available behavior targeting options
|
|
360
|
+
- Inputs:
|
|
361
|
+
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
362
|
+
- `limit`: Maximum number of results to return (default: 50)
|
|
363
|
+
- Returns: Behavior targeting options with id, name, audience_size bounds, path, and description
|
|
364
|
+
|
|
365
|
+
26. `mcp_meta_ads_search_demographics`
|
|
366
|
+
- Get demographic targeting options
|
|
367
|
+
- Inputs:
|
|
368
|
+
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
369
|
+
- `demographic_class`: Type of demographics ('demographics', 'life_events', 'industries', 'income', 'family_statuses', 'user_device', 'user_os')
|
|
370
|
+
- `limit`: Maximum number of results to return (default: 50)
|
|
371
|
+
- Returns: Demographic targeting options with id, name, audience_size bounds, path, and description
|
|
372
|
+
|
|
373
|
+
27. `mcp_meta_ads_search_geo_locations`
|
|
374
|
+
- Search for geographic targeting locations
|
|
375
|
+
- Inputs:
|
|
376
|
+
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
377
|
+
- `query`: Search term for locations (e.g., "New York", "California", "Japan")
|
|
378
|
+
- `location_types`: Types of locations to search (['country', 'region', 'city', 'zip', 'geo_market', 'electoral_district'])
|
|
379
|
+
- `limit`: Maximum number of results to return (default: 25)
|
|
380
|
+
- Returns: Location data with key, name, type, and geographic hierarchy information
|
|
381
|
+
|
|
334
382
|
## Privacy and Security
|
|
335
383
|
|
|
336
384
|
Meta Ads MCP follows security best practices with secure token management and automatic authentication handling.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
meta_ads_mcp/__init__.py,sha256=
|
|
1
|
+
meta_ads_mcp/__init__.py,sha256=UDuLAO7mGVeZrzSJhTr3UAJKug3oHb6IK6OjooX6fk8,1492
|
|
2
2
|
meta_ads_mcp/__main__.py,sha256=XaQt3iXftG_7f0Zu7Wop9SeFgrD2WBn0EQOaPMc27d8,207
|
|
3
|
-
meta_ads_mcp/core/__init__.py,sha256=
|
|
3
|
+
meta_ads_mcp/core/__init__.py,sha256=IHBUfLTQW44VLbH_gZDT83nqzGrVWZ0l7FG4P3bp_bU,1706
|
|
4
4
|
meta_ads_mcp/core/accounts.py,sha256=Nmp7lPxO9wmq25jWV7_H0LIqnEbBhpCVBlLGW2HUaq0,2277
|
|
5
5
|
meta_ads_mcp/core/ads.py,sha256=aaK70mgfhBJRXr4cdkKag5mjYzvHuHpRttJvTMzPk4Y,36156
|
|
6
6
|
meta_ads_mcp/core/ads_library.py,sha256=onStn9UkRqYDC60gOPS-iKDtP1plz6DygUb7hUZ0Jw8,2807
|
|
@@ -19,9 +19,10 @@ meta_ads_mcp/core/pipeboard_auth.py,sha256=VvbxEB8ZOhnMccLU7HI1HgaPWHCl5NGrzZCm-
|
|
|
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
21
|
meta_ads_mcp/core/server.py,sha256=WhbAag7xdhbGcp7rnU4sKhqXJ8Slapa_ba3T23Yp_2U,17889
|
|
22
|
+
meta_ads_mcp/core/targeting.py,sha256=3HW1qirEdwaQurlBZGenbIwawcb5J06ghJKRfgu9ZEs,6318
|
|
22
23
|
meta_ads_mcp/core/utils.py,sha256=ofKUhyo-5SZoJVuBeTVFPPQCffk0UKpwmDMrd8qQxNc,8715
|
|
23
|
-
meta_ads_mcp-0.
|
|
24
|
-
meta_ads_mcp-0.
|
|
25
|
-
meta_ads_mcp-0.
|
|
26
|
-
meta_ads_mcp-0.
|
|
27
|
-
meta_ads_mcp-0.
|
|
24
|
+
meta_ads_mcp-0.7.0.dist-info/METADATA,sha256=ADo7W0ulgt6gIZzJjOkyxM-PDqE0inab-THLjsStoGo,20409
|
|
25
|
+
meta_ads_mcp-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
26
|
+
meta_ads_mcp-0.7.0.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
|
|
27
|
+
meta_ads_mcp-0.7.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
28
|
+
meta_ads_mcp-0.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|