Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultConfigPath() string
- func NewBrowserOAuthCodeFetcher(redirectURL string) mcpauth.AuthorizationCodeFetcher
- type AuthConfig
- type Config
- type Error
- type Manager
- func (m *Manager) CallTool(ctx context.Context, server, tool string, arguments map[string]any) (*ToolResult, error)
- func (m *Manager) Close() error
- func (m *Manager) ListTools(ctx context.Context, server string) ([]Tool, error)
- func (m *Manager) Refresh(ctx context.Context, server string, opts ...RefreshOption) error
- func (m *Manager) Servers() []ServerStatus
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) Status(server string) ServerStatus
- func (m *Manager) WaitInitialScan(ctx context.Context) error
- type Option
- func WithAuthStore(store *keenauth.Store) Option
- func WithHTTPClient(client *http.Client) Option
- func WithOAuthAuthorizationCodeFetcher(fetcher mcpauth.AuthorizationCodeFetcher) Option
- func WithOAuthClientIDMetadataDocument(url string) Option
- func WithOAuthClientName(name string) Option
- func WithOAuthPreregisteredClient(clientID, clientSecret string) Option
- func WithOAuthRedirectURL(redirectURL string) Option
- func WithStandaloneSSEDisabled(disabled bool) Option
- func WithStdioTerminateTimeout(timeout time.Duration) Option
- func WithStreamableMaxRetries(maxRetries int) Option
- func WithTimeouts(connect, listTools, callTool time.Duration) Option
- type RefreshOption
- type Runtime
- type ServerConfig
- type ServerState
- type ServerStatus
- type Tool
- type ToolResult
Constants ¶
View Source
const ( TransportStreamableHTTP = "streamable_http" TransportStdio = "stdio" AuthNone = "none" AuthAPIKey = "api_key" AuthOAuth = "oauth" )
View Source
const DefaultOAuthRedirectURL = "http://localhost:1456/auth/mcp/callback"
Variables ¶
View Source
var ( ErrServerNotConfigured = errors.New("mcp server not configured") ErrServerDisconnected = errors.New("mcp server disconnected") ErrAuthRequired = errors.New("mcp authentication required") ErrAuthFailed = errors.New("mcp authentication failed") ErrToolNotFound = errors.New("mcp tool not found") ErrTimeout = errors.New("mcp operation timed out") ErrProtocol = errors.New("mcp protocol error") ErrRemoteTool = errors.New("mcp remote tool error") ErrAlreadyStarted = errors.New("mcp manager already started") )
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
func NewBrowserOAuthCodeFetcher ¶
func NewBrowserOAuthCodeFetcher(redirectURL string) mcpauth.AuthorizationCodeFetcher
Types ¶
type AuthConfig ¶
type Config ¶
type Config struct {
Servers map[string]ServerConfig `json:"servers"`
}
func LoadConfig ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) Servers ¶
func (m *Manager) Servers() []ServerStatus
func (*Manager) Status ¶
func (m *Manager) Status(server string) ServerStatus
type Option ¶
type Option func(*managerOptions)
func WithAuthStore ¶
func WithHTTPClient ¶
func WithOAuthAuthorizationCodeFetcher ¶
func WithOAuthAuthorizationCodeFetcher(fetcher mcpauth.AuthorizationCodeFetcher) Option
func WithOAuthClientName ¶
func WithOAuthRedirectURL ¶
func WithTimeouts ¶
type RefreshOption ¶
type RefreshOption func(*managerOptions)
func WithRefreshConnectTimeout ¶
func WithRefreshConnectTimeout(timeout time.Duration) RefreshOption
func WithRefreshOAuthAuthorizationCodeFetcher ¶
func WithRefreshOAuthAuthorizationCodeFetcher(fetcher mcpauth.AuthorizationCodeFetcher) RefreshOption
func WithRefreshOAuthForceReauth ¶
func WithRefreshOAuthForceReauth(force bool) RefreshOption
func WithRefreshOAuthRedirectURL ¶
func WithRefreshOAuthRedirectURL(redirectURL string) RefreshOption
type Runtime ¶
type Runtime interface {
Start(context.Context) error
Close() error
Servers() []ServerStatus
Status(string) ServerStatus
WaitInitialScan(context.Context) error
ListTools(context.Context, string) ([]Tool, error)
CallTool(context.Context, string, string, map[string]any) (*ToolResult, error)
Refresh(context.Context, string, ...RefreshOption) error
}
type ServerConfig ¶
type ServerState ¶
type ServerState string
const ( StateConfigured ServerState = "configured" StateConnecting ServerState = "connecting" StateConnected ServerState = "connected" StateDisconnected ServerState = "disconnected" StateAuthRequired ServerState = "auth_required" StateAuthFailed ServerState = "auth_failed" )
type ServerStatus ¶
type ServerStatus struct {
Name string
Transport string
AuthType string
State ServerState
LastConnectedAt time.Time
LastToolRefreshAt time.Time
LastError string
ToolCount int
Endpoint string
StdioCommand string
NegotiatedProtocol string
NegotiatedServerName string
NegotiatedServerVersion string
Description string
}
Click to show internal directories.
Click to hide internal directories.