///// AI hosts
MCP sign-in for Gemini CLI
How Gemini CLI signs in to a remote MCP server, the callback it registers, and how to check your server is ready for it.
The callback it registers
http://localhost:51121/oauth/callback
A loopback callback on the user's machine. The port can vary, so your authorization server should accept any loopback port (RFC 8252).
Check your server for it
The anonymous check is the same for every host: it follows the sign-in chain from outside.
On your own server, --register also registers one client per host callback, including this one, and lists each client it created so you can delete them.
AI host
/mcpyour server
- 401 challenge
WWW-Authenticate: resource_metadata - Protected-resource metadata
/.well-known/oauth-protected-resource - Authorization-server metadata
/.well-known/oauth-authorization-server - PKCE
code_challenge_methods_supported: S256 - Client registration
registration_endpoint
The host stops here, and nothing looks wrong on your side.