Skip to main content

OAuth 2.0 Authentication for MCP Server

Collate’s MCP Server supports OAuth 2.0 authentication, allowing you to connect AI assistants like Claude, Cursor, and VS Code directly using your existing Collate login. This is the same way you sign in to the Collate UI. No need to generate, copy, or rotate Personal Access Tokens.

Why OAuth 2.0?

Note: OAuth 2.0 is recommended for interactive clients (Claude Desktop, Cursor, VS Code, and similar tools a person signs into) because it removes token management for the human user. It requires a one-time browser login and cannot complete without user interaction, so it doesn’t work for headless or unattended processes. For an automated agent or long-running unattended process, use a Bot’s JWT Token instead (see Bot JWT Token and How to Set Up Bots). Collate’s MCP OAuth server supports only the authorization_code and refresh_token grants; it has no client_credentials (machine-to-machine) grant.

How It Works

Connecting via OAuth is simple:
  1. Add your Collate MCP Server URL in your AI client, for example https://your-collate-instance.com/mcp.
  2. Sign in when the browser window opens, using your usual Collate credentials.
  3. Approve the connection (SSO and SAML only): after you sign in, Collate shows an Authorize Access page that names the MCP client, your account, and the address you will be sent to. Click Approve to continue, or click Deny to cancel.
  4. Start using the connection: tokens are managed automatically in the background.
That’s it. Your MCP client handles the rest, including refreshing your session when needed.

How the Connection Works (Under the Hood)

Collate’s MCP OAuth implementation uses OAuth 2.0 Dynamic Client Registration (RFC 7591), so MCP clients connect without any manual app setup:
  1. The MCP client fetches Collate’s OAuth discovery document at /.well-known/oauth-authorization-server to learn the authorization, token, and registration endpoints.
  2. The client automatically registers itself by posting its metadata to the registration endpoint. Collate issues a client_id in response — no admin action is required.
  3. The client initiates an Authorization Code flow with PKCE (SHA-256), opening your browser to sign in via your configured SSO provider or basic auth.
  4. After you sign in through SSO or SAML, Collate asks you to approve the client on a consent page. Approve returns an authorization code to the client. Deny sends the client an access_denied error. With basic auth or LDAP, the login form names the client and where the code is sent. Signing in is the approval, so there is no separate page.
  5. The client exchanges the code for an access token and a refresh token.
  6. All subsequent MCP tool calls include the access token. When it expires, the client uses the refresh token to get a new one silently.

Discovery Endpoints

Approving a Client (SSO and SAML)

When you connect through an SSO provider or SAML, Collate shows an Authorize Access page after you sign in. The page reads “<client name> is requesting access to Collate as <your user name>” and shows where you will be sent next.
  • Client: The name the MCP client registered with.
  • User: The Collate account you signed in as.
  • Redirect address: The scheme and host that receive the authorization code, for example http://localhost:33418.
  • Approve: Collate issues the authorization code and returns you to the client.
  • Deny: Collate returns access_denied to the client and issues no code.
Deny the request if you did not start the connection or do not recognize the address. Each approval can be used once. If the page reports that an approval is no longer valid, restart the connection from your MCP client. Basic authentication and LDAP don’t show this page. Their login form names the client and the redirect address before you enter your password.

Supported Authentication Methods

The MCP Server inherits the authentication method configured for your Collate instance. Whatever SSO provider your organization uses to sign in to Collate will also be used for MCP connections.

Google SSO

Sign in with your Google Workspace account.

Azure AD SSO

Sign in with your Microsoft / Azure AD account.

Okta SSO

Sign in with your Okta account.

Auth0 SSO

Sign in with your Auth0 account.

Amazon Cognito

Sign in with Amazon Cognito.

Custom OIDC

Sign in with any OIDC-compatible provider.

SAML

Sign in with your SAML identity provider.

LDAP

