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 server.RuntimeConfig) MCPAuthHealth
- func (m *AuthManager) ClearAuthStatus(serverRef artifact.ArtifactRef)
- func (m *AuthManager) ClearAuthStatuses()
- func (m *AuthManager) ConnectionFailed(ctx context.Context, config server.RuntimeConfig, err error)
- func (m *AuthManager) ConnectionSucceeded(ctx context.Context, config server.RuntimeConfig)
- func (m *AuthManager) GetAuthStatus(serverRef artifact.ArtifactRef) (MCPAuthStatus, bool)
- func (m *AuthManager) PrepareConnection(ctx context.Context, config server.RuntimeConfig) (ResolvedTransportAuth, error)
- func (m *AuthManager) SaveAuthStatus(ctx context.Context, status MCPAuthStatus) error
- type AuthManagerOption
- type AuthStatusSink
- type ConnectionAuthorizer
- 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 artifact.ArtifactRef) 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 ResolvedTransportAuth
- 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 ¶ added in v0.2.17
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 ¶ added in v0.1.20
func (m *AuthManager) BuildAuthHealth( ctx context.Context, config server.RuntimeConfig, ) MCPAuthHealth
func (*AuthManager) ClearAuthStatus ¶
func (m *AuthManager) ClearAuthStatus( serverRef artifact.ArtifactRef, )
func (*AuthManager) ClearAuthStatuses ¶
func (m *AuthManager) ClearAuthStatuses()
func (*AuthManager) ConnectionFailed ¶ added in v0.2.17
func (m *AuthManager) ConnectionFailed( ctx context.Context, config server.RuntimeConfig, err error, )
func (*AuthManager) ConnectionSucceeded ¶ added in v0.2.17
func (m *AuthManager) ConnectionSucceeded( ctx context.Context, config server.RuntimeConfig, )
func (*AuthManager) GetAuthStatus ¶
func (m *AuthManager) GetAuthStatus( serverRef artifact.ArtifactRef, ) (MCPAuthStatus, bool)
func (*AuthManager) PrepareConnection ¶ added in v0.2.17
func (m *AuthManager) PrepareConnection( ctx context.Context, config server.RuntimeConfig, ) (ResolvedTransportAuth, 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 WithOAuthAuthorizationBroker ¶
func WithOAuthAuthorizationBroker( broker OAuthAuthorizationBroker, ) AuthManagerOption
func WithOAuthRedirectURL ¶
func WithOAuthRedirectURL( redirectURL string, ) AuthManagerOption
func WithOAuthTokenStore ¶ added in v0.1.20
func WithOAuthTokenStore( store OAuthTokenStore, ) AuthManagerOption
type AuthStatusSink ¶
type AuthStatusSink interface {
SaveAuthStatus(
ctx context.Context,
status MCPAuthStatus,
) error
}
type ConnectionAuthorizer ¶ added in v0.2.17
type ConnectionAuthorizer interface {
PrepareConnection(
ctx context.Context,
config server.RuntimeConfig,
) (ResolvedTransportAuth, error)
ConnectionSucceeded(
ctx context.Context,
config server.RuntimeConfig,
)
ConnectionFailed(
ctx context.Context,
config server.RuntimeConfig,
err error,
)
}
type MCPAuthHealth ¶ added in v0.2.17
type MCPAuthHealth struct {
Server artifact.ArtifactRef `json:"server"`
AuthMode server.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 ¶ added in v0.2.17
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 ¶ added in v0.2.17
type MCPAuthSettings struct {
// Empty means a random loopback port is used for the current process.
OAuthLoopbackListenAddr string `json:"oauthLoopbackListenAddr,omitempty"`
}
type MCPAuthState ¶ added in v0.2.17
type MCPAuthState string
const ( MCPAuthStateNotRequired MCPAuthState = "notRequired" MCPAuthStateRequired MCPAuthState = "required" MCPAuthStateAuthorized MCPAuthState = "authorized" MCPAuthStateExpired MCPAuthState = "expired" MCPAuthStateInsufficientScope MCPAuthState = "insufficientScope" MCPAuthStateError MCPAuthState = "error" )
type MCPAuthStatus ¶ added in v0.2.17
type MCPAuthStatus struct {
Server artifact.ArtifactRef `json:"server"`
AuthMode server.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 ¶ added in v0.2.17
type MCPOAuthAuthorization struct {
Server artifact.ArtifactRef `json:"server"`
AuthorizationURL string `json:"authorizationURL"`
ExpiresAt string `json:"expiresAt,omitempty"`
}
type OAuthAuthorizationBroker ¶
type OAuthAuthorizationBroker interface {
FetchAuthorizationCode(
ctx context.Context,
request OAuthAuthorizationRequest,
) (*OAuthAuthorizationResult, error)
}
type OAuthAuthorizationRequest ¶
type OAuthAuthorizationRequest struct {
Server artifact.ArtifactRef
AuthorizationURL string
}
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 artifact.ArtifactRef, ) 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 ¶ added in v0.1.13
func (b *OAuthLoopbackBroker) ListenAddr() string
func (*OAuthLoopbackBroker) Pending ¶
func (b *OAuthLoopbackBroker) Pending() []MCPOAuthAuthorization
func (*OAuthLoopbackBroker) Readiness ¶ added in v0.2.17
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 ¶ added in v0.1.20
type ResolvedTransportAuth ¶
type ResolvedTransportAuth struct {
Env map[string]string
Headers map[string]string
SensitiveValues []string
Status MCPAuthStatus
OAuthHandler mcpAuth.OAuthHandler
}
type SecretRedactor ¶
type SecretRedactor struct {
// contains filtered or unexported fields
}
func NewSecretRedactor ¶
func NewSecretRedactor(resolved ResolvedTransportAuth) *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.