mcp

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMCPConnectionTimeout is the default timeout for connecting to MCP servers
	DefaultMCPConnectionTimeout = 120 * time.Second

	// DefaultMCPToolTimeout is the default timeout for executing MCP tool calls
	DefaultMCPToolTimeout = 120 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MCPClientWrapper

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

MCPClientWrapper wraps an MCP client connection

type MCPManager

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

MCPManager manages multiple MCP server connections

func NewMCPManager

func NewMCPManager() *MCPManager

NewMCPManager creates a new MCP manager

func (*MCPManager) Close

func (m *MCPManager) Close()

Close closes all MCP client connections

func (*MCPManager) ConnectToServerConfigs

func (m *MCPManager) ConnectToServerConfigs(ctx context.Context, serverConfigs []ServerConfig, timeout time.Duration, existingErrors []error) ([]MCPServerConnection, []error)

ConnectToServerConfigs connects to multiple parsed MCP server configs in parallel

type MCPServerConnection

type MCPServerConnection struct {
	ServerName string
	Tools      []*llm.Tool
	ToolNames  []string // Original tool names without server prefix
}

MCPServerConnection represents a successful MCP server connection with its tools

type ServerConfig

type ServerConfig struct {
	Name    string            `json:"name,omitempty"`
	Type    string            `json:"type,omitempty"`    // "stdio", "http", "sse"
	URL     string            `json:"url,omitempty"`     // for http/sse
	Command string            `json:"command,omitempty"` // for stdio
	Args    []string          `json:"args,omitempty"`    // for stdio
	Env     map[string]string `json:"env,omitempty"`     // for stdio
	Headers map[string]string `json:"headers,omitempty"` // for http/sse
}

ServerConfig represents the configuration for an MCP server

func ParseServerConfigs

func ParseServerConfigs(ctx context.Context, configs []string) ([]ServerConfig, []error)

ParseServerConfigs parses JSON configuration strings into ServerConfig structs

Jump to

Keyboard shortcuts

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