-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy path__init__.py
More file actions
35 lines (30 loc) · 1.15 KB
/
__init__.py
File metadata and controls
35 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Client-side authentication for MCP HTTP transports.
Two `httpx.Auth` implementations are provided:
- `BearerAuth` — minimal two-method provider (`token()` + optional
`on_unauthorized()`) for API keys, gateway-managed tokens, service accounts,
or any scenario where the token comes from an external pipeline.
- `OAuthClientProvider` — full OAuth 2.1 authorization-code flow with PKCE,
Protected Resource Metadata discovery (RFC 9728), dynamic client registration,
and automatic token refresh.
Both are `httpx.Auth` subclasses and plug into the same `auth` parameter.
"""
from mcp.client.auth.bearer import BearerAuth, TokenSource, UnauthorizedContext, UnauthorizedHandler
from mcp.client.auth.exceptions import OAuthFlowError, OAuthRegistrationError, OAuthTokenError, UnauthorizedError
from mcp.client.auth.oauth2 import (
OAuthClientProvider,
PKCEParameters,
TokenStorage,
)
__all__ = [
"BearerAuth",
"OAuthClientProvider",
"OAuthFlowError",
"OAuthRegistrationError",
"OAuthTokenError",
"PKCEParameters",
"TokenSource",
"TokenStorage",
"UnauthorizedContext",
"UnauthorizedError",
"UnauthorizedHandler",
]