Skip to content

Commit b3c6dc4

Browse files
committed
merge with recent branch
1 parent e2b27ff commit b3c6dc4

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ from urllib.parse import parse_qs, urlparse
16031603
from pydantic import AnyUrl
16041604

16051605
from mcp import ClientSession
1606-
from mcp.client.auth import OAuthClientProvider, TokenExchangeProvider, TokenStorage
1606+
from mcp.client.auth import OAuthClientProvider, TokenStorage
16071607
from mcp.client.streamable_http import streamablehttp_client
16081608
from mcp.shared.auth import OAuthClientInformationFull, OAuthClientMetadata, OAuthToken
16091609

@@ -1658,25 +1658,6 @@ async def main():
16581658
callback_handler=handle_callback,
16591659
)
16601660

1661-
# For machine-to-machine scenarios, use ClientCredentialsProvider
1662-
# instead of OAuthClientProvider.
1663-
1664-
# If you already have a user token from another provider, you can
1665-
# exchange it for an MCP token using the token_exchange grant
1666-
# implemented by TokenExchangeProvider.
1667-
token_exchange_auth = TokenExchangeProvider(
1668-
server_url="https://api.example.com",
1669-
client_metadata=OAuthClientMetadata(
1670-
client_name="My Client",
1671-
redirect_uris=["http://localhost:3000/callback"],
1672-
grant_types=["client_credentials", "token_exchange"],
1673-
response_types=["code"],
1674-
),
1675-
storage=CustomTokenStorage(),
1676-
subject_token_supplier=lambda: "user_token",
1677-
)
1678-
1679-
# Use with streamable HTTP client
16801661
async with streamablehttp_client("http://localhost:8001/mcp", auth=oauth_auth) as (read, write, _):
16811662
async with ClientSession(read, write) as session:
16821663
await session.initialize()

0 commit comments

Comments
 (0)