Documentation
¶
Index ¶
- Variables
- func RedactError(err error, sensitiveValues []string) error
- func ValidateOAuthClientCredentialsSecret(raw string, requireClientSecret bool) error
- type AuthManager
- func (m *AuthManager) BuildAuthHealth(ctx context.Context, config mcpServer.RuntimeConfig) MCPAuthHealth
- func (m *AuthManager) ClearAuthStatus(serverRef mcpServer.ServerID)
- func (m *AuthManager) ClearAuthStatuses()
- func (m *AuthManager) ConnectionFailed(ctx context.Context, config mcpServer.RuntimeConfig, err error)
- func (m *AuthManager) ConnectionSucceeded(ctx context.Context, config mcpServer.RuntimeConfig)
- func (m *AuthManager) GetAuthStatus(serverRef mcpServer.ServerID) (MCPAuthStatus, bool)
- func (m *AuthManager) PrepareConnection(ctx context.Context, config mcpServer.RuntimeConfig) (mcpConnection.PreparedConnection, error)
- func (m *AuthManager) SaveAuthStatus(ctx context.Context, status MCPAuthStatus) error
- type AuthManagerOption
- func WithAuthHTTPClient(client *http.Client) AuthManagerOption
- func WithClientInfo(name string, version string) AuthManagerOption
- func WithOAuthAuthorizationBroker(broker OAuthAuthorizationBroker) AuthManagerOption
- func WithOAuthRedirectURL(redirectURL string) AuthManagerOption
- func WithOAuthTokenStore(store OAuthTokenStore) AuthManagerOption
- type AuthStatusSink
- type GrantType
- type MCPAuthHealth
- type MCPAuthHealthState
- type MCPAuthSettings
- type MCPAuthState
- type MCPAuthStatus
- type MCPOAuthAuthorization
- type OAuthAuthorizationBroker
- type OAuthAuthorizationRequest
- type OAuthAuthorizationResult
- type OAuthLoopbackBroker
- func (b *OAuthLoopbackBroker) Cancel(server mcpServer.ServerID) bool
- func (b *OAuthLoopbackBroker) Close() error
- func (b *OAuthLoopbackBroker) FetchAuthorizationCode(ctx context.Context, req OAuthAuthorizationRequest) (*OAuthAuthorizationResult, error)
- func (b *OAuthLoopbackBroker) ListenAddr() string
- func (b *OAuthLoopbackBroker) Pending() []MCPOAuthAuthorization
- func (b *OAuthLoopbackBroker) Readiness() (ready bool, errStr string)
- func (b *OAuthLoopbackBroker) RedirectURL() string
- func (b *OAuthLoopbackBroker) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type OAuthLoopbackBrokerOptions
- type OAuthTokenStore
- type SecretRedactor
- type SecretResolver
- type StaticSecretResolver
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMCPAuthRequired = errors.New("mcp authorization required") ErrMCPInvalidAuthRequest = errors.New("invalid mcp auth request") )
View Source
var ErrOAuthTokenNotFound = errors.New("oauth token not found")
Functions ¶
func RedactError ¶
RedactError preserves an error chain while replacing configured secret values in the externally observable message.
Types ¶
type AuthManager ¶
type AuthManager struct {
// contains filtered or unexported fields
}
func NewAuthManager ¶
func NewAuthManager( secrets SecretResolver, options ...AuthManagerOption, ) *AuthManager
func (*AuthManager) BuildAuthHealth ¶
func (m *AuthManager) BuildAuthHealth( ctx context.Context, config mcpServer.RuntimeConfig, ) MCPAuthHealth
func (*AuthManager) ClearAuthStatus ¶
func (m *AuthManager) ClearAuthStatus( serverRef mcpServer.ServerID, )
func (*AuthManager) ClearAuthStatuses ¶
func (m *AuthManager) ClearAuthStatuses()
func (*AuthManager) ConnectionFailed ¶
func (m *AuthManager) ConnectionFailed( ctx context.Context, config mcpServer.RuntimeConfig, err error, )
func (*AuthManager) ConnectionSucceeded ¶
func (m *AuthManager) ConnectionSucceeded( ctx context.Context, config mcpServer.RuntimeConfig, )
func (*AuthManager) GetAuthStatus ¶
func (m *AuthManager) GetAuthStatus( serverRef mcpServer.ServerID, ) (MCPAuthStatus, bool)
func (*AuthManager) PrepareConnection ¶
func (m *AuthManager) PrepareConnection( ctx context.Context, config mcpServer.RuntimeConfig, ) (mcpConnection.PreparedConnection, error)
func (*AuthManager) SaveAuthStatus ¶
func (m *AuthManager) SaveAuthStatus( ctx context.Context, status MCPAuthStatus, ) error
type AuthManagerOption ¶
type AuthManagerOption func(*AuthManager)
func WithAuthHTTPClient ¶
func WithAuthHTTPClient( client *http.Client, ) AuthManagerOption
func WithClientInfo ¶
func WithClientInfo( name string, version string, ) AuthManagerOption
func WithOAuthAuthorizationBroker ¶
func WithOAuthAuthorizationBroker( broker OAuthAuthorizationBroker, ) AuthManagerOption
func WithOAuthRedirectURL ¶
func WithOAuthRedirectURL( redirectURL string, ) AuthManagerOption
func WithOAuthTokenStore ¶
func WithOAuthTokenStore( store OAuthTokenStore, ) AuthManagerOption
type AuthStatusSink ¶
type AuthStatusSink interface {
SaveAuthStatus(
ctx context.Context,
status MCPAuthStatus,
) error
}
type MCPAuthHealth ¶
type MCPAuthHealth struct {
Server mcpServer.ServerID `json:"server"`
AuthMode mcpServer.MCPHTTPAuthMode `json:"authMode"`
State MCPAuthHealthState `json:"state"`
Configured bool `json:"configured"`
Resource string `json:"resource,omitempty"`
Scopes []string `json:"scopes,omitempty"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
AuthorizationPending bool `json:"authorizationPending,omitempty"`
AuthorizationURL string `json:"authorizationURL,omitempty"`
AuthorizationExpiresAt string `json:"authorizationExpiresAt,omitempty"`
OAuthRedirectURL string `json:"oauthRedirectURL,omitempty"`
OAuthLoopbackListenAddr string `json:"oauthLoopbackListenAddr,omitempty"`
OAuthLoopbackReady *bool `json:"oauthLoopbackReady,omitempty"`
OAuthLoopbackError string `json:"oauthLoopbackError,omitempty"`
LastError string `json:"lastError,omitempty"`
}
type MCPAuthHealthState ¶
type MCPAuthHealthState string
const ( MCPAuthHealthStateNotRequired MCPAuthHealthState = "notRequired" MCPAuthHealthStateNotConfigured MCPAuthHealthState = "notConfigured" MCPAuthHealthStateAuthorizationNeeded MCPAuthHealthState = "authorizationNeeded" MCPAuthHealthStateAuthorizationPending MCPAuthHealthState = "authorizationPending" MCPAuthHealthStateAuthorized MCPAuthHealthState = "authorized" MCPAuthHealthStateExpired MCPAuthHealthState = "expired" MCPAuthHealthStateInsufficientScope MCPAuthHealthState = "insufficientScope" MCPAuthHealthStateError MCPAuthHealthState = "error" )
type MCPAuthSettings ¶
type MCPAuthSettings struct {
// Empty means a random loopback port is used for the current process.
OAuthLoopbackListenAddr string `json:"oauthLoopbackListenAddr,omitempty"`
}
type MCPAuthState ¶
type MCPAuthState string
const ( MCPAuthStateNotRequired MCPAuthState = "notRequired" MCPAuthStateRequired MCPAuthState = "required" MCPAuthStateAuthorized MCPAuthState = "authorized" MCPAuthStateExpired MCPAuthState = "expired" MCPAuthStateInsufficientScope MCPAuthState = "insufficientScope" MCPAuthStateError MCPAuthState = "error" )
type MCPAuthStatus ¶
type MCPAuthStatus struct {
Server mcpServer.ServerID `json:"server"`
AuthMode mcpServer.MCPHTTPAuthMode `json:"authMode"`
State MCPAuthState `json:"state"`
Scopes []string `json:"scopes,omitempty"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
LastError string `json:"lastError,omitempty"`
AuthorizationServer string `json:"authorizationServer,omitempty"`
Resource string `json:"resource,omitempty"`
}
type MCPOAuthAuthorization ¶
type OAuthAuthorizationBroker ¶
type OAuthAuthorizationBroker interface {
FetchAuthorizationCode(
ctx context.Context,
request OAuthAuthorizationRequest,
) (*OAuthAuthorizationResult, error)
}
type OAuthLoopbackBroker ¶
type OAuthLoopbackBroker struct {
// contains filtered or unexported fields
}
func NewOAuthLoopbackBroker ¶
func NewOAuthLoopbackBroker(ctx context.Context, opts *OAuthLoopbackBrokerOptions) (*OAuthLoopbackBroker, error)
func (*OAuthLoopbackBroker) Cancel ¶
func (b *OAuthLoopbackBroker) Cancel( server mcpServer.ServerID, ) bool
func (*OAuthLoopbackBroker) Close ¶
func (b *OAuthLoopbackBroker) Close() error
func (*OAuthLoopbackBroker) FetchAuthorizationCode ¶
func (b *OAuthLoopbackBroker) FetchAuthorizationCode( ctx context.Context, req OAuthAuthorizationRequest, ) (*OAuthAuthorizationResult, error)
func (*OAuthLoopbackBroker) ListenAddr ¶
func (b *OAuthLoopbackBroker) ListenAddr() string
func (*OAuthLoopbackBroker) Pending ¶
func (b *OAuthLoopbackBroker) Pending() []MCPOAuthAuthorization
func (*OAuthLoopbackBroker) Readiness ¶
func (b *OAuthLoopbackBroker) Readiness() (ready bool, errStr string)
func (*OAuthLoopbackBroker) RedirectURL ¶
func (b *OAuthLoopbackBroker) RedirectURL() string
func (*OAuthLoopbackBroker) ServeHTTP ¶
func (b *OAuthLoopbackBroker) ServeHTTP(w http.ResponseWriter, r *http.Request)
type OAuthTokenStore ¶
type SecretRedactor ¶
type SecretRedactor struct {
// contains filtered or unexported fields
}
func NewSecretRedactor ¶
func NewSecretRedactor(resolved mcpConnection.PreparedConnection) *SecretRedactor
func (*SecretRedactor) Redact ¶
func (r *SecretRedactor) Redact(s string) string
type SecretResolver ¶
type StaticSecretResolver ¶
func (StaticSecretResolver) ResolveSecret ¶
Click to show internal directories.
Click to hide internal directories.