Sign in with your LDAP / Active Directory credentials.
If your instance uses basic authentication (username and password), you’ll see a login form for entering your Collate credentials directly.
Session token expiry: If a client authenticates through this login form (or LDAP/SAML) rather than through the OAuth flow described above, the resulting access token expires after 1 hour by default. An admin can change this under Settings > Platform Settings > Login Configuration for basic auth and LDAP, or through the Token Validity (seconds) field in the SAML Security Configuration under Settings > Single Sign-On for SAML. Login also issues a rotating refresh token, so a client that implements the refresh call can renew access silently without a human signing in again. The refresh token itself expires after 30 days of inactivity for basic auth and SAML, or 24 hours for LDAP, after which a human must sign in again. For a process that can’t implement the refresh flow, or needs to run unattended past that window, use a Bot’s JWT Token instead.

Changing Your Authentication Method

The MCP Server automatically uses the same authentication method configured for your Collate instance. To change how users authenticate:
  1. Navigate to Settings in your Collate instance.
  2. Click Single Sign-On.
  3. Update the authentication provider, for example switching from basic auth to Google SSO.
Once updated, all MCP client connections will use the new authentication method with no changes needed on the client side. For detailed instructions on configuring each SSO provider, see the SSO Setup Guide.

Token Lifetimes

OAuth tokens are handled entirely by your MCP client with no manual management needed. Re-authentication is only required when the refresh token expires (30-day inactivity window). To revoke access for an MCP client, an administrator can manage active sessions from the Collate admin settings. Revoking an access token or its refresh token prevents the stored access token from being used again. A revoked client must complete a new sign-in and consent flow.

Request and Redirect Limits

The MCP server enforces the following limits: Requests that exceed these limits are rejected before they reach an MCP tool.

Rate Limits

The MCP OAuth endpoints are rate-limited per IP address to prevent abuse: These limits are per-server-instance. In clustered deployments, the effective limit is multiplied by the number of instances.

Allowed Origins (CORS)

By default, the MCP Server allows CORS requests only from a small set of local development origins (http://localhost:3000, http://localhost:8585, http://localhost:9090) — it does not allow all origins. Administrators can update this allowlist from the MCP Server application settings:
  1. Click the Profile icon and navigate to Settings > Applications.
  2. Click the MCP Server application. MCP Server application in Settings > Applications
  3. In the Configuration tab, add, edit, or remove entries under Allowed Origins. Allowed Origins configuration for the MCP Server application
  4. Click Save.
Only requests whose Origin header exactly matches an entry in the allowlist receive a valid Access-Control-Allow-Origin response header — there is no wildcard or prefix matching. This is relevant for browser-based MCP clients or custom integrations that call the MCP endpoint directly from a web page.

Response Size Limit

The MCP Server limits the size of each tool response. Tools return fewer items to stay under the limit. Administrators can change it from the MCP Server application settings:
  1. Click the Profile icon and navigate to Settings > Applications.
  2. Click the MCP Server application.
  3. In the Configuration tab, set Max Response Characters. Max Response Characters field in the MCP Server Configuration tab
  4. Click Save.
The default is 100,000 characters, about 25,000 tokens, and the minimum is 25,000. Lower the value for clients with small context windows, and raise it for clients with large ones. A saved change applies immediately on the server that handled the save. Other servers pick it up after a restart.

Security

Collate’s MCP OAuth implementation follows industry-standard security practices:
  • Explicit approval: With SSO and SAML, Collate issues no authorization code until you click Approve on the consent page.
  • PKCE (Proof Key for Code Exchange): Protects the authorization flow against interception attacks, even on desktop and CLI clients.
  • Encrypted token storage: All tokens are encrypted at rest in the Collate database.
  • Short-lived access tokens: Access tokens expire quickly, limiting exposure if compromised.
  • Automatic token refresh: Clients seamlessly refresh tokens without user interaction.
  • Rate limiting: Built-in protection against brute-force attacks and abuse.
  • No secrets in config files: Unlike PAT-based auth, OAuth doesn’t require storing any secrets on your local machine.

Supported MCP Clients

Set up OAuth authentication with your preferred MCP client:

Claude Desktop

Connect via Anthropic’s AI assistant.

Cursor

Connect via Cursor IDE.

VS Code

Connect via Visual Studio Code.

Claude Code

Connect via Claude Code CLI.

Goose

Connect via Block’s open-source AI agent.