mcp

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolVersion = "2025-06-18"

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Type            string
	ServerName      string
	Transport       Transport
	Status          ServerStatus
	ToolName        string
	ToolCount       int
	ProtocolVersion string
	FailureCategory string
	NextAction      string
	Message         string
	At              time.Time
}

type EventSink

type EventSink interface {
	EmitMCP(Diagnostic)
}

type Manager

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

func NewManager

func NewManager(opts Options) *Manager

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context, serverName string) error

func (*Manager) RegisterTools

func (m *Manager) RegisterTools(registry *tools.Registry) error

func (*Manager) Snapshots

func (m *Manager) Snapshots() []Snapshot

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, configs []ServerConfig) error

func (*Manager) Tools

func (m *Manager) Tools() []tools.Tool

type Options

type Options struct {
	Sink EventSink
	Now  func() time.Time
}

type ServerConfig

type ServerConfig struct {
	Name              string
	Transport         Transport
	Command           string
	Args              []string
	CWD               string
	Env               map[string]string
	URL               string
	Headers           map[string]string
	BearerTokenEnvVar string

	Enabled        bool
	Required       bool
	StartupTimeout time.Duration
	ToolTimeout    time.Duration

	EnabledTools      []string
	DisabledTools     []string
	DefaultPermission tools.PermissionMode
}

type ServerStatus

type ServerStatus string
const (
	StatusDisabled   ServerStatus = "disabled"
	StatusConnecting ServerStatus = "connecting"
	StatusReady      ServerStatus = "ready"
	StatusFailed     ServerStatus = "failed"
)

type Snapshot

type Snapshot struct {
	ServerName        string
	Status            ServerStatus
	Transport         Transport
	Instructions      string
	ProtocolVersion   string
	ToolCount         int
	LastRefresh       time.Time
	Err               string
	Required          bool
	DefaultPermission tools.PermissionMode
}

type ToolDescriptor

type ToolDescriptor struct {
	Name        string
	ToolName    string
	Title       string
	Description string
	InputSchema map[string]any
}

type ToolSource

type ToolSource struct {
	ServerName   string
	Instructions string
	Status       ServerStatus
	Tools        []ToolDescriptor
	LastRefresh  time.Time
}

type Transport

type Transport string
const (
	TransportStdio          Transport = "stdio"
	TransportStreamableHTTP Transport = "streamable_http"
)

Jump to

Keyboard shortcuts

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