Documentation
¶
Index ¶
- func DefaultConfigPath() string
- type MCPTool
- type MCPToolResult
- type Manager
- func (m *Manager) ExecuteTool(ctx context.Context, toolName string, args map[string]interface{}) (*MCPToolResult, error)
- func (m *Manager) GetServerStatus() []ServerStatus
- func (m *Manager) GetTools() []models.ToolDefinition
- func (m *Manager) IsMCPTool(name string) bool
- func (m *Manager) LoadConfig(configPath string) error
- func (m *Manager) StartAll(ctx context.Context) error
- func (m *Manager) StopAll()
- type ServerConfig
- type ServerConnection
- type ServerStatus
- type TransportType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the default MCP config file path.
Types ¶
type MCPTool ¶
type MCPTool struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]interface{} `json:"inputSchema"`
ServerName string `json:"-"`
}
MCPTool represents a tool discovered from an MCP server.
type MCPToolResult ¶
type MCPToolResult struct {
Content string `json:"content"`
IsError bool `json:"isError,omitempty"`
MimeType string `json:"mimeType,omitempty"`
}
MCPToolResult is the result of executing an MCP tool.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages MCP server connections and tool routing.
func NewManager ¶
NewManager creates a new MCP manager.
func (*Manager) ExecuteTool ¶
func (m *Manager) ExecuteTool(ctx context.Context, toolName string, args map[string]interface{}) (*MCPToolResult, error)
ExecuteTool executes an MCP tool by name.
func (*Manager) GetServerStatus ¶
func (m *Manager) GetServerStatus() []ServerStatus
GetServerStatus returns status for all servers.
func (*Manager) GetTools ¶
func (m *Manager) GetTools() []models.ToolDefinition
GetTools returns all discovered MCP tools as ToolDefinitions.
func (*Manager) LoadConfig ¶
LoadConfig loads MCP server configurations from a JSON file.
type ServerConfig ¶
type ServerConfig struct {
Name string `json:"name"`
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
Transport TransportType `json:"transport"`
URL string `json:"url,omitempty"` // For SSE transport
Enabled bool `json:"enabled"`
}
ServerConfig represents a configured MCP server.
type ServerConnection ¶
type ServerConnection struct {
Config ServerConfig
Status ServerStatus
Process *os.Process
}
ServerConnection represents an active MCP server.
type ServerStatus ¶
type ServerStatus struct {
Name string
Connected bool
ToolCount int
LastPing time.Time
LastError error
StartedAt time.Time
}
ServerStatus tracks the health of an MCP server connection.
type TransportType ¶
type TransportType string
TransportType defines MCP transport mechanism.
const ( TransportStdio TransportType = "stdio" TransportSSE TransportType = "sse" )