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
Copy file name to clipboardExpand all lines: README.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -814,7 +814,11 @@ async def main():
814
814
The SDK includes [authorization support](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization) for connecting to protected MCP servers:
815
815
816
816
```python
817
-
from mcp.client.auth import OAuthClientProvider, TokenStorage
817
+
from mcp.client.auth import (
818
+
OAuthClientProvider,
819
+
TokenExchangeProvider,
820
+
TokenStorage,
821
+
)
818
822
from mcp.client.session import ClientSession
819
823
from mcp.client.streamable_http import streamablehttp_client
820
824
from mcp.shared.auth import OAuthClientInformationFull, OAuthClientMetadata, OAuthToken
@@ -854,6 +858,20 @@ async def main():
854
858
# For machine-to-machine scenarios, use ClientCredentialsProvider
855
859
# instead of OAuthClientProvider.
856
860
861
+
# If you already have a user token from another provider,
862
+
# you can exchange it for an MCP token using TokenExchangeProvider.
0 commit comments