mcp

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 14 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() *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 ServerConnection

type ServerConnection struct {
	Name    string
	Client  *mcp.Client
	Session *mcp.ClientSession
	Tools   []*mcp.Tool
}

ServerConnection represents a connection to an MCP server

Jump to

Keyboard shortcuts

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