Skip to content

OAuth for MCP servers

MCP servers that sit in front of a SaaS product (GitHub, HubSpot, Slack, Jira, Google Drive) need per-user OAuth: a tool call must act as this user, with the scopes they consented to, not with one shared service credential. Handing every agent and chat client the provider’s raw access token is how those tokens end up in logs, repositories and prompt history.

The Brutor OAuth proxy runs in the Core Proxy (:8100) and is built on one rule:

The upstream access token never reaches the client. The client completes the OAuth flow through the gateway. The gateway exchanges the code with the identity provider, encrypts the provider’s access and refresh tokens with ENCRYPTION_KEY, stores them, and gives the client a gateway-minted MCP JWT instead. On every MCP call the gateway looks up the stored token for that user and server and puts it on the upstream request.

/v1/proxy/oauth/{mcp_server_id}/{idp_server_id}/... ← every OAuth hop for one MCP server + IdP pair
/v1/proxy/mcp/{mcp_server_id} ← the MCP calls, with the MCP JWT attached

All configuration is written through the Control Plane (Admin UI, :5050); the Core Proxy only reads it.

Object What it is Admin UI location Example
Identity Provider The authorization server: issuer plus authorize, token and userinfo endpoints AI Estate → Resources → Identity Providers idp-system-hubspot-default, issuer https://mcp.hubspot.com
MCP server with auth_type: "oauth" The upstream MCP server, linked to the IdP through idp_id AI Estate → Resources → MCP Servers → Configuration → MCP Servers mcp-system-hubspot-default, https://mcp.hubspot.com
OAuth App Client The client registration you created at the provider (client ID, secret, redirect URI, scopes) MCP Servers → Configuration → MCP Server Access → OAuth App Clients oauth-system-hubspot-default, client type public_with_secret
MCP Server Access Configuration Binds the MCP server to the OAuth App Client and to resource groups MCP Server Access → MCP Server Access Configurations sc-system-hubspot-default

A fresh install seeds all four for GitHub, HubSpot and Slack, with placeholder client IDs (YOUR_HUBSPOT_OAUTH_CLIENT_ID) for you to replace with your own app’s credentials. The HubSpot access configuration is seeded disabled.

How the OAuth proxy works

Token custody, the MCP JWT, injection, refresh and what the gateway logs. Read it.

Configure an OAuth-backed MCP server

Identity Provider, MCP server, OAuth App Client and access configuration, in the Admin UI and through the admin API. Set it up.

Authorize from your own agent

The full flow from code: discovery, consent, token exchange, MCP calls, refresh and revoke. Build it.

In the User Portal

What end users see: Connect & Authorize, the popup, Re-authorize. See it.

MCP authorization spec support

Protected-resource metadata, OIDC discovery, dynamic client registration and CIMD clients. Details.

Managing stored tokens

The OAuth Tokens view, diagnostic statuses and revocation. Manage them.

OAuth behind a Virtual MCP

What happens to OAuth-backed members of a Virtual MCP server. Read the constraint.

Troubleshooting

Every error the OAuth proxy returns, and what to do about it. Fix it.