Docs

Search G2X User Guide

Find a guide by task or topic. Use the arrow keys to choose a result.

Home
Docs home
Guides
  • Build with the G2X MCP server
  • Authentication
  • Tools and results
  • Errors and limits
  • Discovery files
  • Changelog
  1. Docs
  2. Authentication

Authentication

How an MCP client signs in to G2X with OAuth, registers itself, and uses its tokens.

On this page
  • How sign-in works
  • Register your client
  • Scopes and tokens
  • What a signed-in client can do

How sign-in works

The G2X MCP server is an OAuth 2.1 protected resource. A client finds its way to sign-in from the server itself:

  1. Call tools/list or a tool without a token. The server answers 401 with a WWW-Authenticate: Bearer header whose resource_metadata names the protected-resource metadata.
  2. Read that metadata: https://mcp.g2x.com/.well-known/oauth-protected-resource/mcp, or …/mcp/research for the research endpoint. Its authorization_servers names the authorization server.
  3. Read the authorization server's metadata and follow its authorization-code flow with PKCE, using S256.
  4. Send the access token in the Authorization header on every request.

Discover the authorization server this way each time instead of hardcoding its address.

Register your client

Register with dynamic client registration (RFC 7591) at the registration_endpoint the authorization server's metadata lists. Redirect URIs must use https, or http on the loopback address. Register once and reuse the client ID: registration is rate limited.

Scopes and tokens

Request the openid and offline_access scopes, and use the refresh token to stay signed in. Keep tokens in your client's credential storage, never in a URL, a prompt or a log.

What a signed-in client can do

Every call runs as the signed-in G2X account. It sees what that account sees in G2X, and it can change only what that account can change.

PreviousBuild with the G2X MCP serverNextTools and results

On this page

  • How sign-in works
  • Register your client
  • Scopes and tokens
  • What a signed-in client can do

Share this guide