You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to manually set client_id client_secret? #1521
MCP clients and authorization servers SHOULD support the OAuth 2.0 Dynamic Client Registration Protocol RFC7591 to allow MCP clients to obtain OAuth client IDs without user interaction.
Your snippet is the supported way to do this, not a workaround: OAuthClientProvider has no client_id/client_secret constructor arguments — on the first request it loads client_info from your TokenStorage, and only falls back to dynamic registration when the storage has none. So the pre-registered credentials belong in the storage as an OAuthClientInformationFull, exactly as you have it; if calling set_client_info up front reads oddly, have your storage's constructor take the client info (or persist it once) so it's simply there when the provider asks. The Token storage section of the OAuth clients guide covers this. If you ever want the client-credentials grant (no browser sign-in) instead, ClientCredentialsOAuthProvider takes client_id/client_secret directly — see Machine to machine.
Closing this as part of a wider backlog cleanup around the v2 release. Feel free to reopen if this is still relevant.
Activity
maxisbey commentedon Jul 24, 2026
Your snippet is the supported way to do this, not a workaround:
OAuthClientProviderhas noclient_id/client_secretconstructor arguments — on the first request it loadsclient_infofrom yourTokenStorage, and only falls back to dynamic registration when the storage has none. So the pre-registered credentials belong in the storage as anOAuthClientInformationFull, exactly as you have it; if callingset_client_infoup front reads oddly, have your storage's constructor take the client info (or persist it once) so it's simply there when the provider asks. The Token storage section of the OAuth clients guide covers this. If you ever want the client-credentials grant (no browser sign-in) instead,ClientCredentialsOAuthProvidertakesclient_id/client_secretdirectly — see Machine to machine.Closing this as part of a wider backlog cleanup around the v2 release. Feel free to reopen if this is still relevant.
AI Disclaimer