cmd

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 29 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmd has the commands, and flags, of the MCP connectors: those which call the connectors' API, and the server's

Index

Constants

This section is empty.

Variables

View Source
var (
	// WaitTimeout is how long a connector which is created is waited for,
	// as its server is connected, and signed in to, when it needs to be
	WaitTimeout = 10 * time.Minute

	// PollInterval is how often the connector is asked about, as well as
	// when there's an event of it, as events which happen before they're
	// watched aren't seen
	PollInterval = 2 * time.Second

	// LoopbackPort is the port of the loopback the authorization server
	// redirects to, when the server's own callback can't be, which is the
	// same each time, so the client registered with it, with its redirect,
	// is used again, or any port, when it's taken
	LoopbackPort = 8977
)

Functions

This section is empty.

Types

type ClientCommands

type ClientCommands struct {
	ConnectorCommands
}

ClientCommands are the commands which call the connectors' API

type ConnectorClient

type ConnectorClient struct {
	ClientIDCredential     string `` /* 205-byte string literal not displayed */
	ClientSecretCredential string `name:"client-secret-credential" help:"Name of the credential holding the client's secret, such as GITHUB_CLIENT_SECRET."`
}

ConnectorClient are the names of the credentials of the client a connector's server is authorized as, when its authorization server doesn't register clients, such as GitHub's

type ConnectorCommands

type ConnectorCommands struct {
	Connectors      ConnectorListCmd   `` /* 136-byte string literal not displayed */
	Connector       ConnectorGetCmd    `cmd:"" name:"connector" help:"Get a connector by name." group:"MCP CONNECTORS"`
	ConnectorCreate ConnectorCreateCmd `` /* 192-byte string literal not displayed */
	ConnectorUpdate ConnectorUpdateCmd `cmd:"" name:"connector-update" help:"Update a connector's URL, or patterns, so it's connected again." group:"MCP CONNECTORS"`
	ConnectorDelete ConnectorDeleteCmd `cmd:"" name:"connector-delete" help:"Delete a connector by name, so it's disconnected." group:"MCP CONNECTORS"`
}

ConnectorCommands are the commands which list, get, create, update and delete the connectors, which are remote MCP servers

type ConnectorCreateCmd

type ConnectorCreateCmd struct {
	ConnectorPatterns
	ConnectorClient
	URL  string `` /* 127-byte string literal not displayed */
	Name string `name:"name" help:"Connector name, which is an identifier, such as github, or the server's own name, when it's omitted."`
}

func (*ConnectorCreateCmd) Run

func (cmd *ConnectorCreateCmd) Run(ctx server.Cmd) error

Run creates the connector, and waits for its server to be connected, and signed in to, when it needs to be, in the person's browser, and prints it, once it's connected

type ConnectorDeleteCmd

type ConnectorDeleteCmd struct {
	Name string `arg:"" name:"name" help:"Connector name."`
}

func (*ConnectorDeleteCmd) Run

func (cmd *ConnectorDeleteCmd) Run(ctx server.Cmd) error

Run deletes the connector, and prints it, as it was

type ConnectorGetCmd

type ConnectorGetCmd struct {
	Name string `arg:"" name:"name" help:"Connector name."`
}

func (*ConnectorGetCmd) Run

func (cmd *ConnectorGetCmd) Run(ctx server.Cmd) error

Run prints the connector, with its status

type ConnectorListCmd

type ConnectorListCmd struct{}

func (*ConnectorListCmd) Run

func (cmd *ConnectorListCmd) Run(ctx server.Cmd) error

Run prints the connectors, as a table, and how many there are

type ConnectorPatterns

type ConnectorPatterns struct {
	Include []string `` /* 171-byte string literal not displayed */
	Exclude []string `` /* 135-byte string literal not displayed */
}

ConnectorPatterns are the patterns of the names of a connector's server's tools, prompts and resources, as a provider's are of its models

type ConnectorUpdateCmd

type ConnectorUpdateCmd struct {
	ConnectorPatterns
	Name                   string `arg:"" name:"name" help:"Connector name."`
	URL                    string `name:"url" help:"URL of the MCP server, which replaces it, or it's kept when it isn't given."`
	ClientIDCredential     string `` /* 176-byte string literal not displayed */
	ClientSecretCredential string `` /* 143-byte string literal not displayed */
}

ConnectorUpdateCmd updates a connector, whose patterns are replaced with those given, so one which isn't given is cleared, and whose URL is kept, unless one is given

func (*ConnectorUpdateCmd) Run

func (cmd *ConnectorUpdateCmd) Run(ctx server.Cmd) error

Run updates the connector, and prints it

type Flags

type Flags struct {
	ConnectTimeout time.Duration `` /* 167-byte string literal not displayed */
	ToolTimeout    time.Duration `` /* 150-byte string literal not displayed */
}

Flags are the connectors' flags for the server: how long a connector's server is waited for, as it's connected, and its tools are listed, and how long one of its tools has, as it's called

func (Flags) WithConnectorRegistry

func (flags Flags) WithConnectorRegistry(ctx server.Cmd, srv *servercmd.RunServer, b *broadcaster.Broadcaster, fn func(*registry.Registry) error, opts ...registry.Opt) error

WithConnectorRegistry creates the registry of the connectors, with the command's client options, such as its tracer, and user agent, which the clients of the connectors' servers use, and its name, and version, which the servers are told, the broadcaster it publishes its changes to, when there is one, and the options, such as its store, registers its HTTP handlers with the server, when there is one, and then calls the function with the registry, returning any error, once its connectors' servers are disconnected

Jump to

Keyboard shortcuts

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