Documentation
¶
Index ¶
- Constants
- func BaseToolID(serverName, toolName string) string
- func LookupRuntime(lookup pkgplugins.RuntimeLookup) (runtimeAccessor, bool)
- func SanitizeName(name string) string
- func SetDefaultManager(manager *Manager)
- type CanonicalRegistry
- type Config
- type DialFunc
- type ErrUnsupportedTransport
- type ExecResult
- type Manager
- func (m *Manager) AddTool(serverName, toolName, displayName, description string, ...) ToolInfo
- func (m *Manager) Config() Config
- func (m *Manager) Configure(cfg Config, enabled bool)
- func (m *Manager) Enabled() bool
- func (m *Manager) Exec(ctx context.Context, id string, args map[string]any) (ExecResult, error)
- func (m *Manager) GetTool(id string) (ToolInfo, bool)
- func (m *Manager) ListTools() []ToolInfo
- func (m *Manager) Reconcile(parent context.Context, cfg Config, enabled bool)
- func (m *Manager) Resolve(id string) (Target, bool)
- func (m *Manager) SetDial(dial DialFunc)
- func (m *Manager) SetSupervisorConfig(cfg SupervisorConfig)
- func (m *Manager) Statuses() []ServerStatus
- func (m *Manager) ValidTools() []ToolInfo
- type ServerConfig
- type ServerStatus
- type Session
- type SupervisorConfig
- type Target
- type Tool
- type ToolInfo
Constants ¶
View Source
const ( PluginName = "mcp" PluginID = "tool/mcp" TransportStdio = "stdio" TransportSSE = "sse" TransportStreamableHTTP = "streamable_http" TransportHTTP = "http" DefaultTimeoutSeconds = 30 )
View Source
const (
RuntimeName = "manager"
)
Variables ¶
This section is empty.
Functions ¶
func BaseToolID ¶
func LookupRuntime ¶
func LookupRuntime(lookup pkgplugins.RuntimeLookup) (runtimeAccessor, bool)
func SanitizeName ¶
func SetDefaultManager ¶
func SetDefaultManager(manager *Manager)
Types ¶
type CanonicalRegistry ¶
type CanonicalRegistry struct {
// contains filtered or unexported fields
}
CanonicalRegistry maintains a stable mapping from canonical Anna MCP tool IDs to the original MCP server/tool names.
func NewCanonicalRegistry ¶
func NewCanonicalRegistry() *CanonicalRegistry
func (*CanonicalRegistry) Add ¶
func (r *CanonicalRegistry) Add(serverName, toolName string) string
func (*CanonicalRegistry) Reset ¶
func (r *CanonicalRegistry) Reset()
func (*CanonicalRegistry) Snapshot ¶
func (r *CanonicalRegistry) Snapshot() map[string]Target
type Config ¶
type Config struct {
Servers []ServerConfig `json:"servers"`
}
Config is the persisted MCP plugin config.
func (Config) EnabledServers ¶
func (c Config) EnabledServers() []ServerConfig
func (Config) HasEnabledServers ¶
type DialFunc ¶
type DialFunc func(ctx context.Context, server ServerConfig) (Session, error)
DialFunc establishes one MCP client session for the provided server config.
type ErrUnsupportedTransport ¶
type ErrUnsupportedTransport struct {
Transport string
}
func (ErrUnsupportedTransport) Error ¶
func (e ErrUnsupportedTransport) Error() string
type ExecResult ¶
type ExecResult struct {
OK bool `json:"ok"`
ID string `json:"id"`
ServerName string `json:"server_name"`
ToolName string `json:"tool_name"`
Content any `json:"content,omitempty"`
Structured map[string]any `json:"structured,omitempty"`
IsError bool `json:"is_error"`
Meta map[string]any `json:"meta,omitempty"`
}
ExecResult is the normalized result shape returned by the mcp tool.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the shared process-wide runtime for MCP state.
func DefaultManager ¶
func DefaultManager() *Manager
func NewManager ¶
func NewManager() *Manager
func (*Manager) SetSupervisorConfig ¶
func (m *Manager) SetSupervisorConfig(cfg SupervisorConfig)
func (*Manager) Statuses ¶
func (m *Manager) Statuses() []ServerStatus
func (*Manager) ValidTools ¶
type ServerConfig ¶
type ServerConfig struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Transport string `json:"transport"`
Command string `json:"command"`
Args []string `json:"args"`
Env map[string]string `json:"env"`
URL string `json:"url"`
Headers map[string]string `json:"headers"`
TimeoutSeconds int `json:"timeout_seconds"`
}
ServerConfig describes one managed MCP server.
func (ServerConfig) Validate ¶
func (s ServerConfig) Validate() error
func (ServerConfig) WithDefaults ¶
func (s ServerConfig) WithDefaults() ServerConfig
type ServerStatus ¶
type ServerStatus struct {
Name string `json:"name"`
Transport string `json:"transport"`
State string `json:"state"`
Failures int `json:"failures"`
Suppressed bool `json:"suppressed"`
LastError string `json:"last_error,omitempty"`
LastConnectedAt time.Time `json:"last_connected_at"`
LastDiscoveredAt time.Time `json:"last_discovered_at"`
DiscoveredToolCount int `json:"discovered_tool_count"`
}
ServerStatus describes the current runtime state of one managed MCP server.
type Session ¶
type Session interface {
Close() error
Wait() error
ListTools(ctx context.Context, params *officialmcp.ListToolsParams) (*officialmcp.ListToolsResult, error)
CallTool(ctx context.Context, params *officialmcp.CallToolParams) (*officialmcp.CallToolResult, error)
}
Session is the subset of MCP client session behavior used by Anna's runtime.
type SupervisorConfig ¶
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
func (*Tool) Definition ¶
func (t *Tool) Definition() tools.Definition
type ToolInfo ¶
type ToolInfo struct {
ID string `json:"id"`
ServerName string `json:"server_name"`
ToolName string `json:"tool_name"`
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"input_schema,omitempty"`
OutputSchema map[string]any `json:"output_schema,omitempty"`
Annotations map[string]any `json:"annotations,omitempty"`
Valid bool `json:"valid"`
}
ToolInfo is Anna's cached normalized view of one MCP tool.
Click to show internal directories.
Click to hide internal directories.