> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcollate.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OAuth 2.0 Authentication for MCP Server

> Connect to Collate's MCP Server using OAuth 2.0 with your existing SSO provider. No Personal Access Tokens required.

# 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?

|                | Personal Access Token (PAT)              | OAuth 2.0                             |
| -------------- | ---------------------------------------- | ------------------------------------- |
| **Setup**      | Generate token, copy into config         | Enter server URL, sign in via browser |
| **Security**   | Token stored in plain text config files  | No secrets stored locally             |
| **Expiration** | Manual rotation when token expires       | Tokens refresh automatically          |
| **Access**     | Must generate and manage tokens per user | Uses your existing Collate login      |

<Note>
  **Note**: OAuth 2.0 is the **recommended** way to connect MCP clients. PAT-based authentication remains supported for backward compatibility and environments where browser-based login is not available.
</Note>

## 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. **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, Collate redirects back to the client with an authorization code.
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

| Endpoint                                      | Purpose                                                                                                                                                                                |
| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /.well-known/oauth-authorization-server` | OAuth 2.0 authorization server metadata (RFC 8414)                                                                                                                                     |
| `GET /.well-known/openid-configuration`       | OAuth metadata compatibility alias — serves the same RFC 8414 metadata as above for clients that only check this OIDC-conventional path (not a true OpenID Connect discovery document) |
| `POST /mcp/register`                          | Dynamic client registration                                                                                                                                                            |

## 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.

<Columns cols={2} className="product-cards">
  <Card icon="https://mintcdn.com/collatedocs/-Cx6rTOteG4I_5vO/public/images/icons/google.svg?fit=max&auto=format&n=-Cx6rTOteG4I_5vO&q=85&s=d8420178fad5800b0b06406057db75b0" title="Google SSO" href="/ai-2-0/how-to-guides/sso/google" horizontal width="36" height="36" data-path="public/images/icons/google.svg">
    Sign in with your Google Workspace account.
  </Card>

  <Card icon="https://mintcdn.com/collatedocs/eaXUDo1kCWyJG_MC/public/images/icons/azure.svg?fit=max&auto=format&n=eaXUDo1kCWyJG_MC&q=85&s=5a6f90d3e882c40d4e39565f7d23b3d0" title="Azure AD SSO" href="/ai-2-0/how-to-guides/sso/azure" horizontal width="36" height="36" data-path="public/images/icons/azure.svg">
    Sign in with your Microsoft / Azure AD account.
  </Card>

  <Card icon="https://mintcdn.com/collatedocs/-Cx6rTOteG4I_5vO/public/images/icons/okta.svg?fit=max&auto=format&n=-Cx6rTOteG4I_5vO&q=85&s=926a4c64d00be46801ae08c3c6add440" title="Okta SSO" href="/ai-2-0/how-to-guides/sso/okta" horizontal width="36" height="36" data-path="public/images/icons/okta.svg">
    Sign in with your Okta account.
  </Card>

  <Card icon="https://mintcdn.com/collatedocs/yvgGxaeRR5RwtQo6/public/images/icons/auth0.svg?fit=max&auto=format&n=yvgGxaeRR5RwtQo6&q=85&s=448d75b24161d109766318b2d011ddd7" title="Auth0 SSO" href="/ai-2-0/how-to-guides/sso/auth0" horizontal width="36" height="36" data-path="public/images/icons/auth0.svg">
    Sign in with your Auth0 account.
  </Card>

  <Card icon="https://mintcdn.com/collatedocs/eaXUDo1kCWyJG_MC/public/images/icons/amazon-cognito.svg?fit=max&auto=format&n=eaXUDo1kCWyJG_MC&q=85&s=23f52f76ffb2d1782e5bb939c124a873" title="Amazon Cognito" href="/ai-2-0/how-to-guides/sso/amazon-cognito" horizontal width="36" height="36" data-path="public/images/icons/amazon-cognito.svg">
    Sign in with Amazon Cognito.
  </Card>

  <Card icon="https://mintcdn.com/collatedocs/-Cx6rTOteG4I_5vO/public/images/icons/oidc.svg?fit=max&auto=format&n=-Cx6rTOteG4I_5vO&q=85&s=a76302e1560cf69d3de20e02e438a4fd" title="Custom OIDC" href="/ai-2-0/how-to-guides/sso/custom-oidc" horizontal width="36" height="36" data-path="public/images/icons/oidc.svg">
    Sign in with any OIDC-compatible provider.
  </Card>

  <Card icon="https://mintcdn.com/collatedocs/Q1OIJhF378waLn75/public/images/icons/saml.svg?fit=max&auto=format&n=Q1OIJhF378waLn75&q=85&s=6494e62c679d1c74801b652f06aa689f" title="SAML" href="/ai-2-0/how-to-guides/sso/saml" horizontal width="36" height="36" data-path="public/images/icons/saml.svg">
    Sign in with your SAML identity provider.
  </Card>

  <Card icon="https://mintcdn.com/collatedocs/-Cx6rTOteG4I_5vO/public/images/icons/ldap.svg?fit=max&auto=format&n=-Cx6rTOteG4I_5vO&q=85&s=5529404212cf69d32ff2055a7adc734d" title="LDAP" href="/ai-2-0/how-to-guides/sso/ldap" horizontal width="36" height="36" data-path="public/images/icons/ldap.svg">
    Sign in with your LDAP / Active Directory credentials.
  </Card>
</Columns>

If your instance uses **basic authentication** (username and password), you'll see a login form for entering your Collate credentials directly.

## 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. Go to the **SSO** configuration section.
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](/ai-2-0/how-to-guides/sso).

## Token Lifetimes

OAuth tokens are handled entirely by your MCP client with no manual management needed.

| Token type             | Lifetime   | Notes                                                                                   |
| ---------------------- | ---------- | --------------------------------------------------------------------------------------- |
| **Access token**       | 10 minutes | Short-lived to limit exposure. Automatically refreshed by the client                    |
| **Authorization code** | 10 minutes | Single-use. Expires if the login flow stalls                                            |
| **Refresh token**      | 30 days    | Grants new access tokens without re-authentication. Expires after 30 days of inactivity |

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.

## Rate Limits

The MCP OAuth endpoints are rate-limited per IP address to prevent abuse:

| Endpoint                              | Limit                  |
| ------------------------------------- | ---------------------- |
| `/mcp/register` (client registration) | 10 requests per hour   |
| `/mcp/token` (token requests)         | 30 requests per minute |

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.

   <img src="https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-application.png?fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=b1324056469353e563e2be0d29bbcee8" alt="MCP Server application in Settings > Applications" data-og-width="3008" width="3008" data-og-height="1370" height="1370" data-path="public/images/ai-2.0/mcp/mcp-application.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-application.png?w=280&fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=6d2d68c1fa730ce0164d3be55500d7e8 280w, https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-application.png?w=560&fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=8b355587f48f542fef655ca0111fa6ff 560w, https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-application.png?w=840&fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=b2306666542c41319d4f2e482be94135 840w, https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-application.png?w=1100&fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=4da0c66f756744c88024fa5822a8e405 1100w, https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-application.png?w=1650&fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=2c7324d766b7c699932391577b30b8a6 1650w, https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-application.png?w=2500&fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=9b7ca3a2c359cdc8f4bf22f10927202e 2500w" />

3. In the **Configuration** tab, add, edit, or remove entries under **Allowed Origins**.

   <img src="https://mintcdn.com/collatedocs/ZqXWD0tEXLu1jde7/public/images/ai-2.0/mcp/mcp-allowed-origins-configuration.png?fit=max&auto=format&n=ZqXWD0tEXLu1jde7&q=85&s=3aafbb831b4cf129d3c7cfe1fc206c00" alt="Allowed Origins configuration for the MCP Server application" width="2960" height="1472" data-path="public/images/ai-2.0/mcp/mcp-allowed-origins-configuration.png" />

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.

## Security

Collate's MCP OAuth implementation follows industry-standard security practices:

* **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:

<CardGroup cols={2}>
  <Card title="Claude Desktop" href="/ai-2-0/how-to-guides/mcp/claude">
    Connect via Anthropic's AI assistant.
  </Card>

  <Card title="Cursor" href="/ai-2-0/how-to-guides/mcp/cursor">
    Connect via Cursor IDE.
  </Card>

  <Card title="VS Code" href="/ai-2-0/how-to-guides/mcp/vscode">
    Connect via Visual Studio Code.
  </Card>

  <Card title="Claude Code" href="/ai-2-0/how-to-guides/mcp/claude-code">
    Connect via Claude Code CLI.
  </Card>

  <Card title="Goose" href="/ai-2-0/how-to-guides/mcp/goose">
    Connect via Block's open-source AI agent.
  </Card>
</CardGroup>
