Skip to content

Commit a694fd3

Browse files
committed
add OAuthHandler
1 parent 85de8b0 commit a694fd3

File tree

2 files changed

+4
-72
lines changed

2 files changed

+4
-72
lines changed

auth/client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"net/http"
1111
"sync"
1212

13+
"github.com/modelcontextprotocol/go-sdk/internal/oauthex"
1314
"golang.org/x/oauth2"
1415
"golang.org/x/oauth2/authhandler"
1516
)
@@ -36,7 +37,9 @@ func NewHTTPTransport(opts *HTTPTransportConfig) (*HTTPTransport, error) {
3637
}
3738

3839
type HTTPTransportConfig struct {
39-
AuthHandler authhandler.AuthorizationHandler
40+
// OAuthHandler is conducts the OAuth flow, using information obtained from the
41+
// MCP server and the auth server that it refers to.
42+
OAuthHandler func(context.Context, *oauthex.ProtectedResourceMetadata, *oauthex.AuthServerMeta) (oauth2.TokenSource, error)
4043
// Base is the [http.RoundTripper] to use initially, before credentials are obtained.
4144
// (After the OAuth flow is completed, an [oauth2.Transport] with the resulting
4245
// [oauth2.TokenSource] is used.)

mcp/auth.go

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)