mcp

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCPServer

type MCPServer struct {
	Name    string
	Config  ServerConfig
	Session *mcp.ClientSession
	Tools   map[string]*mcp.Tool // Available tools from this server
	// contains filtered or unexported fields
}

MCPServer represents a running MCP server instance

type Manager

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

Manager manages multiple MCP servers

func NewManager

func NewManager() *Manager

NewManager creates a new MCP manager

func (*Manager) CallTool

func (m *Manager) CallTool(serverName, toolName string, arguments map[string]interface{}) (*mcp.CallToolResult, error)

CallTool invokes an MCP tool

func (*Manager) Close

func (m *Manager) Close() error

Close shuts down all MCP servers

func (*Manager) GetServer

func (m *Manager) GetServer(name string) (*MCPServer, error)

GetServer returns a server by name

func (*Manager) GetTool

func (m *Manager) GetTool(serverName, toolName string) (*mcp.Tool, error)

GetTool returns a tool from a specific server

func (*Manager) GetToolInfo

func (m *Manager) GetToolInfo(serverName, toolName string) (*ToolInfo, error)

GetToolInfo retrieves information about a tool

func (*Manager) ListServers

func (m *Manager) ListServers() []string

ListServers returns all registered server names

func (*Manager) ListTools

func (m *Manager) ListTools(serverName string) ([]string, error)

ListTools returns all tools from a server

func (*Manager) RegisterServer

func (m *Manager) RegisterServer(name string, config ServerConfig) error

RegisterServer registers and starts an MCP server

type ServerConfig

type ServerConfig struct {
	// For stdio transport (local process)
	Command string            // Command to execute (e.g., "npx")
	Args    []string          // Command arguments
	Env     map[string]string // Environment variables

	// For HTTP/SSE transport (remote server)
	URL     string            // Server URL for remote connections
	Headers map[string]string // HTTP headers for authentication
}

ServerConfig represents the configuration for an MCP server

type ToolInfo

type ToolInfo struct {
	Name        string
	Description string
	InputSchema map[string]interface{}
}

ToolInfo contains information about a tool

Jump to

Keyboard shortcuts

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