meta-ads-mcp 0.2.4__py3-none-any.whl → 0.2.5__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/adsets.py +32 -2
- meta_ads_mcp/core/api.py +68 -24
- meta_ads_mcp/core/auth.py +1212 -382
- meta_ads_mcp/core/authentication.py +10 -1
- meta_ads_mcp/core/utils.py +10 -0
- {meta_ads_mcp-0.2.4.dist-info → meta_ads_mcp-0.2.5.dist-info}/METADATA +21 -11
- {meta_ads_mcp-0.2.4.dist-info → meta_ads_mcp-0.2.5.dist-info}/RECORD +10 -10
- {meta_ads_mcp-0.2.4.dist-info → meta_ads_mcp-0.2.5.dist-info}/WHEEL +0 -0
- {meta_ads_mcp-0.2.4.dist-info → meta_ads_mcp-0.2.5.dist-info}/entry_points.txt +0 -0
|
@@ -5,7 +5,7 @@ import asyncio
|
|
|
5
5
|
from .api import meta_api_tool
|
|
6
6
|
from .auth import start_callback_server, auth_manager, get_current_access_token
|
|
7
7
|
from .server import mcp_server
|
|
8
|
-
from .utils import logger
|
|
8
|
+
from .utils import logger, META_APP_SECRET
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@mcp_server.tool()
|
|
@@ -46,6 +46,10 @@ async def get_login_link(access_token: str = None) -> str:
|
|
|
46
46
|
login_url = auth_manager.get_auth_url()
|
|
47
47
|
logger.info(f"Generated login URL: {login_url}")
|
|
48
48
|
|
|
49
|
+
# Check if we can exchange for long-lived tokens
|
|
50
|
+
token_exchange_supported = bool(META_APP_SECRET)
|
|
51
|
+
token_duration = "60 days" if token_exchange_supported else "1-2 hours"
|
|
52
|
+
|
|
49
53
|
# Return a special format that helps the LLM format the response properly
|
|
50
54
|
response = {
|
|
51
55
|
"login_url": login_url,
|
|
@@ -54,6 +58,11 @@ async def get_login_link(access_token: str = None) -> str:
|
|
|
54
58
|
"markdown_link": f"[Click here to authenticate with Meta Ads]({login_url})",
|
|
55
59
|
"message": "IMPORTANT: Please use the Markdown link format in your response to allow the user to click it.",
|
|
56
60
|
"instructions_for_llm": "You must present this link as clickable Markdown to the user using the markdown_link format provided.",
|
|
61
|
+
"token_exchange": "enabled" if token_exchange_supported else "disabled",
|
|
62
|
+
"token_duration": token_duration,
|
|
63
|
+
"token_exchange_message": f"Your authentication token will be valid for approximately {token_duration}." +
|
|
64
|
+
(" Long-lived token exchange is enabled." if token_exchange_supported else
|
|
65
|
+
" To enable long-lived tokens (60 days), set the META_APP_SECRET environment variable."),
|
|
57
66
|
"note": "After authenticating, the token will be automatically saved."
|
|
58
67
|
}
|
|
59
68
|
|
meta_ads_mcp/core/utils.py
CHANGED
|
@@ -13,6 +13,16 @@ import logging
|
|
|
13
13
|
import pathlib
|
|
14
14
|
import platform
|
|
15
15
|
|
|
16
|
+
# Check for Meta app credentials in environment
|
|
17
|
+
META_APP_ID = os.environ.get("META_APP_ID", "")
|
|
18
|
+
META_APP_SECRET = os.environ.get("META_APP_SECRET", "")
|
|
19
|
+
|
|
20
|
+
# Print warning if Meta app credentials are not configured
|
|
21
|
+
if not META_APP_ID:
|
|
22
|
+
print("WARNING: META_APP_ID environment variable is not set. Authentication will not work properly.")
|
|
23
|
+
if not META_APP_SECRET:
|
|
24
|
+
print("WARNING: META_APP_SECRET environment variable is not set. Long-lived token exchange will not work.")
|
|
25
|
+
|
|
16
26
|
# Configure logging to file
|
|
17
27
|
def setup_logging():
|
|
18
28
|
"""Set up logging to file for troubleshooting."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Model Calling Protocol (MCP) plugin for interacting with Meta Ads API
|
|
5
5
|
Project-URL: Homepage, https://github.com/nictuku/meta-ads-mcp
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/nictuku/meta-ads-mcp/issues
|
|
@@ -21,16 +21,26 @@ Description-Content-Type: text/markdown
|
|
|
21
21
|
|
|
22
22
|
# Meta Ads MCP
|
|
23
23
|
|
|
24
|
-
A [Model
|
|
24
|
+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for interacting with Meta Ads API. This tool enables AI models to access, analyze, and manage Meta advertising campaigns through a standardized interface, allowing LLMs to retrieve performance data, visualize ad creatives, and provide strategic insights for Facebook, Instagram, and other Meta platforms.
|
|
25
|
+
|
|
26
|
+
> **DISCLAIMER:** This is an unofficial third-party tool and is not associated with, endorsed by, or affiliated with Meta in any way. This project is maintained independently and uses Meta's public APIs according to their terms of service. Meta, Facebook, Instagram, and other Meta brand names are trademarks of their respective owners.
|
|
27
|
+
|
|
28
|
+
Screenhot: using an LLM to understand your ad performance.
|
|
29
|
+
|
|
30
|
+

|
|
25
31
|
|
|
26
32
|
## Features
|
|
27
33
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
+
- **AI-Powered Campaign Analysis**: Let your favorite LLM analyze your campaigns and provide actionable insights on performance
|
|
35
|
+
- **Strategic Recommendations**: Receive data-backed suggestions for optimizing ad spend, targeting, and creative content
|
|
36
|
+
- **Automated Monitoring**: Ask any MCP-compatible LLM to track performance metrics and alert you about significant changes
|
|
37
|
+
- **Budget Optimization**: Get recommendations for reallocating budget to better-performing ad sets
|
|
38
|
+
- **Creative Improvement**: Receive feedback on ad copy, imagery, and calls-to-action
|
|
39
|
+
- **Campaign Management**: Request changes to campaigns, ad sets, and ads (all changes require explicit confirmation)
|
|
40
|
+
- **Cross-Platform Integration**: Works with Facebook, Instagram, and all Meta ad platforms
|
|
41
|
+
- **Universal LLM Support**: Compatible with any MCP client including Claude Desktop, Cursor, Cherry Studio, and more
|
|
42
|
+
- **Simple Authentication**: Easy setup with secure OAuth authentication
|
|
43
|
+
- **Cross-Platform Support**: Works on Windows, macOS, and Linux
|
|
34
44
|
|
|
35
45
|
## Installation
|
|
36
46
|
|
|
@@ -39,7 +49,7 @@ A [Model Calling Protocol (MCP)](https://github.com/anthropics/anthropic-tools)
|
|
|
39
49
|
When using uv no specific installation is needed. We can use uvx to directly run meta-ads-mcp:
|
|
40
50
|
|
|
41
51
|
```bash
|
|
42
|
-
uvx meta-ads-mcp
|
|
52
|
+
uvx meta-ads-mcp --app-id YOUR_META_ADS_APP_ID
|
|
43
53
|
```
|
|
44
54
|
|
|
45
55
|
If you want to install the package:
|
|
@@ -79,7 +89,7 @@ Add this to your `claude_desktop_config.json` to integrate with Claude in Cursor
|
|
|
79
89
|
"mcpServers": {
|
|
80
90
|
"meta-ads": {
|
|
81
91
|
"command": "uvx",
|
|
82
|
-
"args": ["meta-ads-mcp"]
|
|
92
|
+
"args": ["meta-ads-mcp", "--app-id", "YOUR_META_ADS_APP_ID"]
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
```
|
|
@@ -350,4 +360,4 @@ You can check the current version of the package:
|
|
|
350
360
|
```python
|
|
351
361
|
import meta_ads_mcp
|
|
352
362
|
print(meta_ads_mcp.__version__)
|
|
353
|
-
```
|
|
363
|
+
```
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
meta_ads_mcp/__init__.py,sha256=
|
|
1
|
+
meta_ads_mcp/__init__.py,sha256=Mf42uSXVCCipMTMhyIzXP2PLHIlpmqmhj04vB4XDans,1204
|
|
2
2
|
meta_ads_mcp/__main__.py,sha256=XaQt3iXftG_7f0Zu7Wop9SeFgrD2WBn0EQOaPMc27d8,207
|
|
3
3
|
meta_ads_mcp/api.py,sha256=9mmoJIdkC3PexZn3hw8XiKznecsbOSnhHtdEsJiPIyw,77475
|
|
4
4
|
meta_ads_mcp/core/__init__.py,sha256=BA93zC6D8CzKbLo4JqqNqahq2LVgWBsoIXmJCK4AdIc,924
|
|
5
5
|
meta_ads_mcp/core/accounts.py,sha256=Nmp7lPxO9wmq25jWV7_H0LIqnEbBhpCVBlLGW2HUaq0,2277
|
|
6
6
|
meta_ads_mcp/core/ads.py,sha256=TS37bUX8kJeeX4M2jv3StZev7Riq-n8Fm0TOhEL0eIY,14625
|
|
7
|
-
meta_ads_mcp/core/adsets.py,sha256=
|
|
8
|
-
meta_ads_mcp/core/api.py,sha256=
|
|
9
|
-
meta_ads_mcp/core/auth.py,sha256=
|
|
10
|
-
meta_ads_mcp/core/authentication.py,sha256=
|
|
7
|
+
meta_ads_mcp/core/adsets.py,sha256=oUmvH-odZLrTNkwVlGp1orBFtb8ZsCJ0ZSEC65V3NUg,7348
|
|
8
|
+
meta_ads_mcp/core/api.py,sha256=AurfnoUZoIq9WS4cnsmVqpxc3pdsws8jvNhzQzdzLGg,12209
|
|
9
|
+
meta_ads_mcp/core/auth.py,sha256=tbwAia-pj9OyAmkri3Sv2wFq70qVFD9kN8XpkzI9gTE,89265
|
|
10
|
+
meta_ads_mcp/core/authentication.py,sha256=6zoGorswj5kRbrt_18A8KrZdCORNLGHybvb7XRQ1yJg,3474
|
|
11
11
|
meta_ads_mcp/core/campaigns.py,sha256=u5jNHSxcWlZgzVLNmaeoovA9OcPjSUjTegUMcDLAurs,4381
|
|
12
12
|
meta_ads_mcp/core/insights.py,sha256=f4Rs3kG0oqpKl8zBc_nt_zE0z4zvb9i0g12galrDiw8,17376
|
|
13
13
|
meta_ads_mcp/core/resources.py,sha256=-zIIfZulpo76vcKv6jhAlQq91cR2SZ3cjYZt3ek3x0w,1236
|
|
14
14
|
meta_ads_mcp/core/server.py,sha256=-tClGe4rc-8U2ihgpipLstiTPRg3-CnjsTRgncsNa_A,3055
|
|
15
|
-
meta_ads_mcp/core/utils.py,sha256=
|
|
16
|
-
meta_ads_mcp-0.2.
|
|
17
|
-
meta_ads_mcp-0.2.
|
|
18
|
-
meta_ads_mcp-0.2.
|
|
19
|
-
meta_ads_mcp-0.2.
|
|
15
|
+
meta_ads_mcp/core/utils.py,sha256=wxh722z-x0TSJwDEEeDylkv4VJqLmqnkZy-YGRzs4vQ,6049
|
|
16
|
+
meta_ads_mcp-0.2.5.dist-info/METADATA,sha256=YWT1H50cEd2P0QJRjLKxcR6IQim98kpjwGB6gFcgC1Y,14196
|
|
17
|
+
meta_ads_mcp-0.2.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
18
|
+
meta_ads_mcp-0.2.5.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
|
|
19
|
+
meta_ads_mcp-0.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|