---
title: "MCP authentication — Antwork docs"
description: "OAuth 2.1 with PKCE and dynamic client registration: scopes, token lifetimes, the discovery endpoints, and how a third-party client connects on a user’s behalf."
canonical: https://antwork.io/docs/mcp/auth
---

# MCP authentication — Antwork docs

OAuth 2.1 with PKCE. Headless clients can send an API key instead.

## OAuth scopes

The Antwork MCP server implements OAuth 2.1 with PKCE and dynamic client registration (RFC 7591), so MCP clients can connect without you pre-registering each one. Tokens are scoped, revocable, and issued per-client.

Each tool requires one of four scopes. The consent screen lists the scopes a client is requesting so you can approve or deny them granularly.

| Scope | Access | What it grants |
| --- | --- | --- |
| read | Read | Read posts, social accounts, workspace settings, analytics. No mutations. |
| write | Write | Create / edit / delete drafts and scheduled posts. Mutate media library and workspace settings. Does not publish. |
| publish | Destructive | Publish posts to connected social platforms and schedule them for future publishing. Granted only when the user explicitly approves. |
| media | Write | Upload and attach images / video / PDFs to posts. Separate from `write` so granular consent is possible. |

### Token lifecycle

- Access tokens are JWTs that last one hour.
- Refresh tokens are long-lived and stored server-side. Standard `refresh_token` grant.
- Revoke via the standard `/oauth/revoke` endpoint (RFC 7009) or from Settings → Connected AIs in your Antwork dashboard. Revocation takes effect immediately, for the refresh token and every access token of that connection.
- Each MCP client (Claude desktop, Claude Code, Cursor, …) gets its own token. Revoking one client does not affect others.

## The endpoints

Everything below is served by the authorization server at `https://api.antwork.io`. A client that reads the two discovery documents needs nothing else from this page.

| Scope | What it grants |
| --- | --- |
| /.well-known/oauth-protected-resource | RFC 9728. Names the resource and the authorization server. |
| /.well-known/oauth-authorization-server | RFC 8414. Every endpoint below, plus the supported scopes, grants and PKCE methods. |
| POST /oauth/register | RFC 7591 dynamic client registration. Takes a client name and redirect URIs, returns a client id. No secret: clients are public. |
| GET /oauth/authorize | Sends the user to the Antwork consent screen. `code_challenge` is required and must be S256. |
| POST /oauth/token | Exchanges the code plus verifier, or a refresh token. Accepts form-urlencoded and JSON. |
| POST /oauth/revoke | RFC 7009. Invalidates a refresh token; returns 200 whatever you send it. |

### Discovery endpoints

- `GET /.well-known/oauth-protected-resource` — RFC 9728 resource metadata.
- `GET /.well-known/oauth-authorization-server` — RFC 8414 authorization server metadata.
- `POST /oauth/register` — RFC 7591 dynamic client registration.
- `POST /oauth/token` — authorization-code and refresh-token grants. PKCE S256 required.
- `POST /oauth/revoke` — RFC 7009 token revocation.

## Connecting a client of your own

Registration is open, so an MCP client nobody has heard of can connect: `POST /oauth/register` with a name and a redirect URI, send the user through `/oauth/authorize`, and exchange the code. The consent screen names your client to the user, and the grant is theirs to revoke. This is how every client on the quick-start list connects — there is no private arrangement for any of them.

### Unattended access uses an API key

The authorization server offers `authorization_code` and `refresh_token` and nothing else: no `client_credentials` and no device code, so every OAuth token is bound to a user who approved it in a browser. A client with no browser (a CI job, the Agent SDK, `codex exec`) sends an Antwork API key as the bearer token instead, with the same tools and scopes; the MCP server page shows the setup. The CLI signs in only through the browser, which is why it cannot run in CI.

A key used here follows the REST API's rules as well: the account behind it needs an active subscription (otherwise `403 subscription_inactive`), and its MCP calls count toward the same daily limit as its REST calls, 10,000 a day (`429 rate_limit_daily` once it is reached).
