Skip to main content

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.

  1. Facebook asks you to continue as yourself. If it shows a different account, switch to the one that runs your ads.
  2. 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.
  3. Click Continue or Save on each screen until it's done.

Screenshot: Facebook asking to allow your app to manage your ads 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 after localhost%3A. It's usually 8080, but if something else on your computer was using that port, it's 8081 or a little higher. Add that address (for example http://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_SECRET again, 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.