Skip to content
primalmotion edited this page May 13, 2025 · 3 revisions

Minibridge provides OAuth 2.0 integration for MCP servers requiring authentication. The OAuth implementation varies based on the frontend configuration. Note that OAuth support is not available when the MCP server uses stdio on the backend.

Note

This OAuth integration feature is relatively new and may not work in all OAuth scenarios due to certain assumptions in the current implementation. We are actively working to improve compatibility and remove these limitations. If you encounter an MCP server for which Minibridge cannot successfully perform OAuth authentication, please open an issue on our GitHub repository with details about your configuration and the problems you experienced.

Supported Configurations

OAuth works in the following scenarios:

  • Frontend: HTTP with Backend: HTTP
  • Frontend: Stdio with Backend: HTTP

HTTP Frontend (SSE and Streamable API)

When using an HTTP frontend, the OAuth flow works as follows:

  1. If the MCP server returns a 401 (Unauthorized) error, Minibridge forwards this error to the client.

  2. The client can then initiate the OAuth authentication process by accessing the OAuth endpoints exposed by the Minibridge frontend:

    • /register
    • /authorize
    • /token
    • /.well-known/oauth-authorization-server
  3. Minibridge forwards these requests to the backend, which then forwards them to the MCP server.

In this configuration, the client application is responsible for handling the complete OAuth authentication flow.

Stdio Frontend

When using a Stdio frontend, Minibridge manages the OAuth process automatically:

  1. Minibridge registers a client using the /register endpoint
  2. It opens the user's browser to access the /authorize endpoint
  3. After user authorization, it obtains a token from the /token endpoint
  4. This token is then sent to the backend, which forwards it to the MCP server via the Authorization header

Note

If you use authentication flags on the frontend (--agent-token, or --agent-user and --agent-pass), Minibridge will not attempt to perform the OAuth authentication flow.

Token Storage

Authentication tokens obtained through the OAuth process are securely stored in the operating system's keychain for future use. Tokens are stored using the MCP server as the key, allowing Minibridge to maintain separate tokens for multiple MCP servers simultaneously.

Clone this wiki locally