Connect Meta with your own access token
If Meta's own connector isn't available on your ad account yet, you can connect Claude to Meta through a small server on your computer instead. It signs in with a personal access token that lasts about 60 days. These pages walk you through it, from making your Meta app to renewing the token.
- What your own Meta connection is, and what you'll need
- Create your Meta app
- Install the personal Meta server
- Sign in to Meta and get your access token
- Add the personal Meta server to Claude
- Renew your Meta sign-in every 60 days
- Make a Meta access token for the hosted Meta connector
What your own Meta connection is, and what you'll need
This page explains what you're setting up in this book, so you can decide whether you need it and gather what you'll need before you start.
There's now a second way that needs nothing on your computer: our hosted Meta connector, which takes an access token you make once. See Make a Meta access token for the hosted Meta connector. The rest of this page is about the personal server.
How it works
There are three pieces, and you set each one up once:
- A Meta app of your own. It's not something you publish or anyone else sees. It's how Meta knows which program is asking for access to your ads. It gives you an App ID and an App secret.
- The personal Meta server, installed on your computer.
- A personal access token. You sign in to Facebook once, Meta asks whether to let your app manage your ads, and the server keeps the token it gets back.
After that, Claude uses the server just as it would Meta's connector, and the method works the same way.
About the 60 days
A personal access token lasts about 60 days. When it runs out, Claude can't reach your ads until you sign in again, which takes a minute (see Renew your Meta sign-in every 60 days). That's the trade-off for a quick start. Later on, you can switch to a system user token from your business portfolio, which doesn't expire. That will have its own guide.
What you'll need
- The Claude desktop app on Windows or a Mac. The personal Meta server runs on your computer, so it doesn't work on claude.ai in a browser or in the phone app.
- The Facebook account that runs your ads, with admin access to your ad account and its business portfolio.
- About half an hour, and a willingness to type a few commands into a terminal window. Every command is on the page, ready to copy.
The steps
- Create your Meta app
- Install the personal Meta server
- Sign in to Meta and get your access token
- Add the personal Meta server to Claude
- Renew your Meta sign-in every 60 days
Nothing here changes your ads. The server makes everything it creates paused, and it can't delete anything, so you stay in charge of what goes live.
Create your Meta app
This page walks you through making the Meta app that your personal Meta server signs in with. When you're done, you'll have its App ID and App secret, which the next pages use.
It sounds technical, but it's mostly a form with a few screens. Nothing you do here touches your ads, and the app stays private to you.
Sign in as a Meta developer
- Go to developers.facebook.com and log in with the Facebook account that runs your ads.
- If you've never been there before, click Get started and follow the steps to register as a developer. Meta may ask you to confirm your email address or phone number. That's normal.
Create the app
- Click My Apps at the top, then Create app.
- App details: give it a name you'll recognize, such as My book ads, and check the contact email. Click Next.
- Use cases: pick Create & manage ads with Marketing API. If you don't see it, choose the Ads and monetization filter on the left. Click Next.
- Business: choose the business portfolio that owns your ad account. Click Next.
- Requirements: read it over and click Next.
- Overview: check it and click Go to dashboard. Meta may ask for your Facebook password once more.
Your app is created in Development mode. Leave it that way: only you will use it, and Development mode is all you need.
Copy the App ID and App secret
- In your app's left-hand menu, open App settings, then Basic.
- Copy the App ID at the top and keep it somewhere handy.
- Next to App secret, click Show, enter your Facebook password if asked, and copy it too.
The App secret works like a password for your app. Keep it private: don't paste it into a chat, an email or a document you share. If it ever gets out, click Reset next to it to make a new one.
Let the app ask for the right permissions (optional check)
Your access token can only include permissions your app has. The ad-management ones come with the use case, but check that all of these are there:
- In the left-hand menu, open Use cases, and click Customize next to Create & manage ads with Marketing API.
- Under Permissions, make sure each of these says Ready for testing (or is added). Click Add next to any that aren't:
ads_managementads_readbusiness_managementpages_show_listpages_read_engagementpages_manage_ads
public_profile is always included, so you won't need to add it. If a Pages permission isn't listed in this use case, the sign-in will tell you which one is missing (see If something doesn't work below).
Let the sign-in come back to your computer
When you sign in on the next pages, Facebook sends you back to the personal Meta server, which listens on your computer at http://localhost:8080/callback. Tell your app that's allowed:
- In the left-hand menu, click App Settings, then Advanced.
- Toggle Native or Desktop App to the On position.
- Scroll down to the bottom and click Save changes.
That's the app done. Next: Install the personal Meta server.
If something doesn't work
- You don't see Create & manage ads with Marketing API. Meta sometimes words it a little differently, such as Manage ads using Marketing API. Pick the one about creating and managing ads.
- Meta won't let you pick a business portfolio. Your Facebook account needs to be an admin of the business portfolio that owns your ad account. Ask whoever set it up to make you one, in Meta Business Suite under Settings → People.
- Later, the sign-in says "Invalid Scopes" and names a permission. That permission isn't on your app yet. Add it as described above, then sign in again.
Install the personal Meta server
This page installs the personal Meta server on your computer. It takes two commands: one installs uv, a small tool that sets up the server along with the version of Python it needs, and the other installs the server itself.
You don't need to know Python, and nothing you already have installed is changed.
Open a terminal
- Windows: click Start, type PowerShell, and open Windows PowerShell.
- Mac: open Finder, then Applications → Utilities → Terminal.
A window opens with a blinking cursor. To run a command, paste it in and press Enter. Wait until the cursor comes back before you paste the next one.
Install uv
First, check whether you already have it:
uv --version
If that prints a version number, skip to Install the server. If it says the command isn't recognized or wasn't found, install uv.
(this is what it looks like if 'uv' is already installed -> continue on to Check whether you have Python installed)
(this means you need to install 'uv')
-
Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" -
Mac or Linux (Terminal):
curl -LsSf https://astral.sh/uv/install.sh | sh
(Successful uv install on windows powershell)
When it finishes, close the terminal window and open a new one, so it can find uv.
Check whether you have Python installed
In the terminal you have open, type:
- Windows (PowerShell):
python --version - Mac or Linux (Terminal):
python3 --version
You should see Python 3.12.x where x can be any number. If there is no result, or you have a different python version, you'll need to install Python 3.12
In the terminal you have open, type:
- Windows (PowerShell):
winget install --id Python.Python.3.12 -e - Mac:
Visit https://www.python.org/downloads/release/python-31216/ and download that version of Python and install it. If the top of the page says it has been superseded by a newer version, click the link to the newer version and install that.
Install the server
Close the terminal window if it is still open, and open a new one. Then run this (it's one line, on Windows and Mac alike):
uv tool install --force --python 3.12 "armavita-meta-ads-mcp @ https://github.com/maloriedelilah/armavita-meta-ads-mcp/archive/refs/heads/main.zip"
It downloads for a minute or so, then ends with a line saying it installed armavita-meta-ads-mcp. That's the personal Meta server: the Writing Wives version of the open-source ArmaVita Meta Ads server.
Find where it's installed
Claude will need the server's full location later. Ask the terminal for it:
- Windows:
where armavita-meta-ads-mcp - Mac:
which armavita-meta-ads-mcp
It prints something like C:\Users\YourName\.local\bin\armavita-meta-ads-mcp.exe on Windows, or /Users/yourname/.local/bin/armavita-meta-ads-mcp on a Mac. Copy that line somewhere handy.
On windows, you may need to close the Powershell window and open a command prompt by clicking start and typing cmd.
Keep the terminal open: the next page uses it. Next: Sign in to Meta and get your access token.
Updating it later
When Malorie announces an update to the personal Meta server, run the same install line again with --reinstall added after --force, then fully quit and reopen your Claude or ChatGPT app.
uv tool install --force --reinstall --python 3.12 "armavita-meta-ads-mcp @ https://github.com/maloriedelilah/armavita-meta-ads-mcp/archive/refs/heads/main.zip"
If something doesn't work
- "armavita-meta-ads-mcp is not recognized" or "command not found" after installing. Run
uv tool update-shell, close the terminal, open a new one, and try again. - The install stops with a network error. Check your internet connection and run the install line again. It's safe to repeat.
- Windows says scripts are disabled. Use the uv install line exactly as written above: its
-ExecutionPolicy ByPasspart allows just that one script.
Sign in to Meta and get your access token
IMPORTANT NOTE:
This is an alternative method to signing the local MCP -> API server and not necessary for most use cases. Unless you've been instructed to do this, skip ahead to Add the personal Meta server to Claude.
Using our hosted Meta connector (metaapi-mcp.authortools.net) instead of a server on your computer? This page isn't for you: see Make a Meta access token for the hosted Meta connector.
This page gets your personal access token: you sign in to Facebook once, approve your app, and the personal Meta server keeps the token on your computer. You'll need your app's App ID and App secret from Create your Meta app.
Tell the server about your app
In the terminal, set three values for this window. Paste the lines below into a text editor first, replace YOUR_APP_ID and YOUR_APP_SECRET with your own (keep the quote marks), then paste them into the terminal and press Enter.
-
Windows (PowerShell):
$env:META_APP_ID = "YOUR_APP_ID" $env:META_APP_SECRET = "YOUR_APP_SECRET" $env:META_AUTH_SCOPE = "ads_management,ads_read,business_management,public_profile,pages_show_list,pages_read_engagement,pages_manage_ads" -
Mac (Terminal):
export META_APP_ID="YOUR_APP_ID" export META_APP_SECRET="YOUR_APP_SECRET" export META_AUTH_SCOPE="ads_management,ads_read,business_management,public_profile,pages_show_list,pages_read_engagement,pages_manage_ads"
Nothing appears to happen, and that's expected: the values are just held in this window until you close it.
META_AUTH_SCOPE is the list of permissions your token asks for: managing and reading your ads, seeing your business portfolio, and seeing your Pages so ads can run from them.
Sign in
In the same window, run:
armavita-meta-ads-mcp --login
The terminal says Launching the Meta OAuth login flow… and your web browser opens a Facebook page.
- Facebook asks you to continue as yourself. If it shows a different account, switch to the one that runs your ads.
- It shows what your app is asking for. If it offers a choice of businesses, Pages or ad accounts, pick the ones your book ads use. You can pick more than one.
- Click Continue or Save on each screen until it's done.
Capture the Facebook permission screen that opens from --login, showing your app's name and the access it asks for.
The browser then shows a short page headed Authorization complete, and the terminal prints Authentication successful. You can close that browser tab.
You have about five minutes to finish the Facebook screens. If the terminal says Authentication timed out, just run armavita-meta-ads-mcp --login again.
Where the token goes
The server saves your token in a file only your user account can open:
- Windows:
%APPDATA%\armavita-meta-ads-mcp\token_cache.json - Mac:
~/Library/Application Support/armavita-meta-ads-mcp/token_cache.json
You never need to open it or copy the token anywhere. Claude never needs to see it, so never paste it into a chat.
Next: Add the personal Meta server to Claude.
If something doesn't work
- Facebook says "URL blocked" or that the redirect URI isn't allowed. Look at the long address the terminal printed after Opening browser: find
redirect_uri=and the number afterlocalhost%3A. It's usually8080, but if something else on your computer was using that port, it's8081or a little higher. Add that address (for examplehttp://localhost:8081/callback) under Valid OAuth Redirect URIs in your app, as in Create your Meta app, and sign in again. - Facebook says "Invalid Scopes". It names a permission your app doesn't have yet. Add it in your app's use case, then sign in again.
- The terminal says "Authorization code exchange failed". The App secret doesn't match. Copy it again from App settings → Basic, set
META_APP_SECRETagain, and run the sign-in again. - You closed the terminal before signing in. The three values went with it. Open a new window, set them again, and run the sign-in.
Add the personal Meta server to Claude
This page tells the Claude desktop app about the personal Meta server, so Claude can use it in your chats. You'll need the server's location from Install the personal Meta server and your App ID and App secret from Create your Meta app.
Open Claude's settings file
- In the Claude desktop app, open Settings (click your name in the lower left), then Developer.
- Click Edit Config. A folder opens with a file called
claude_desktop_config.jsonhighlighted.
- Open that file in a plain text editor: on Windows, right-click it and choose Open with → Notepad; on a Mac, right-click it and choose Open With → TextEdit.
Add the server
If the file is empty, or just has {} in it, replace everything with the block below. If it already has an "mcpServers" section, add only the "meta-ads-personal": { … } part inside it, with a comma between it and the server before it.
Then fill in your own values:
command: the location you copied withwhereorwhich. On Windows, double every backslash, soC:\Users\YourName\.local\bin\armavita-meta-ads-mcp.exebecomesC:\\Users\\YourName\\.local\\bin\\armavita-meta-ads-mcp.exe.META_APP_IDandMETA_APP_SECRET: your app's.
Windows:
{
"mcpServers": {
"meta-ads-personal": {
"command": "C:\\Users\\YourName\\.local\\bin\\armavita-meta-ads-mcp.exe",
"env": {
"META_APP_ID": "YOUR_APP_ID",
"META_APP_SECRET": "YOUR_APP_SECRET",
"META_AUTH_SCOPE": "ads_management,ads_read,business_management,public_profile,pages_show_list,pages_read_engagement,pages_manage_ads",
"META_GRAPH_API_VERSION": "v25.0"
}
}
}
}
Mac:
{
"mcpServers": {
"meta-ads-personal": {
"command": "/Users/yourname/.local/bin/armavita-meta-ads-mcp",
"env": {
"META_APP_ID": "YOUR_APP_ID",
"META_APP_SECRET": "YOUR_APP_SECRET",
"META_AUTH_SCOPE": "ads_management,ads_read,business_management,public_profile,pages_show_list,pages_read_engagement,pages_manage_ads",
"META_GRAPH_API_VERSION": "v25.0"
}
}
}
}
Keep the name meta-ads-personal as it is, so it matches what Meta Ads for Authors and these guides call it. Save the file.
This file now holds your App secret, so keep it private and never paste its contents into a chat. It sits inside your own user folder, where other people who use the computer can't open it.
Restart Claude
Claude only reads this file when it starts, so quit it completely:
- Windows: right-click the Claude icon in the system tray (by the clock) and choose Quit. Closing the window isn't enough.
- Mac: with Claude in front, choose Claude → Quit Claude (or press ⌘Q).
Then open Claude again.
Check that it worked
- Open Settings → Developer again. meta-ads-personal should be listed as running.
- Open a new chat and ask Check my personal Meta server. Claude lists the ad accounts your token can reach.
(Your "command" line will be different than what is shown here)
That's it: say set me up for Meta ads in a new chat, and Meta Ads for Authors carries on from there. Keep Renew your Meta sign-in every 60 days handy for when the token runs out.
If something doesn't work
- Claude shows an error about the config file when it starts. A comma or quote mark is out of place. The most common slip is a missing comma between two servers, or a single backslash in a Windows path. Fix it, save, and restart Claude.
- meta-ads-personal says it failed to start. The
commanddoesn't point at the server. Runwhere armavita-meta-ads-mcp(Windows) orwhich armavita-meta-ads-mcp(Mac) again and copy it exactly, doubling the backslashes on Windows. - Claude says it isn't signed in to Meta. The sign-in didn't finish, or the token has run out. Follow Sign in to Meta and get your access token again, then restart Claude.
- The list of ad accounts is empty or missing one. When you signed in, the account wasn't chosen, or your Facebook account isn't an admin of it. Sign in again and pick it on the Facebook screens.
Renew your Meta sign-in every 60 days
This page is for when your personal access token runs out, which happens about 60 days after you sign in. Renewing takes a minute and doesn't touch your ads: they keep running whether Claude can reach them or not.
How you'll know
Claude tells you it can't reach Meta, or that the personal Meta server isn't signed in. Meta may call it an expired or invalid token (error 190). To stay ahead of it, put a reminder in your calendar for about 55 days after you sign in.
Sign in again
-
Open a terminal: PowerShell on Windows, Terminal on a Mac.
-
Set your app's values for this window, just as you did the first time. Replace the first two quoted items with your own App ID and App secret:
-
Windows (PowerShell):
$env:META_APP_ID = "YOUR_APP_ID" $env:META_APP_SECRET = "YOUR_APP_SECRET" $env:META_AUTH_SCOPE = "ads_management,ads_read,business_management,public_profile,pages_show_list,pages_read_engagement,pages_manage_ads" -
Mac (Terminal):
export META_APP_ID="YOUR_APP_ID" export META_APP_SECRET="YOUR_APP_SECRET" export META_AUTH_SCOPE="ads_management,ads_read,business_management,public_profile,pages_show_list,pages_read_engagement,pages_manage_ads"
If you've misplaced them, both are in your app on developers.facebook.com, under App settings → Basic.
-
-
Run:
armavita-meta-ads-mcp --login -
Approve the Facebook screens in your browser. When the terminal says Authentication successful., the new token is saved over the old one.
-
Fully quit Claude and open it again, so the server picks up the new token.
That's all. Your app, the server and Claude's settings stay as they were. Only the token is new.
Something longer-lasting
Tokens from a Business Manager system user don't expire, so there's no 60-day sign-in. They take more setup in your business portfolio, and a separate guide will walk through them. Until then, this renewal is the whole job.
If something doesn't work
The sign-in problems and fixes are the same as the first time: see If something doesn't work on Sign in to Meta and get your access token.
Make a Meta access token for the hosted Meta connector
This page shows you how to make the Meta access token that our hosted Meta connector asks for (metaapi-mcp.authortools.net). You make the token once and paste it into the connector's page, and that's it. There's nothing to install on your computer, and it works in Claude on the web, on desktop and on your phone.
Running the personal Meta server on your own computer instead? You don't need this page. See Sign in to Meta and get your access token.
You'll paste the token into our page, not into a chat. We check it with Meta straight away and keep it encrypted. Your AI app never sees it.
Pick the kind of token
There are two kinds of token, and either one works:
- A system user token from your business portfolio. It doesn't expire, so you set it up once and you're done. This is the best choice if your ad account belongs to a business portfolio.
- A personal token that lasts about 60 days. It's quicker to make, but you'll need to make a fresh one every couple of months.
Both kinds need a Meta app of your own. If you don't have one yet, follow the first three sections of Create your Meta app: sign in as a developer, create the app, and pick the Create & manage ads with Marketing API use case. You can skip the part about letting the sign-in come back to your computer, because that's only for the personal server. The app stays private to you, and nothing about your ads changes.
One setting to check on your Meta app
- In your app's left-hand menu, open App settings, then Advanced.
- In the Security section, make sure Require App Secret is off, then click Save changes if you changed it.
If it's on, Meta turns the connector's requests away. Don't worry if you miss this step: the connector will tell you when you paste the token, and nothing is saved until it passes.
Capture: App settings → Advanced, scrolled to Security, with Require App Secret off.
Which permissions to give the token
So that the connector can never do more in your Meta account than work with your ads, it only accepts tokens with these permissions:
- ads_management, to create and change ads. Or use ads_read instead if you only want reports.
- pages_show_list and pages_read_engagement are optional. They let the connector find your Facebook Page when it makes ads.
- catalog_management is optional. You only need it if you sell from a product catalog.
A system user token may also carry business_management and pages_manage_ads. Meta insists on business_management for system users, and often adds pages_manage_ads by itself, so the connector accepts both on a system user token. It still has no tools that use them. A personal token doesn't need either, so leave them off there.
Leave everything else unticked. If the token has any other permission, the page refuses it and tells you which one to remove, so you can make it again.
Option 1: a system user token (doesn't expire)
Make the system user
- Open Business settings and choose the business portfolio that owns your ad account.
- Under Users, choose System users, then Add. Give it a name you'll recognize, such as Meta Ads connector, and the Admin role.
- With the system user selected, choose Assign assets. Pick Ad accounts, choose your ad account and turn on full control (manage campaigns). If you'd like the connector to find your Page, assign your Page too.
- Under Accounts, choose Apps and make sure your Meta app is listed. If it isn't, add it there.
Capture: Business settings → Users → System users, with the system user and its assigned ad account showing.
Generate the token
- With the system user selected, choose Generate new token.
- Pick your app. If Meta asks how long the token should last, choose Never.
- Tick ads_management, plus any of the optional ones you want. If Meta won't let you untick business_management, or adds pages_manage_ads, that's fine: leave them.
- Choose Generate token and copy the token. Meta only shows it once, so keep this tab open until you've pasted it. If you lose it, you can generate another one.
Option 2: a personal token (about 60 days)
Make the token
- Open the Graph API Explorer.
- Under Meta App, choose your app. Under User or Page, choose User Token.
- Under Permissions, add ads_management, plus any of the optional ones above. Remove anything else that's already listed, except public_profile, which is fine to keep.
- Choose Generate Access Token and approve the Facebook screens that pop up. If Facebook offers a choice of businesses, Pages or ad accounts, pick the ones your book ads use.
Make it last 60 days
The token from the Explorer only lasts an hour or two, so stretch it before you paste it. This step matters: if you paste the short one, the connector will turn it away and send you back here.
- Copy the token, open the Access Token Debugger, paste the token in and choose Debug.
- At the bottom of the Access Token Info table, choose Extend Access Token.
- Copy the new token that appears. Its Expires line should now say about 60 days from today.
When it runs out, your AI app will ask you to connect again. Make a fresh token the same way and paste it in.
Paste it into the connector
Go back to the connector's Add your Meta access token page, paste the token and click Check and continue. We check it with Meta right away and then send you back to your AI app.
If something isn't right, the page tells you what to change and lets you try again, and nothing is saved until the token passes. Here's what it might say:
- "That token has more permissions than this connector accepts." Make the token again and leave out the permissions it names.
- "Your Meta app has 'Require App Secret' switched on." Switch it off (see above), save, and paste the same token again. There's no need to make a new one.
- "Meta didn't accept that token" or "That token can't list your ad accounts." Make a fresh token and try again.
- "That token can't see any ad accounts." Make the token as the person, or system user, who has access to your ad account.
Disconnecting
You can see and disconnect your connections at any time in your Author Tools account, under Connected apps at account.authortools.net. Each AI app you've connected has its own row, so you can disconnect one and keep the others. Disconnecting stops that app straight away and deletes the stored Meta token. If you change your mind, connect again from your AI app.