meta-ads-mcp 0.9.2__py3-none-any.whl → 0.9.3__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 +27 -26
- meta_ads_mcp/core/openai_deep_research.py +2 -2
- {meta_ads_mcp-0.9.2.dist-info → meta_ads_mcp-0.9.3.dist-info}/METADATA +1 -1
- {meta_ads_mcp-0.9.2.dist-info → meta_ads_mcp-0.9.3.dist-info}/RECORD +8 -8
- {meta_ads_mcp-0.9.2.dist-info → meta_ads_mcp-0.9.3.dist-info}/WHEEL +0 -0
- {meta_ads_mcp-0.9.2.dist-info → meta_ads_mcp-0.9.3.dist-info}/entry_points.txt +0 -0
- {meta_ads_mcp-0.9.2.dist-info → meta_ads_mcp-0.9.3.dist-info}/licenses/LICENSE +0 -0
meta_ads_mcp/__init__.py
CHANGED
meta_ads_mcp/core/accounts.py
CHANGED
|
@@ -51,32 +51,7 @@ async def get_account_info(access_token: str = None, account_id: str = None) ->
|
|
|
51
51
|
if not account_id.startswith("act_"):
|
|
52
52
|
account_id = f"act_{account_id}"
|
|
53
53
|
|
|
54
|
-
#
|
|
55
|
-
endpoint = "me/adaccounts"
|
|
56
|
-
params = {
|
|
57
|
-
"fields": "id,name,account_id,account_status,amount_spent,balance,currency,age,business_city,business_country_code",
|
|
58
|
-
"limit": 50
|
|
59
|
-
}
|
|
60
|
-
accessible_accounts_data = await make_api_request(endpoint, access_token, params)
|
|
61
|
-
|
|
62
|
-
if "data" in accessible_accounts_data:
|
|
63
|
-
accessible_account_ids = [acc["id"] for acc in accessible_accounts_data["data"]]
|
|
64
|
-
if account_id not in accessible_account_ids:
|
|
65
|
-
# Provide a helpful error message with accessible accounts
|
|
66
|
-
accessible_accounts = [
|
|
67
|
-
{"id": acc["id"], "name": acc["name"]}
|
|
68
|
-
for acc in accessible_accounts_data["data"][:10] # Show first 10
|
|
69
|
-
]
|
|
70
|
-
return {
|
|
71
|
-
"error": {
|
|
72
|
-
"message": f"Account {account_id} is not accessible to your user account",
|
|
73
|
-
"details": "This account either doesn't exist or you don't have permission to access it",
|
|
74
|
-
"accessible_accounts": accessible_accounts,
|
|
75
|
-
"total_accessible_accounts": len(accessible_accounts_data["data"]),
|
|
76
|
-
"suggestion": "Try using one of the accessible account IDs listed above"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
54
|
+
# Try to get the account info directly first
|
|
80
55
|
endpoint = f"{account_id}"
|
|
81
56
|
params = {
|
|
82
57
|
"fields": "id,name,account_id,account_status,amount_spent,balance,currency,age,business_city,business_country_code,timezone_name"
|
|
@@ -86,6 +61,32 @@ async def get_account_info(access_token: str = None, account_id: str = None) ->
|
|
|
86
61
|
|
|
87
62
|
# Check if the API request returned an error
|
|
88
63
|
if "error" in data:
|
|
64
|
+
# If access was denied, provide helpful error message with accessible accounts
|
|
65
|
+
if "access" in str(data.get("error", {})).lower() or "permission" in str(data.get("error", {})).lower():
|
|
66
|
+
# Get list of accessible accounts for helpful error message
|
|
67
|
+
accessible_endpoint = "me/adaccounts"
|
|
68
|
+
accessible_params = {
|
|
69
|
+
"fields": "id,name,account_id,account_status,amount_spent,balance,currency,age,business_city,business_country_code",
|
|
70
|
+
"limit": 50
|
|
71
|
+
}
|
|
72
|
+
accessible_accounts_data = await make_api_request(accessible_endpoint, access_token, accessible_params)
|
|
73
|
+
|
|
74
|
+
if "data" in accessible_accounts_data:
|
|
75
|
+
accessible_accounts = [
|
|
76
|
+
{"id": acc["id"], "name": acc["name"]}
|
|
77
|
+
for acc in accessible_accounts_data["data"][:10] # Show first 10
|
|
78
|
+
]
|
|
79
|
+
return {
|
|
80
|
+
"error": {
|
|
81
|
+
"message": f"Account {account_id} is not accessible to your user account",
|
|
82
|
+
"details": "This account either doesn't exist or you don't have permission to access it",
|
|
83
|
+
"accessible_accounts": accessible_accounts,
|
|
84
|
+
"total_accessible_accounts": len(accessible_accounts_data["data"]),
|
|
85
|
+
"suggestion": "Try using one of the accessible account IDs listed above"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Return the original error for non-permission related issues
|
|
89
90
|
return data
|
|
90
91
|
|
|
91
92
|
# Add DSA requirement detection
|
|
@@ -23,7 +23,7 @@ class MetaAdsDataManager:
|
|
|
23
23
|
self._cache = {}
|
|
24
24
|
logger.debug("MetaAdsDataManager initialized")
|
|
25
25
|
|
|
26
|
-
async def _get_ad_accounts(self, access_token: str, limit: int =
|
|
26
|
+
async def _get_ad_accounts(self, access_token: str, limit: int = 200) -> List[Dict[str, Any]]:
|
|
27
27
|
"""Get ad accounts data"""
|
|
28
28
|
try:
|
|
29
29
|
endpoint = "me/adaccounts"
|
|
@@ -141,7 +141,7 @@ class MetaAdsDataManager:
|
|
|
141
141
|
|
|
142
142
|
try:
|
|
143
143
|
# Search ad accounts
|
|
144
|
-
accounts = await self._get_ad_accounts(access_token, limit=
|
|
144
|
+
accounts = await self._get_ad_accounts(access_token, limit=200)
|
|
145
145
|
for account in accounts:
|
|
146
146
|
account_text = f"{account.get('name', '')} {account.get('id', '')} {account.get('account_status', '')} {account.get('business_city', '')} {account.get('business_country_code', '')}".lower()
|
|
147
147
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
meta_ads_mcp/__init__.py,sha256=
|
|
1
|
+
meta_ads_mcp/__init__.py,sha256=XPRyVV6Kg7dg4tJuy0N5Kwwf25oVRhKRRz9rw5fi3x4,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=0lfyvRbhBigFKgNq5Mk3fk4Qh6MtIkKScdOnoc_rQkg,4314
|
|
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
7
|
meta_ads_mcp/core/adsets.py,sha256=mqB7u-6HY3QHSQo-zStan7IBjksdcvzcyOC_wVXFvJY,15863
|
|
@@ -14,15 +14,15 @@ meta_ads_mcp/core/campaigns.py,sha256=0yDVgi7rN4eMQk1_w0A2vnoXd8y0t8R77Ji4gna1Gj
|
|
|
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
|
|
17
|
-
meta_ads_mcp/core/openai_deep_research.py,sha256=
|
|
17
|
+
meta_ads_mcp/core/openai_deep_research.py,sha256=9w3F2Mqj-hYOcvFlnG0tnALlW12VwavDMMpO7LqApd0,18807
|
|
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
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.3.dist-info/METADATA,sha256=BloabUTrmKx3ihtvvt9eugMXW8SC75fy2DA5c7cQAoc,22444
|
|
25
|
+
meta_ads_mcp-0.9.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
26
|
+
meta_ads_mcp-0.9.3.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
|
|
27
|
+
meta_ads_mcp-0.9.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
28
|
+
meta_ads_mcp-0.9.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|