Documentation
¶
Index ¶
- type ConfigProvider
- type Configuration
- type GuardrailConfig
- type NodeGuardrailCfg
- type Provider
- func (cp Provider) AddHost(hostId string, host models.Host)
- func (cp Provider) AddIdentity(identityId string, identity models.Identity)
- func (cp Provider) AddNode(nodeId string, node models.Node)
- func (cp Provider) DeleteIdentity(name string)
- func (cp Provider) DeleteNode(nodeId string)
- func (cp Provider) Find(input string) string
- func (cp Provider) GetHost(nodeId string) (models.Host, bool)
- func (cp Provider) GetIdentity(nodeId string) (models.Identity, bool)
- func (cp Provider) GetNode(nodeId string) (models.Node, bool)
- func (cp Provider) GetNodesByTag(tag string) map[string]models.Node
- func (cp Provider) ListIdentities() map[string]models.Identity
- func (cp Provider) ListNodes() map[string]models.Node
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶
type ConfigProvider interface {
GetNode(name string) (models.Node, bool)
GetHost(name string) (models.Host, bool)
GetIdentity(name string) (models.Identity, bool)
AddHost(name string, host models.Host)
AddIdentity(name string, identity models.Identity)
AddNode(name string, node models.Node)
DeleteNode(name string)
ListNodes() map[string]models.Node
GetNodesByTag(tag string) map[string]models.Node
ListIdentities() map[string]models.Identity
DeleteIdentity(name string)
Find(input string) string
}
ConfigProvider 定义 Connector 获取配置数据的接口
func NewProvider ¶
func NewProvider(cfg *Configuration) ConfigProvider
type Configuration ¶
type Configuration struct {
Identities *concurrent.Map[string, models.Identity] `yaml:"identities"`
Hosts *concurrent.Map[string, models.Host] `yaml:"hosts"`
Nodes *concurrent.Map[string, models.Node] `yaml:"nodes"`
Guardrail *GuardrailConfig `yaml:"guardrail,omitempty"`
}
Configuration 对应 yaml 文件的顶层结构
type GuardrailConfig ¶
type GuardrailConfig struct {
Enabled bool `yaml:"enabled"`
AuditLog string `yaml:"audit_log,omitempty"`
ApprovalThreshold string `yaml:"approval_threshold,omitempty"` // "safe"|"moderate"|"dangerous"
BlockedPatterns []string `yaml:"blocked_patterns,omitempty"`
ProtectedPaths []string `yaml:"protected_paths,omitempty"`
NodeOverrides map[string]NodeGuardrailCfg `yaml:"nodes,omitempty"`
// NoElicitFallback controls behavior when the MCP client does not support
// Elicitation (e.g. Gemini CLI).
// "deny" — reject all operations that need approval (most secure)
// "allow" — allow all, trust client-side tool approval + ToolAnnotations
// "downgrade" — allow moderate, still deny dangerous (recommended default)
NoElicitFallback string `yaml:"no_elicit_fallback,omitempty"`
}
GuardrailConfig configures the MCP safety guardrail.
type NodeGuardrailCfg ¶
type NodeGuardrailCfg struct {
ApprovalThreshold string `yaml:"approval_threshold"`
}
NodeGuardrailCfg holds per-node (glob pattern) policy overrides.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func (Provider) AddIdentity ¶
func (Provider) DeleteIdentity ¶
func (Provider) DeleteNode ¶
type Store ¶
type Store interface {
Load() (*Configuration, error)
Save(cfg *Configuration) error
}
func NewDefaultStore ¶
Click to show internal directories.
Click to hide internal directories.