Skip to main content
Gemini CLI supports remote MCP servers with OAuth via dynamic_discovery (the default), which auto-discovers authorization and token endpoints from PipesHub’s /.well-known/oauth-protected-resource/mcp.
Before you start, create an OAuth app in PipesHub and note your Client ID and Client Secret. See MCP Server Overview.

Option A: Settings File

Edit ~/.gemini/settings.json:
Adjust the scopes list to match what your OAuth app was granted. If you only need a subset of tools, you can limit the scopes accordingly.

Option B: CLI Command

Then edit ~/.gemini/settings.json to add the oauth block as shown above.

Authenticate

Inside Gemini CLI, use the /mcp auth commands:
On first connection, Gemini will automatically detect the 401 response, discover the OAuth endpoints, and open a browser for login. Tokens are stored securely in ~/.gemini/mcp-oauth-tokens.json and refreshed automatically.

Manage Servers

OAuth Configuration Properties

OAuth requires a local browser. It will not work in headless environments, remote SSH without X11 forwarding, or containers without browser access.