ConfigurationMCP

MCP OAuth authentication

Connect to MCP servers that require user-delegated access with OAuth 2.1. Bob manages the authentication and token refresh process so you do not need to manage tokens manually.

For general MCP configuration, see Using MCP in Bob.

Overview

You can connect Bob to Model Context Protocol (MCP) servers that act on your behalf, such as accessing your code repositories, cloud services, or internal tooling. These servers use OAuth 2.1 so you can sign in and approve access.

Bob manages the authentication flow directly. When you configure a server that requires OAuth, Bob displays an authentication request in the MCP settings. You can click the button to open your identity provider in a browser window, complete your sign-in, and approve permissions. Bob stores and refreshes your access tokens without requiring you to handle credentials manually.

Use OAuth when:

  • You need to access resources associated with your personal or enterprise user account
  • The server uses short-lived tokens that require automatic token refresh
  • You want to keep static credentials and secrets out of your configuration files

When you already have a static API token or personal access token that does not expire, you can use a Bearer token in headers instead.

How the authentication flow works

  1. You add the remote MCP server URL to your configuration file without headers or env credentials.
  2. When Bob connects to the server, Bob detects the OAuth requirements.
  3. Bob opens a browser sign-in window where you review requested permissions and approve access.
  4. Bob receives the authorization tokens and stores them securely across your sessions.
  5. Bob automatically refreshes tokens before they expire so you can work without interruption.
Bob IDE                     Authorization Server              MCP Server
   |                                |                               |
   |-- connect to server ---------->|                               |
   |<-- OAuth metadata (401) -------|                               |
   |-- open auth prompt ----------->|                               |
   |   (user signs in & consents)   |                               |
   |<-- authorization code ---------|                               |
   |-- exchange for tokens -------->|                               |
   |<-- access + refresh tokens ----|                               |
   |-- authenticated requests --------------------------------->    |
   |   (auto-refresh when needed)                                   |

Configure an OAuth-enabled server

You can configure your MCP servers in either your global configuration (~/.bob/settings/mcp.json) or your project configuration (.bob/mcp.json).

Minimal configuration (automatic discovery)

When your MCP server provides automatic OAuth metadata discovery, you only need to specify the url:

{
  "mcpServers": {
    "my-oauth-server": {
      "url": "https://mcp.example.com/mcp"
    }
  }
}

Bob detects the OAuth requirements upon connection and guides you through the browser sign-in process.

Custom OAuth parameters

When your identity provider requires a pre-registered client ID, custom scopes, or a client secret, configure the oauth object:

{
  "mcpServers": {
    "my-oauth-server": {
      "url": "https://mcp.example.com/mcp",
      "oauth": {
        "enabled": true,
        "clientId": "your-client-id-from-idp",
        "clientSecret": "your-client-secret-if-required",
        "scope": "mcp:connect read:data"
      }
    }
  }
}

Configuration properties

PropertyTypeDescription
urlstringRemote MCP endpoint URL (required).
oauth.enabledbooleanSet to false to disable OAuth, or true to require OAuth. Enabled by default when no Authorization header is present.
oauth.clientIdstringPre-registered OAuth client ID issued by your identity provider.
oauth.clientSecretstringOAuth client secret, if your authorization server requires one for confidential clients.
oauth.scopestringSpace-separated list of OAuth scopes you want to request.
Warning:

Adding a static Authorization header to an MCP server configuration turns off OAuth. When an Authorization header is present, Bob does not initiate the OAuth flow. When OAuth is active, Bob removes static Authorization headers before sending requests. Use only one authentication method per server.

Register Bob with your identity provider

When your identity provider (IdP) requires you to register Bob as a client application before you connect, use the following application settings:

SettingValue
Application or client typePublic, Native, or Loopback (Authorization Code with PKCE)
Redirect URIhttp://127.0.0.1:33418/callback
Additional redirect URIshttp://127.0.0.1:33419/callback through http://127.0.0.1:33427/callback (recommended if port 33418 is in use)
Grant typesAuthorization Code (authorization_code) and Refresh Token (refresh_token)
ScopesScopes specified in your MCP server documentation

Copy the issued client ID into oauth.clientId in your configuration file.

Authenticate when prompted

When you connect to an OAuth-enabled server for the first time:

  1. Review the authentication prompt that opens in the IDE or your browser.
  2. Verify the permissions that the server requests.
  3. Sign in to your account and approve access.
  4. Bob saves your credentials and connects to the server tools.

View and manage authentication status

You can check or change authentication for an MCP server:

  1. Click the icon in the Bob panel.
  2. Select the MCP tab.
  3. Locate the server in the list.

Connected servers display a status indicator. When authentication expires or permissions change, you can update your connection.

To re-authenticate: Click next to the server name to restart your connection and sign in again.

Troubleshooting

The authentication prompt does not open

  • Verify that you did not mark the server as disabled in your configuration.
  • Check that your configuration file does not include a static Authorization header in headers.
  • Restart the server from the MCP settings tab.
  • Check that your browser or firewall does not block local loopback connections on 127.0.0.1.

The identity provider returns a redirect URI mismatch error

  • Verify that your identity provider client registration includes http://127.0.0.1:33418/callback.
  • If port 33418 is busy, register additional ports from 33419 through 33427.

Authentication succeeds but the server fails to connect

  • Verify that the server URL is correct and accessible from your network.
  • Check that you approved all required scopes during the sign-in step.
  • Review server logs or documentation for prerequisite user roles or permissions.

Tokens expire frequently and you must re-authenticate

  • Confirm that your authorization server issues refresh tokens.
  • Check that your system clock is synchronized to prevent premature token expiration.

You want to sign out or switch accounts

Restarting the server does not clear OAuth credentials. To sign out or switch accounts, use Reset auth from the MCP settings tab. This clears the stored tokens and triggers a fresh authentication prompt on the next connection.

How is this topic?