Skip to main content
TagManifest /Docs Dashboard

OAuth flow

How MCP browser clients authenticate with TagManifest using OAuth 2.1 + PKCE — dynamic client registration, authorization, token exchange, and refresh-token rotation.

On this page 6

MCP browser clients such as Claude.ai authenticate to the TagManifest MCP server with OAuth 2.1 + PKCE. The flow issues short-lived Bearer JWTs, so a user never pastes a long-lived key into their browser client. The token is meant for the /mcp endpoint. It also works on the REST endpoints, within the scopes the user granted. Most people never touch these endpoints directly — the client drives the whole exchange after you paste the server URL. This page documents the flow for anyone building a custom MCP client.

Overview

The server advertises its endpoints at https://developer.tagmanifest.com/.well-known/oauth-authorization-server. A conforming client discovers the registration, authorization, and token endpoints there, then runs the standard authorization-code flow with PKCE. Sign-in is handled by Google. The first time a user connects a client, a consent screen lists the requested scopes and the user approves them. On a later sign-in with the same client, the screen is skipped when the saved approval already covers the scopes asked for.

Two scopes are granted:

ScopeGrants
mcp:readRead-only tools (list_rules, get_rule, account_status).
mcp:toolsScanning and evaluation tools (scan_url, scan_container, evaluate_rule, get_health_score, compare_containers).

A client that requests no scope is granted both. mcp:tools also covers the read-only tools.

Scopes the server does not have are ignored: a request for mcp:read offline_access is treated as mcp:read, and the token response's scope field says what was granted. A request that names no supported scope at all is returned to the client with error=invalid_scope.

A token's scope applies wherever the token is used. The refusal looks different on each surface. On the REST endpoints that run scans, a token granted only mcp:read gets HTTP 403 with insufficient_scope. On /mcp, a scanning tool called with that token gets HTTP 200 with a JSON-RPC error, code -32602.

Client registration

Clients that do not have credentials register dynamically. POST /oauth/register answers with HTTP 201 and a client_id (public clients receive no secret and must use PKCE).

curl -X POST https://developer.tagmanifest.com/oauth/register \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "My MCP Client",
    "redirect_uris": ["https://myapp.example.com/callback"],
    "grant_types": ["authorization_code", "refresh_token"],
    "response_types": ["code"],
    "token_endpoint_auth_method": "none"
  }'
{
  "client_id": "mcp_9f2a…",
  "client_id_issued_at": 1796040000,
  "redirect_uris": ["https://myapp.example.com/callback"],
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "none",
  "scope": "mcp:read mcp:tools",
  "client_name": "My MCP Client"
}

A redirect URI must be https://, or http:// on localhost or 127.0.0.1, and must not contain a fragment (#). At authorization the redirect_uri must match a registered one exactly, including any query string. The one exception is the port of a loopback address, which may differ.

Registration has limits:

  • at most 5 redirect URIs, each at most 2,048 characters and 8,192 characters in total
  • a request body of at most 16 KB; a larger one gets HTTP 413
  • at most 20 registrations per IP address per day; the next one gets HTTP 429

Authorize

Generate a PKCE code_verifier, derive its code_challenge with the S256 method, then send the user to GET /oauth/authorize:

https://developer.tagmanifest.com/oauth/authorize
  ?response_type=code
  &client_id=mcp_9f2a…
  &redirect_uri=https://myapp.example.com/callback
  &scope=mcp:read%20mcp:tools
  &code_challenge=E9Melhoa…
  &code_challenge_method=S256
  &state=xyz

The user signs in with Google and approves the mcp:read / mcp:tools scopes on the consent screen. The screen is skipped when the user has already approved these scopes for this client. The server then redirects back to your redirect_uri with an authorization code and the state you sent:

https://myapp.example.com/callback?code=7d1c…&state=xyz

Verify state matches the value you generated before continuing.

Token exchange

Exchange the authorization code for tokens at POST /oauth/token, sending the original PKCE code_verifier:

curl -X POST https://developer.tagmanifest.com/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d grant_type=authorization_code \
  -d code=7d1c… \
  -d client_id=mcp_9f2a… \
  -d redirect_uri=https://myapp.example.com/callback \
  -d code_verifier=dBjftJeZ4CVP…
{
  "access_token": "eyJhbGciOiJ…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "mcr_4b8e…",
  "scope": "mcp:read mcp:tools"
}

The access_token is a Bearer JWT. expires_in is in seconds. An authorization code expires 10 minutes after it is issued and can be used once.

Refresh rotation

Access tokens are short-lived. When one expires, exchange the refresh token for a new pair at the same endpoint:

curl -X POST https://developer.tagmanifest.com/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d grant_type=refresh_token \
  -d refresh_token=mcr_4b8e… \
  -d client_id=mcp_9f2a…

Refresh tokens rotate: each refresh returns a new refresh_token and invalidates the one you sent. Always store the newest refresh token and discard the previous value. A refresh token expires after 30 days. It must be sent with the client_id it was issued to; any other client is refused with invalid_grant.

Using the token

Send the access token as a Bearer credential on every request to the MCP endpoint:

POST https://developer.tagmanifest.com/mcp
Authorization: Bearer eyJhbGciOiJ…

Prefer the built-in path. In Claude.ai, adding the connector at https://developer.tagmanifest.com/mcp runs this entire flow for you — see Connect to Claude. If you need a headless credential instead of a browser session, use the API-key flow.

Examples

OAuth endpoints
# Dynamic client registration
POST https://developer.tagmanifest.com/oauth/register

# Authorization (PKCE S256)
GET  https://developer.tagmanifest.com/oauth/authorize

# Token exchange + refresh
POST https://developer.tagmanifest.com/oauth/token

# Discovery
GET  https://developer.tagmanifest.com/.well-known/oauth-authorization-server