MCP OAuth refresh tokens: fix constant re-authentication in Claude
Advertise offline_access or the refresh_token grant and rotate refresh tokens, or Claude users must sign in again whenever the access token expires.
Let Claude obtain and rotate refresh tokens. The rule auth.refresh-token is a minor finding for Claude. It warns when authorization server metadata lists neither the offline_access scope in scopes_supported nor refresh_token in grant_types_supported.
What you see
- A scan reports
No offline_access scope or refresh_token grant advertised. - Users have to reconnect the connector each time the access token expires. How often that happens depends on your token lifetime.
Why it happens
Claude's authentication page says it "refreshes tokens reactively on a 401 response, and proactively up to five minutes before the stored expiry", and that it "appends offline_access when your authorization server metadata lists it in scopes_supported, to obtain a refresh token." If the server never issues a refresh token, there is nothing to refresh with.
Other causes: the token endpoint returns invalid_request or a custom code instead of invalid_grant when a refresh token is invalid, or it rotates refresh tokens without returning the new one in the same response.
Check it yourself
curl -s https://auth.acme.example/.well-known/oauth-authorization-server \
| jq '{scopes_supported, grant_types_supported}'
Then run a full sign-in and inspect the token response for a refresh_token field.
Fix
- Add
offline_accesstoscopes_supported(and enable it for the OAuth client at your identity provider) and addrefresh_tokentogrant_types_supported. - Return RFC 6749 error codes. Claude's page asks for
invalid_grantwhen a refresh token is no longer valid. - Rotate refresh tokens for public clients. Claude's page notes DCR registers Claude as a public client, and CIMD normally does too. When you rotate, return the new refresh token in the same response that invalidates the old one.
- Accept
application/x-www-form-urlencodedat/token. Claude sends both the code exchange and refresh requests with that content type. A415here breaks every refresh. - Answer refresh requests quickly. Claude allows 30 seconds for refresh but you should stay far below that (
auth.discovery-latency).
Verify
Use a short test access-token lifetime, connect, wait past expiry and call a tool. The call should succeed without a new sign-in. Re-scan.
Which clients care
Claude, per the rule. OpenAI's auth page says only that tokens "can still expire or rotate normally", so plan for refresh there too.
Source
Claude authentication docs (token refresh): https://claude.com/docs/connectors/building/authentication
Run a free scan at https://mcpshipyard.com/scan to check every rule at once.
Check every rule at once
A free scan runs this check and the other 152 against your live URL.
Related fixes
- Add Client ID Metadata Documents (CIMD) next to Dynamic Client Registration
- API key or token in the MCP server URL (?key=): why it fails and how to fix
- ChatGPT MCP: dynamic client registration not supported (CIMD or DCR required)
- Claude says "Couldn't reach the MCP server": missing protected resource metadata