mcp_client

package
v0.0.0-...-e4882c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: GPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateOAuthInteractive

func AuthenticateOAuthInteractive(oauthErr error, redirectURI string, overrides *mcp_config.OverrideT, openBrowser func(string), promptCallbackURL func() (string, error), onAutoCallbackUnavailable func(error)) error

func ConnectAndUseHttp

func ConnectAndUseHttp(overrides *mcp_config.OverrideT, server, serverURL string, oauth *mcp_config.OAuthT, hooks OAuthUIHooks, onOAuthRequired func(), useClient func(*Client) error) error

func DefaultRedirectURI

func DefaultRedirectURI() string

func DefaultTokenFile

func DefaultTokenFile(serverName, rawURL string) string

func GenerateCodeChallenge

func GenerateCodeChallenge(verifier string) string

func GenerateCodeVerifier

func GenerateCodeVerifier() (string, error)

func GenerateState

func GenerateState() (string, error)

func GetOAuthHandler

func GetOAuthHandler(err error) *transport.OAuthHandler

func IsAuthorizationFailure

func IsAuthorizationFailure(err error) bool

func IsOAuthAuthorizationRequiredError

func IsOAuthAuthorizationRequiredError(err error) bool

Types

type Client

type Client struct {
	Tools *mcp.ListToolsResult
	// contains filtered or unexported fields
}

func ConnectCmdLine

func ConnectCmdLine(overrides *mcp_config.OverrideT, envvars []string, command string, args ...string) (*Client, error)

func ConnectHttp

func ConnectHttp(overrides *mcp_config.OverrideT, url string) (*Client, error)

func ConnectHttpOAuth

func ConnectHttpOAuth(overrides *mcp_config.OverrideT, url string, oauthCfg OAuthConfig) (*Client, error)

func ConnectHttpOAuthInteractive

func ConnectHttpOAuthInteractive(overrides *mcp_config.OverrideT, serverURL string, oauthCfg OAuthConfig, hooks OAuthUIHooks) (*Client, error)

func (*Client) Call

func (c *Client) Call(ctx context.Context, name string, args map[string]any) (string, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) ListTools

func (c *Client) ListTools() error

type FileTokenStore

type FileTokenStore struct {
	// contains filtered or unexported fields
}

func NewFileTokenStore

func NewFileTokenStore(path string) *FileTokenStore

func (*FileTokenStore) GetToken

func (s *FileTokenStore) GetToken(ctx context.Context) (*client.Token, error)

func (*FileTokenStore) SaveToken

func (s *FileTokenStore) SaveToken(ctx context.Context, token *client.Token) error

type MemoryTokenStore

type MemoryTokenStore = client.MemoryTokenStore

func NewMemoryTokenStore

func NewMemoryTokenStore() *MemoryTokenStore

type OAuthCallbackResult

type OAuthCallbackResult struct {
	Code  string
	State string
}

type OAuthCallbackServer

type OAuthCallbackServer struct {
	// contains filtered or unexported fields
}

func StartOAuthCallbackServer

func StartOAuthCallbackServer(redirectURI string) (*OAuthCallbackServer, error)

func (*OAuthCallbackServer) Close

func (s *OAuthCallbackServer) Close()

func (*OAuthCallbackServer) Wait

type OAuthConfig

type OAuthConfig struct {
	ClientID              string
	ClientSecret          string
	RedirectURI           string
	Scopes                []string
	AuthServerMetadataURL string
	PKCEEnabled           bool
	TokenStore            client.TokenStore
}

func BuildOAuthConfig

func BuildOAuthConfig(server, serverURL string, oauth *mcp_config.OAuthT) OAuthConfig

type OAuthUIHooks

type OAuthUIHooks struct {
	OpenBrowser               func(string)
	PromptCallbackURL         func() (string, error)
	OnAutoCallbackUnavailable func(error)
}

type Token

type Token = client.Token

type TokenStore

type TokenStore = client.TokenStore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL