meta-ads-mcp 0.2.6__tar.gz → 0.2.8__tar.gz
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-0.2.6 → meta_ads_mcp-0.2.8}/PKG-INFO +115 -29
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/README.md +113 -28
- meta_ads_mcp-0.2.8/debug_meta_api_tool.py +248 -0
- meta_ads_mcp-0.2.8/debug_token_flow.py +156 -0
- meta_ads_mcp-0.2.8/meta-ads-mcp +50 -0
- meta_ads_mcp-0.2.8/meta_ads_auth.sh +54 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/__init__.py +1 -1
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/api.py +122 -53
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/__init__.py +2 -1
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/adsets.py +7 -2
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/api.py +29 -1
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/auth.py +81 -13
- meta_ads_mcp-0.2.8/meta_ads_mcp/core/authentication.py +126 -0
- meta_ads_mcp-0.2.8/meta_ads_mcp/core/pipeboard_auth.py +484 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/server.py +49 -4
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/utils.py +11 -5
- meta_ads_mcp-0.2.8/meta_auth_test.sh +4 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/pyproject.toml +2 -1
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/test_meta_ads_auth.py +26 -21
- meta_ads_mcp-0.2.8/test_pipeboard_auth.py +323 -0
- meta_ads_mcp-0.2.6/meta-ads-mcp +0 -13
- meta_ads_mcp-0.2.6/meta_ads_mcp/core/authentication.py +0 -72
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/.gitignore +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/META_API_NOTES.md +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/future_improvements.md +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/images/meta-ads-example.png +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/__main__.py +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/accounts.py +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/ads.py +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/callback_server.py +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/campaigns.py +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/insights.py +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/meta_ads_mcp/core/resources.py +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/requirements.txt +0 -0
- {meta_ads_mcp-0.2.6 → meta_ads_mcp-0.2.8}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meta-ads-mcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
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
|
|
@@ -15,6 +15,7 @@ Requires-Dist: httpx>=0.26.0
|
|
|
15
15
|
Requires-Dist: mcp[cli]>=1.6.0
|
|
16
16
|
Requires-Dist: pathlib>=1.0.1
|
|
17
17
|
Requires-Dist: pillow>=10.0.0
|
|
18
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
18
19
|
Requires-Dist: python-dotenv>=1.1.0
|
|
19
20
|
Requires-Dist: requests>=2.32.3
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
@@ -49,6 +50,11 @@ Screenhot: using an LLM to understand your ad performance.
|
|
|
49
50
|
When using uv no specific installation is needed. We can use uvx to directly run meta-ads-mcp:
|
|
50
51
|
|
|
51
52
|
```bash
|
|
53
|
+
# RECOMMENDED: Use with Pipeboard authentication
|
|
54
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token # Get your token at https://pipeboard.co
|
|
55
|
+
uvx meta-ads-mcp
|
|
56
|
+
|
|
57
|
+
# Alternative: Use with direct Meta authentication
|
|
52
58
|
uvx meta-ads-mcp --app-id YOUR_META_ADS_APP_ID
|
|
53
59
|
```
|
|
54
60
|
|
|
@@ -76,15 +82,50 @@ pip install meta-ads-mcp
|
|
|
76
82
|
After installation, you can run it as:
|
|
77
83
|
|
|
78
84
|
```bash
|
|
85
|
+
# RECOMMENDED: Use with Pipeboard authentication
|
|
86
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token # Get your token at https://pipeboard.co
|
|
79
87
|
python -m meta_ads_mcp
|
|
88
|
+
|
|
89
|
+
# Alternative: Use with direct Meta authentication
|
|
90
|
+
python -m meta_ads_mcp --app-id YOUR_META_ADS_APP_ID
|
|
80
91
|
```
|
|
81
92
|
|
|
82
93
|
## Configuration
|
|
83
94
|
|
|
95
|
+
### Quick Start with Pipeboard Authentication (Recommended)
|
|
96
|
+
|
|
97
|
+
The easiest way to configure Meta Ads MCP is using Pipeboard authentication:
|
|
98
|
+
|
|
99
|
+
1. Sign up at [Pipeboard.co](https://pipeboard.co) and generate an API token - **Get your free token at [https://pipeboard.co](https://pipeboard.co)**
|
|
100
|
+
2. Set the environment variable:
|
|
101
|
+
```bash
|
|
102
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token # Token obtainable via https://pipeboard.co
|
|
103
|
+
```
|
|
104
|
+
3. Run meta-ads-mcp without needing to set up a Meta Developer App:
|
|
105
|
+
```bash
|
|
106
|
+
uvx meta-ads-mcp
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This method provides longer-lived tokens (60 days), simplified setup, and automatic token renewal.
|
|
110
|
+
|
|
84
111
|
### Usage with Claude in Cursor
|
|
85
112
|
|
|
86
113
|
Add this to your `claude_desktop_config.json` to integrate with Claude in Cursor:
|
|
87
114
|
|
|
115
|
+
```json
|
|
116
|
+
"mcpServers": {
|
|
117
|
+
"meta-ads": {
|
|
118
|
+
"command": "uvx",
|
|
119
|
+
"args": ["meta-ads-mcp"],
|
|
120
|
+
"env": {
|
|
121
|
+
"PIPEBOARD_API_TOKEN": "your_pipeboard_token" // Token obtainable via https://pipeboard.co
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or if you prefer direct Meta authentication (using your own Facebook app):
|
|
128
|
+
|
|
88
129
|
```json
|
|
89
130
|
"mcpServers": {
|
|
90
131
|
"meta-ads": {
|
|
@@ -228,6 +269,7 @@ Add this to your `claude_desktop_config.json` to integrate with Claude in Cursor
|
|
|
228
269
|
|
|
229
270
|
16. `mcp_meta_ads_get_login_link`
|
|
230
271
|
- Get a clickable login link for Meta Ads authentication
|
|
272
|
+
- NOTE: This method should only be used if you're using your own Facebook app. If using Pipeboard authentication (recommended), set the PIPEBOARD_API_TOKEN environment variable instead (token obtainable via https://pipeboard.co).
|
|
231
273
|
- Inputs:
|
|
232
274
|
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
233
275
|
- Returns: A clickable resource link for Meta authentication
|
|
@@ -244,13 +286,47 @@ Before using the MCP server, you'll need to set up a Meta Developer App:
|
|
|
244
286
|
|
|
245
287
|
## Authentication
|
|
246
288
|
|
|
247
|
-
The Meta Ads MCP
|
|
289
|
+
The Meta Ads MCP supports two authentication methods:
|
|
290
|
+
|
|
291
|
+
### 1. Pipeboard Authentication (Recommended ⭐)
|
|
292
|
+
|
|
293
|
+
This method uses [Pipeboard.co](https://pipeboard.co) to manage Meta API authentication, providing longer-lived tokens and a simplified flow:
|
|
294
|
+
|
|
295
|
+
1. **Get your Pipeboard token**: Sign up at [https://pipeboard.co](https://pipeboard.co) to generate your free API token
|
|
296
|
+
2. Set the `PIPEBOARD_API_TOKEN` environment variable with your token:
|
|
297
|
+
```bash
|
|
298
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token
|
|
299
|
+
```
|
|
300
|
+
3. Run the Meta Ads MCP normally - it will automatically detect and use Pipeboard authentication:
|
|
301
|
+
```bash
|
|
302
|
+
uvx meta-ads-mcp
|
|
303
|
+
```
|
|
304
|
+
4. The first time you run a command, you'll be provided with a login URL to authorize with Meta
|
|
305
|
+
|
|
306
|
+
**Benefits of Pipeboard authentication:**
|
|
307
|
+
- ✅ Longer-lived tokens (60 days)
|
|
308
|
+
- ✅ No need to configure a Meta Developer App
|
|
309
|
+
- ✅ Simpler setup with just an API token
|
|
310
|
+
- ✅ Automatic token renewal
|
|
311
|
+
|
|
312
|
+
To test the Pipeboard authentication flow:
|
|
313
|
+
```bash
|
|
314
|
+
python test_pipeboard_auth.py --api-token YOUR_PIPEBOARD_TOKEN
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### 2. Direct Meta OAuth (Legacy)
|
|
318
|
+
|
|
319
|
+
The traditional OAuth 2.0 flow designed for desktop apps. This method should only be used if you are using your own Facebook app instead of Pipeboard.
|
|
320
|
+
|
|
321
|
+
When authenticating, it will:
|
|
248
322
|
|
|
249
323
|
1. Start a local callback server on your machine
|
|
250
324
|
2. Open a browser window to authenticate with Meta
|
|
251
325
|
3. Ask you to authorize the app
|
|
252
326
|
4. Redirect back to the local server to extract and store the token securely
|
|
253
327
|
|
|
328
|
+
This method requires you to [create a Meta Developer App](#create-a-meta-developer-app) first.
|
|
329
|
+
|
|
254
330
|
## Troubleshooting and Logging
|
|
255
331
|
|
|
256
332
|
The Meta Ads MCP includes a comprehensive logging system to help troubleshoot issues:
|
|
@@ -265,21 +341,29 @@ Log files are stored in a platform-specific location:
|
|
|
265
341
|
|
|
266
342
|
### Common Issues
|
|
267
343
|
|
|
268
|
-
####
|
|
344
|
+
#### Authentication Issues
|
|
269
345
|
|
|
270
|
-
If you
|
|
346
|
+
If you're having authentication problems:
|
|
271
347
|
|
|
272
|
-
1.
|
|
273
|
-
|
|
274
|
-
-
|
|
275
|
-
-
|
|
348
|
+
1. **Recommended: Use Pipeboard Authentication**
|
|
349
|
+
- Set `export PIPEBOARD_API_TOKEN=your_token` and retry
|
|
350
|
+
- This provides longer-lived tokens and better reliability
|
|
351
|
+
- Verify your token in the Pipeboard dashboard
|
|
276
352
|
|
|
277
|
-
|
|
353
|
+
2. For App ID issues (when using direct authentication):
|
|
354
|
+
If you encounter errors like `(#200) Provide valid app ID`, check the following:
|
|
355
|
+
- Ensure you've set up a Meta Developer App correctly
|
|
356
|
+
- Verify that you're passing the correct App ID using one of these methods:
|
|
357
|
+
- Set the `META_APP_ID` environment variable: `export META_APP_ID=your_app_id`
|
|
358
|
+
- Pass it as a command-line argument: `meta-ads-mcp --app-id your_app_id`
|
|
278
359
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
360
|
+
#### API Errors
|
|
361
|
+
|
|
362
|
+
If you receive errors from the Meta API:
|
|
363
|
+
|
|
364
|
+
1. Verify your app has the Marketing API product added
|
|
365
|
+
2. Ensure the user has appropriate permissions on the ad accounts
|
|
366
|
+
3. Check if there are rate limits or other restrictions on your app
|
|
283
367
|
|
|
284
368
|
### Debugging Command
|
|
285
369
|
|
|
@@ -310,14 +394,15 @@ uvx meta-ads-mcp --app-id=your_app_id
|
|
|
310
394
|
The Meta Ads MCP follows security best practices:
|
|
311
395
|
|
|
312
396
|
1. Tokens are cached in a platform-specific secure location:
|
|
313
|
-
- Windows: `%APPDATA%\meta-ads-mcp\token_cache.json`
|
|
314
|
-
- macOS: `~/Library/Application Support/meta-ads-mcp/token_cache.json`
|
|
315
|
-
- Linux: `~/.config/meta-ads-mcp/token_cache.json`
|
|
397
|
+
- Windows: `%APPDATA%\meta-ads-mcp\token_cache.json` or `%APPDATA%\meta-ads-mcp\pipeboard_token_cache.json`
|
|
398
|
+
- macOS: `~/Library/Application Support/meta-ads-mcp/token_cache.json` or `~/Library/Application Support/meta-ads-mcp/pipeboard_token_cache.json`
|
|
399
|
+
- Linux: `~/.config/meta-ads-mcp/token_cache.json` or `~/.config/meta-ads-mcp/pipeboard_token_cache.json`
|
|
316
400
|
|
|
317
401
|
2. You do not need to provide your access token for each command; it will be automatically retrieved from the cache.
|
|
318
402
|
|
|
319
403
|
3. You can set the following environment variables instead of passing them as arguments:
|
|
320
|
-
- `META_APP_ID`: Your Meta App ID (Client ID)
|
|
404
|
+
- `META_APP_ID`: Your Meta App ID (Client ID) - for direct OAuth method
|
|
405
|
+
- `PIPEBOARD_API_TOKEN`: Your Pipeboard API token - for Pipeboard authentication method
|
|
321
406
|
|
|
322
407
|
## Testing
|
|
323
408
|
|
|
@@ -339,11 +424,12 @@ python test_meta_ads_auth.py --app-id YOUR_APP_ID --force-login
|
|
|
339
424
|
|
|
340
425
|
When using the Meta Ads MCP with an LLM interface (like Claude):
|
|
341
426
|
|
|
342
|
-
1.
|
|
343
|
-
2.
|
|
344
|
-
3.
|
|
427
|
+
1. If using direct Meta authentication (your own Facebook app), test authentication by calling the `mcp_meta_ads_get_login_link` tool
|
|
428
|
+
2. If using Pipeboard authentication (recommended), ensure the PIPEBOARD_API_TOKEN environment variable is set (token obtainable via https://pipeboard.co)
|
|
429
|
+
3. Verify account access by calling `mcp_meta_ads_get_ad_accounts`
|
|
430
|
+
4. Check specific account details with `mcp_meta_ads_get_account_info`
|
|
345
431
|
|
|
346
|
-
These functions will automatically handle authentication if needed and provide a clickable login link.
|
|
432
|
+
These functions will automatically handle authentication if needed and provide a clickable login link if required.
|
|
347
433
|
|
|
348
434
|
## Troubleshooting
|
|
349
435
|
|
|
@@ -352,20 +438,20 @@ These functions will automatically handle authentication if needed and provide a
|
|
|
352
438
|
If you encounter authentication issues:
|
|
353
439
|
|
|
354
440
|
1. When using the LLM interface:
|
|
355
|
-
-
|
|
441
|
+
- If using direct Meta authentication (your own Facebook app), use the `mcp_meta_ads_get_login_link` tool to generate a fresh authentication link
|
|
442
|
+
- If using Pipeboard authentication (recommended), ensure the PIPEBOARD_API_TOKEN environment variable is set (token obtainable via https://pipeboard.co)
|
|
356
443
|
- Ensure you click the link and complete the authorization flow in your browser
|
|
357
444
|
- Check that the callback server is running properly (the tool will report this)
|
|
358
445
|
|
|
359
|
-
2. When using
|
|
446
|
+
2. When using Pipeboard authentication:
|
|
447
|
+
- Verify your `PIPEBOARD_API_TOKEN` is set correctly (token obtainable via https://pipeboard.co)
|
|
448
|
+
- Check if you need to complete the authorization process by visiting the provided login URL
|
|
449
|
+
- Try forcing a new login: `python test_pipeboard_auth.py --force-login`
|
|
450
|
+
|
|
451
|
+
3. When using direct Meta OAuth:
|
|
360
452
|
- Run with `--force-login` to get a fresh token: `uvx meta-ads-mcp --login --app-id YOUR_APP_ID --force-login`
|
|
361
453
|
- Make sure the terminal has permissions to open a browser window
|
|
362
454
|
|
|
363
|
-
3. General authentication troubleshooting:
|
|
364
|
-
- Check that your app is properly configured in the Meta Developers portal
|
|
365
|
-
- Ensure your app has the necessary permissions (ads_management, ads_read, business_management)
|
|
366
|
-
- Verify the app's redirect URI includes `http://localhost:8888/callback`
|
|
367
|
-
- Try clearing the token cache (located in platform-specific directories listed in the Token Caching section)
|
|
368
|
-
|
|
369
455
|
### API Errors
|
|
370
456
|
|
|
371
457
|
If you receive errors from the Meta API:
|
|
@@ -28,6 +28,11 @@ Screenhot: using an LLM to understand your ad performance.
|
|
|
28
28
|
When using uv no specific installation is needed. We can use uvx to directly run meta-ads-mcp:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
+
# RECOMMENDED: Use with Pipeboard authentication
|
|
32
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token # Get your token at https://pipeboard.co
|
|
33
|
+
uvx meta-ads-mcp
|
|
34
|
+
|
|
35
|
+
# Alternative: Use with direct Meta authentication
|
|
31
36
|
uvx meta-ads-mcp --app-id YOUR_META_ADS_APP_ID
|
|
32
37
|
```
|
|
33
38
|
|
|
@@ -55,15 +60,50 @@ pip install meta-ads-mcp
|
|
|
55
60
|
After installation, you can run it as:
|
|
56
61
|
|
|
57
62
|
```bash
|
|
63
|
+
# RECOMMENDED: Use with Pipeboard authentication
|
|
64
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token # Get your token at https://pipeboard.co
|
|
58
65
|
python -m meta_ads_mcp
|
|
66
|
+
|
|
67
|
+
# Alternative: Use with direct Meta authentication
|
|
68
|
+
python -m meta_ads_mcp --app-id YOUR_META_ADS_APP_ID
|
|
59
69
|
```
|
|
60
70
|
|
|
61
71
|
## Configuration
|
|
62
72
|
|
|
73
|
+
### Quick Start with Pipeboard Authentication (Recommended)
|
|
74
|
+
|
|
75
|
+
The easiest way to configure Meta Ads MCP is using Pipeboard authentication:
|
|
76
|
+
|
|
77
|
+
1. Sign up at [Pipeboard.co](https://pipeboard.co) and generate an API token - **Get your free token at [https://pipeboard.co](https://pipeboard.co)**
|
|
78
|
+
2. Set the environment variable:
|
|
79
|
+
```bash
|
|
80
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token # Token obtainable via https://pipeboard.co
|
|
81
|
+
```
|
|
82
|
+
3. Run meta-ads-mcp without needing to set up a Meta Developer App:
|
|
83
|
+
```bash
|
|
84
|
+
uvx meta-ads-mcp
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This method provides longer-lived tokens (60 days), simplified setup, and automatic token renewal.
|
|
88
|
+
|
|
63
89
|
### Usage with Claude in Cursor
|
|
64
90
|
|
|
65
91
|
Add this to your `claude_desktop_config.json` to integrate with Claude in Cursor:
|
|
66
92
|
|
|
93
|
+
```json
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"meta-ads": {
|
|
96
|
+
"command": "uvx",
|
|
97
|
+
"args": ["meta-ads-mcp"],
|
|
98
|
+
"env": {
|
|
99
|
+
"PIPEBOARD_API_TOKEN": "your_pipeboard_token" // Token obtainable via https://pipeboard.co
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Or if you prefer direct Meta authentication (using your own Facebook app):
|
|
106
|
+
|
|
67
107
|
```json
|
|
68
108
|
"mcpServers": {
|
|
69
109
|
"meta-ads": {
|
|
@@ -207,6 +247,7 @@ Add this to your `claude_desktop_config.json` to integrate with Claude in Cursor
|
|
|
207
247
|
|
|
208
248
|
16. `mcp_meta_ads_get_login_link`
|
|
209
249
|
- Get a clickable login link for Meta Ads authentication
|
|
250
|
+
- NOTE: This method should only be used if you're using your own Facebook app. If using Pipeboard authentication (recommended), set the PIPEBOARD_API_TOKEN environment variable instead (token obtainable via https://pipeboard.co).
|
|
210
251
|
- Inputs:
|
|
211
252
|
- `access_token` (optional): Meta API access token (will use cached token if not provided)
|
|
212
253
|
- Returns: A clickable resource link for Meta authentication
|
|
@@ -223,13 +264,47 @@ Before using the MCP server, you'll need to set up a Meta Developer App:
|
|
|
223
264
|
|
|
224
265
|
## Authentication
|
|
225
266
|
|
|
226
|
-
The Meta Ads MCP
|
|
267
|
+
The Meta Ads MCP supports two authentication methods:
|
|
268
|
+
|
|
269
|
+
### 1. Pipeboard Authentication (Recommended ⭐)
|
|
270
|
+
|
|
271
|
+
This method uses [Pipeboard.co](https://pipeboard.co) to manage Meta API authentication, providing longer-lived tokens and a simplified flow:
|
|
272
|
+
|
|
273
|
+
1. **Get your Pipeboard token**: Sign up at [https://pipeboard.co](https://pipeboard.co) to generate your free API token
|
|
274
|
+
2. Set the `PIPEBOARD_API_TOKEN` environment variable with your token:
|
|
275
|
+
```bash
|
|
276
|
+
export PIPEBOARD_API_TOKEN=your_pipeboard_token
|
|
277
|
+
```
|
|
278
|
+
3. Run the Meta Ads MCP normally - it will automatically detect and use Pipeboard authentication:
|
|
279
|
+
```bash
|
|
280
|
+
uvx meta-ads-mcp
|
|
281
|
+
```
|
|
282
|
+
4. The first time you run a command, you'll be provided with a login URL to authorize with Meta
|
|
283
|
+
|
|
284
|
+
**Benefits of Pipeboard authentication:**
|
|
285
|
+
- ✅ Longer-lived tokens (60 days)
|
|
286
|
+
- ✅ No need to configure a Meta Developer App
|
|
287
|
+
- ✅ Simpler setup with just an API token
|
|
288
|
+
- ✅ Automatic token renewal
|
|
289
|
+
|
|
290
|
+
To test the Pipeboard authentication flow:
|
|
291
|
+
```bash
|
|
292
|
+
python test_pipeboard_auth.py --api-token YOUR_PIPEBOARD_TOKEN
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### 2. Direct Meta OAuth (Legacy)
|
|
296
|
+
|
|
297
|
+
The traditional OAuth 2.0 flow designed for desktop apps. This method should only be used if you are using your own Facebook app instead of Pipeboard.
|
|
298
|
+
|
|
299
|
+
When authenticating, it will:
|
|
227
300
|
|
|
228
301
|
1. Start a local callback server on your machine
|
|
229
302
|
2. Open a browser window to authenticate with Meta
|
|
230
303
|
3. Ask you to authorize the app
|
|
231
304
|
4. Redirect back to the local server to extract and store the token securely
|
|
232
305
|
|
|
306
|
+
This method requires you to [create a Meta Developer App](#create-a-meta-developer-app) first.
|
|
307
|
+
|
|
233
308
|
## Troubleshooting and Logging
|
|
234
309
|
|
|
235
310
|
The Meta Ads MCP includes a comprehensive logging system to help troubleshoot issues:
|
|
@@ -244,21 +319,29 @@ Log files are stored in a platform-specific location:
|
|
|
244
319
|
|
|
245
320
|
### Common Issues
|
|
246
321
|
|
|
247
|
-
####
|
|
322
|
+
#### Authentication Issues
|
|
248
323
|
|
|
249
|
-
If you
|
|
324
|
+
If you're having authentication problems:
|
|
250
325
|
|
|
251
|
-
1.
|
|
252
|
-
|
|
253
|
-
-
|
|
254
|
-
-
|
|
326
|
+
1. **Recommended: Use Pipeboard Authentication**
|
|
327
|
+
- Set `export PIPEBOARD_API_TOKEN=your_token` and retry
|
|
328
|
+
- This provides longer-lived tokens and better reliability
|
|
329
|
+
- Verify your token in the Pipeboard dashboard
|
|
255
330
|
|
|
256
|
-
|
|
331
|
+
2. For App ID issues (when using direct authentication):
|
|
332
|
+
If you encounter errors like `(#200) Provide valid app ID`, check the following:
|
|
333
|
+
- Ensure you've set up a Meta Developer App correctly
|
|
334
|
+
- Verify that you're passing the correct App ID using one of these methods:
|
|
335
|
+
- Set the `META_APP_ID` environment variable: `export META_APP_ID=your_app_id`
|
|
336
|
+
- Pass it as a command-line argument: `meta-ads-mcp --app-id your_app_id`
|
|
257
337
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
338
|
+
#### API Errors
|
|
339
|
+
|
|
340
|
+
If you receive errors from the Meta API:
|
|
341
|
+
|
|
342
|
+
1. Verify your app has the Marketing API product added
|
|
343
|
+
2. Ensure the user has appropriate permissions on the ad accounts
|
|
344
|
+
3. Check if there are rate limits or other restrictions on your app
|
|
262
345
|
|
|
263
346
|
### Debugging Command
|
|
264
347
|
|
|
@@ -289,14 +372,15 @@ uvx meta-ads-mcp --app-id=your_app_id
|
|
|
289
372
|
The Meta Ads MCP follows security best practices:
|
|
290
373
|
|
|
291
374
|
1. Tokens are cached in a platform-specific secure location:
|
|
292
|
-
- Windows: `%APPDATA%\meta-ads-mcp\token_cache.json`
|
|
293
|
-
- macOS: `~/Library/Application Support/meta-ads-mcp/token_cache.json`
|
|
294
|
-
- Linux: `~/.config/meta-ads-mcp/token_cache.json`
|
|
375
|
+
- Windows: `%APPDATA%\meta-ads-mcp\token_cache.json` or `%APPDATA%\meta-ads-mcp\pipeboard_token_cache.json`
|
|
376
|
+
- macOS: `~/Library/Application Support/meta-ads-mcp/token_cache.json` or `~/Library/Application Support/meta-ads-mcp/pipeboard_token_cache.json`
|
|
377
|
+
- Linux: `~/.config/meta-ads-mcp/token_cache.json` or `~/.config/meta-ads-mcp/pipeboard_token_cache.json`
|
|
295
378
|
|
|
296
379
|
2. You do not need to provide your access token for each command; it will be automatically retrieved from the cache.
|
|
297
380
|
|
|
298
381
|
3. You can set the following environment variables instead of passing them as arguments:
|
|
299
|
-
- `META_APP_ID`: Your Meta App ID (Client ID)
|
|
382
|
+
- `META_APP_ID`: Your Meta App ID (Client ID) - for direct OAuth method
|
|
383
|
+
- `PIPEBOARD_API_TOKEN`: Your Pipeboard API token - for Pipeboard authentication method
|
|
300
384
|
|
|
301
385
|
## Testing
|
|
302
386
|
|
|
@@ -318,11 +402,12 @@ python test_meta_ads_auth.py --app-id YOUR_APP_ID --force-login
|
|
|
318
402
|
|
|
319
403
|
When using the Meta Ads MCP with an LLM interface (like Claude):
|
|
320
404
|
|
|
321
|
-
1.
|
|
322
|
-
2.
|
|
323
|
-
3.
|
|
405
|
+
1. If using direct Meta authentication (your own Facebook app), test authentication by calling the `mcp_meta_ads_get_login_link` tool
|
|
406
|
+
2. If using Pipeboard authentication (recommended), ensure the PIPEBOARD_API_TOKEN environment variable is set (token obtainable via https://pipeboard.co)
|
|
407
|
+
3. Verify account access by calling `mcp_meta_ads_get_ad_accounts`
|
|
408
|
+
4. Check specific account details with `mcp_meta_ads_get_account_info`
|
|
324
409
|
|
|
325
|
-
These functions will automatically handle authentication if needed and provide a clickable login link.
|
|
410
|
+
These functions will automatically handle authentication if needed and provide a clickable login link if required.
|
|
326
411
|
|
|
327
412
|
## Troubleshooting
|
|
328
413
|
|
|
@@ -331,20 +416,20 @@ These functions will automatically handle authentication if needed and provide a
|
|
|
331
416
|
If you encounter authentication issues:
|
|
332
417
|
|
|
333
418
|
1. When using the LLM interface:
|
|
334
|
-
-
|
|
419
|
+
- If using direct Meta authentication (your own Facebook app), use the `mcp_meta_ads_get_login_link` tool to generate a fresh authentication link
|
|
420
|
+
- If using Pipeboard authentication (recommended), ensure the PIPEBOARD_API_TOKEN environment variable is set (token obtainable via https://pipeboard.co)
|
|
335
421
|
- Ensure you click the link and complete the authorization flow in your browser
|
|
336
422
|
- Check that the callback server is running properly (the tool will report this)
|
|
337
423
|
|
|
338
|
-
2. When using
|
|
424
|
+
2. When using Pipeboard authentication:
|
|
425
|
+
- Verify your `PIPEBOARD_API_TOKEN` is set correctly (token obtainable via https://pipeboard.co)
|
|
426
|
+
- Check if you need to complete the authorization process by visiting the provided login URL
|
|
427
|
+
- Try forcing a new login: `python test_pipeboard_auth.py --force-login`
|
|
428
|
+
|
|
429
|
+
3. When using direct Meta OAuth:
|
|
339
430
|
- Run with `--force-login` to get a fresh token: `uvx meta-ads-mcp --login --app-id YOUR_APP_ID --force-login`
|
|
340
431
|
- Make sure the terminal has permissions to open a browser window
|
|
341
432
|
|
|
342
|
-
3. General authentication troubleshooting:
|
|
343
|
-
- Check that your app is properly configured in the Meta Developers portal
|
|
344
|
-
- Ensure your app has the necessary permissions (ads_management, ads_read, business_management)
|
|
345
|
-
- Verify the app's redirect URI includes `http://localhost:8888/callback`
|
|
346
|
-
- Try clearing the token cache (located in platform-specific directories listed in the Token Caching section)
|
|
347
|
-
|
|
348
433
|
### API Errors
|
|
349
434
|
|
|
350
435
|
If you receive errors from the Meta API:
|