mcp

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 17 Imported by: 0 modules, 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

Index

Constants

View Source
const (
	TransportStdio = "stdio"
	TransportHTTP  = "http"
)

Variables

This section is empty.

Functions

func NewToolServer

func NewToolServer(runtime ToolRuntime) *sdk.Server

func ResultContent

func ResultContent(result *sdk.CallToolResult) string

func RunStdioServer

func RunStdioServer(ctx context.Context, runtime ToolRuntime) error

func SanitizeToolPart

func SanitizeToolPart(value string) string

func ToolID

func ToolID(prefix string, remoteName string) string

Types

type Config

type Config struct {
	Enabled bool
	Servers []ServerConfig
}

func NormalizeConfig

func NormalizeConfig(cfg Config) Config

type ServerConfig

type ServerConfig struct {
	ID        string
	Name      string
	Enabled   bool
	Transport string
	Command   string
	Args      []string
	Env       map[string]string
	// Environ is the environment of a stdio server before Env; nil inherits
	// the daemon's.
	Environ    []string
	Endpoint   string
	ToolPrefix string
	ReadOnly   bool
	Timeout    time.Duration
}

type Session added in v0.2.0

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

Session is a connection to one MCP server and the tools it offers. A server that stopped is started again on the next call.

func Connect added in v0.2.0

func Connect(ctx context.Context, cfg ServerConfig) (*Session, error)

Connect starts or reaches the server and lists its tools.

func (*Session) Alive added in v0.2.0

func (s *Session) Alive() bool

Alive reports whether the connection to the server is still open.

func (*Session) Close added in v0.2.0

func (s *Session) Close() error

func (*Session) Name added in v0.2.0

func (s *Session) Name() string

Name is the server's display name.

func (*Session) Tools added in v0.2.0

func (s *Session) Tools() []tools.Executor

Tools are the server's tools as matrixclaw tools.

type ToolRuntime

type ToolRuntime interface {
	List() []tools.Spec
	Execute(ctx context.Context, toolID string, call tools.Call) (tools.Result, error)
}

Jump to

Keyboard shortcuts

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