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
For a confidential machine-to-machine client (no user, no browser redirect), use `MCP::Client::OAuth::ClientCredentialsProvider` instead of `Provider`.
2023
+
The transport discovers the authorization server the same way, then exchanges the OAuth 2.1 `client_credentials` grant (RFC 6749 Section 4.4) at
2024
+
the token endpoint. There is no authorization request, PKCE, or `offline_access`, because the grant does not issue a refresh token.
# token_endpoint_auth_method: "client_secret_basic" (default) or "client_secret_post"
2031
+
# scope: "mcp:read mcp:write" (optional; used when the server does not advertise scopes)
2032
+
)
2033
+
2034
+
transport =MCP::Client::HTTP.new(url:"https://api.example.com/mcp", oauth: provider)
2035
+
```
2036
+
2037
+
Keyword arguments:
2038
+
2039
+
-`client_id`, `client_secret`: Required. The grant is for confidential clients, so a credential is mandatory.
2040
+
-`token_endpoint_auth_method`: `"client_secret_basic"` (default) or `"client_secret_post"`. `"none"` is rejected with `ClientCredentialsProvider::InvalidCredentialsError`.
2041
+
-`scope`, `storage`: Optional, same meaning as on `Provider`.
2042
+
2020
2043
##### Communication Security
2021
2044
2022
2045
When `oauth:` is set, the MCP transport URL and every OAuth-facing URL (PRM, Authorization Server metadata, `authorization_endpoint`, `token_endpoint`, `registration_endpoint`,
0 commit comments