Skip to content

Headless use with an API token

Connect a server, CI job or client without OAuth to the MCP endpoint with a scoped automation token sent as a bearer header.

Last updated

On this page

OAuth needs a browser. For agents that run on a server, in CI or in a client without OAuth support, use a scoped automation token instead. The token works on the same MCP URL and the same review rules apply.

Create a token

  1. In AdMassy open Connect › MCP & CLI (/connect/mcp) and scroll to Automation tokens.
  2. Choose Read only or Read and write. Tick the manage option only if the agent may pause, resume or edit existing ads.
  3. Choose Performance automation access if the agent reads reports or manages rules.
  4. Pick the duration (30, 60 or 90 days) and click Create.
  5. Copy the token (it starts with ads_). It is shown once. Store it in your secret manager, never in a repository.

Use it with Claude Code

claude mcp add --transport http --scope user admassy https://app.admassy.com/api/mcp --header "Authorization: Bearer ads_…"

In a shared .mcp.json, read the token from an environment variable instead of writing it into the file:

{
  "mcpServers": {
    "admassy": {
      "type": "http",
      "url": "https://app.admassy.com/api/mcp",
      "headers": { "Authorization": "Bearer ${ADMASSY_TOKEN}" }
    }
  }
}

Use it from any client or script

Send every MCP request as POST https://app.admassy.com/api/mcp with:

  • Authorization: Bearer ads_…
  • Content-Type: application/json
  • Accept: application/json, text/event-stream

Use the default URL /api/mcp with automation tokens. Named connector URLs (/api/mcp/<name>) are for OAuth logins.

What the token can do

  • It acts as you, in the workspace where you created it, limited by your role and the scopes you picked.
  • Meta tools use your primary Facebook connection; pass connectionId (listed by whoami) to use another.
  • It never has the admin scope, so team and token changes stay in the app. A read-and-write token can change confirmation rules when your role is owner or admin.
  • Writes still return a stored review first. A headless agent must apply its own approval step (or a human check) before submitting a review.

Rotate and revoke

  • Tokens expire after the duration you chose; create a new one before then.
  • Revoke a token in the Automation tokens list; it stops working immediately.
  • Delete All My Data in your profile revokes every token at once.

Was this article helpful?