-
Notifications
You must be signed in to change notification settings - Fork 13
OAuth
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.
OAuth works in the following scenarios:
- Frontend: HTTP with Backend: HTTP
- Frontend: Stdio with Backend: HTTP
When using an HTTP frontend, the OAuth flow works as follows:
-
If the MCP server returns a 401 (Unauthorized) error, Minibridge forwards this error to the client.
-
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
-
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.
When using a Stdio frontend, Minibridge manages the OAuth process automatically:
- Minibridge registers a client using the
/registerendpoint - It opens the user's browser to access the
/authorizeendpoint - After user authorization, it obtains a token from the
/tokenendpoint - This token is then sent to the backend, which forwards it to the MCP server via the
Authorizationheader
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.
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.