mcp

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages multiple MCP server connections

func NewManager

func NewManager(opts ...ManagerOption) *Manager

NewManager creates a new MCP manager

func (*Manager) CallTool

func (m *Manager) CallTool(
	ctx context.Context,
	serverName, toolName string,
	arguments map[string]any,
) (*mcp.CallToolResult, error)

CallTool calls a tool on a specific server

func (*Manager) Close

func (m *Manager) Close() error

Close closes all server connections

func (*Manager) ConnectServer

func (m *Manager) ConnectServer(
	ctx context.Context,
	name string,
	cfg config.MCPServerConfig,
) error

ConnectServer connects to a single MCP server

func (*Manager) GetAllTools

func (m *Manager) GetAllTools() map[string][]*mcp.Tool

GetAllTools returns all tools from all connected servers

func (*Manager) GetServer

func (m *Manager) GetServer(name string) (*ServerConnection, bool)

GetServer returns a specific server connection

func (*Manager) GetServers

func (m *Manager) GetServers() map[string]*ServerConnection

GetServers returns all connected servers

func (*Manager) LoadFromConfig

func (m *Manager) LoadFromConfig(ctx context.Context, cfg *config.Config) error

LoadFromConfig loads MCP servers from configuration

func (*Manager) LoadFromMCPConfig

func (m *Manager) LoadFromMCPConfig(
	ctx context.Context,
	mcpCfg config.MCPConfig,
	workspacePath string,
) error

LoadFromMCPConfig loads MCP servers from MCP configuration and workspace path. This is the minimal dependency version that doesn't require the full Config object.

type ManagerOption added in v0.2.9

type ManagerOption func(*Manager)

ManagerOption configures an MCP manager.

func WithRuntimeEvents added in v0.2.9

func WithRuntimeEvents(eventBus runtimeevents.Bus) ManagerOption

WithRuntimeEvents injects the runtime event bus used for MCP observations.

type ServerConnection

type ServerConnection struct {
	Name    string
	Config  config.MCPServerConfig
	Client  *mcp.Client
	Session *mcp.ClientSession
	Tools   []*mcp.Tool
	// contains filtered or unexported fields
}

ServerConnection represents a connection to an MCP server

type ServerEventPayload added in v0.2.9

type ServerEventPayload struct {
	Server    string `json:"server"`
	Type      string `json:"type,omitempty"`
	URL       string `json:"url,omitempty"`
	Command   string `json:"command,omitempty"`
	Tool      string `json:"tool,omitempty"`
	ToolCount int    `json:"tool_count,omitempty"`
	Error     string `json:"error,omitempty"`
}

ServerEventPayload describes MCP server connection events.

Jump to

Keyboard shortcuts

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