# X_MCP_REMOTE_AUTH_REQUIRED

## Means

a remote MCP server needs authorization this app does not hold

## Typical cause

the upstream answered 401: no token was sent, or the one sent expired or was revoked; meta.resourceMetadata names where its authorization server is described

## Fix

`mcpOAuthClient({ clientId, redirectUri }).begin(await client.discover(url)) — send the person to authorizeUrl, then return the token from mcpTools({ auth })`

[MCP and AI](/error-codes#mcp-and-ai)
