client

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoginRequired  = errors.New("login required; run mcphub-cli login for this profile")
	ErrProfileChanged = errors.New("profile was logged in again; restart the MCP connection")
)

Functions

func AdminRequest added in v1.4.0

func AdminRequest(ctx context.Context, store *Store, name string, opts AdminRequestOptions) error

AdminRequest sends one management operation. Only a 401 can cause one retry; network failures never replay writes. ETags are emitted separately to stderr.

func Connect

func Connect(ctx context.Context, store *Store, name string, opts ConnectOptions) error

func Login

func Login(ctx context.Context, store *Store, opts LoginOptions) error

Types

type AdminRequestOptions added in v1.4.0

type AdminRequestOptions struct {
	Method, Path, IfMatch string
	Body                  []byte
	Output, Diagnostics   io.Writer
	HTTPClient            *http.Client
}

type ConnectOptions

type ConnectOptions struct {
	Input      io.ReadCloser
	Output     io.WriteCloser
	HTTPClient *http.Client
}

type LoginOptions

type LoginOptions struct {
	Admin        bool
	ServerURL    string
	ClientID     string
	Profile      string
	Scopes       []string
	CallbackPort int
	Output       io.Writer
	OpenBrowser  func(string) error
	HTTPClient   *http.Client
}

type Status

type Status struct {
	Admin      bool
	ServerURL  string
	ClientID   string
	Scopes     []string
	LoggedIn   bool
	ExpiresAt  time.Time
	CanRefresh bool
}

Status describes cached credentials, without checking their validity at the issuer.

type Store

type Store struct{ Dir string }

func DefaultStore

func DefaultStore() (*Store, error)

func (*Store) Logout

func (s *Store) Logout(ctx context.Context, name string) error

func (*Store) Status

func (s *Store) Status(ctx context.Context, name string) (Status, error)

Jump to

Keyboard shortcuts

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