Title: Support client_credentials flow with JWT and Basic auth by pcarleton · Pull Request #1663 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Support client_credentials flow with JWT and Basic auth by pcarleton · Pull Request #1663 · modelcontextprotocol/python-sdk
X Title: Support client_credentials flow with JWT and Basic auth by pcarleton · Pull Request #1663 · modelcontextprotocol/python-sdk
Description: Summary Implements SEP-1046 OAuth client_credentials flow support with simplified providers for machine-to-machine authentication. New OAuth Providers ClientCredentialsOAuthProvider: For client_credentials grant with client_id + client_secret Supports client_secret_basic (default) and client_secret_post auth methods Sets client_info directly, bypassing dynamic client registration PrivateKeyJWTOAuthProvider: For client_credentials grant with private_key_jwt authentication (RFC 7523 Section 2.2) Takes an assertion_provider callback that receives the audience (authorization server's issuer identifier per RFC 7523bis) and returns a JWT Designed for workload identity federation (GCP, AWS IAM, Azure AD) SignedJWTParameters: Helper class for SDK-signed JWT assertions create_assertion_provider() returns a callback for use with PrivateKeyJWTOAuthProvider static_assertion_provider(): Helper for pre-built JWTs that don't need the audience parameter Deprecation RFC7523OAuthClientProvider is now deprecated with a DeprecationWarning. The original implementation incorrectly used RFC 7523 Section 2.1 (jwt-bearer authorization grant where the JWT itself is the authorization) instead of the intended Section 2.2 (private_key_jwt client authentication with grant_type=client_credentials). Use ClientCredentialsOAuthProvider or PrivateKeyJWTOAuthProvider instead. Example Usage # Simple client credentials with client_id + secret provider = ClientCredentialsOAuthProvider( server_url="https://api.example.com", storage=my_token_storage, client_id="my-client-id", client_secret="my-client-secret", ) # Private key JWT with workload identity federation async def get_workload_identity_token(audience: str) -> str: return await fetch_token_from_identity_provider(audience=audience) provider = PrivateKeyJWTOAuthProvider( server_url="https://api.example.com", storage=my_token_storage, client_id="my-client-id", assertion_provider=get_workload_identity_token, ) # Private key JWT with SDK-signed assertions jwt_params = SignedJWTParameters( issuer="my-client-id", subject="my-client-id", signing_key=private_key_pem, ) provider = PrivateKeyJWTOAuthProvider( server_url="https://api.example.com", storage=my_token_storage, client_id="my-client-id", assertion_provider=jwt_params.create_assertion_provider(), ) Testing Unit tests with 100% coverage for new providers Conformance tests pending
Open Graph Description: Summary Implements SEP-1046 OAuth client_credentials flow support with simplified providers for machine-to-machine authentication. New OAuth Providers ClientCredentialsOAuthProvider: For client_c...
X Description: Summary Implements SEP-1046 OAuth client_credentials flow support with simplified providers for machine-to-machine authentication. New OAuth Providers ClientCredentialsOAuthProvider: For client_c...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/1663
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:cfef77fa-285e-7cf1-23ec-4b2e9bbf56fc |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8B02:A194E:2868FA:38D7AC:696E51D4 |
| html-safe-nonce | d6c395b277a6dc5cc82a32d51ed2d9e845712bed4617d13d8a9768c6ba8237ba |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjAyOkExOTRFOjI4NjhGQTozOEQ3QUM6Njk2RTUxRDQiLCJ2aXNpdG9yX2lkIjoiNDUxNzYxODExNzY2NTMwNTE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0bf391a4bd642e8b60be04738fbdadaa3a527d5bfa308aef69e2770bdaed315e |
| hovercard-subject-tag | pull_request:3041730247 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/1663/files |
| twitter:image | https://avatars.githubusercontent.com/u/704663?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/704663?s=400&v=4 |
| og:image:alt | Summary Implements SEP-1046 OAuth client_credentials flow support with simplified providers for machine-to-machine authentication. New OAuth Providers ClientCredentialsOAuthProvider: For client_c... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | fd6f183b765d548d18ed5f3a1ce2c0e2a4ddbde2c74596c9d55c1a08b3e5572a |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a52ed9988fadfee5477eba0f6835cc823d7d8b33 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width