Documentation
¶
Index ¶
- Constants
- func FilterRequestTools(activation *ToolActivation) func([]tools.Tool) []tools.Tool
- func FromConfigMap(in map[string]config.MCPServer) map[string]ServerConfig
- func ParseToolName(name string) (srvKey, tool string, ok bool)
- func Serve(ctx context.Context, version string) error
- func ToolName(server, tool string) string
- type CredentialBridge
- type LiveAuth
- type LiveManager
- func (m *LiveManager) Close()
- func (m *LiveManager) Reload() error
- func (m *LiveManager) Replace(ctx context.Context, settings LiveSettings) error
- func (m *LiveManager) Search(ctx context.Context, query string, cwd string, selected []string, limit int) []tools.Tool
- func (m *LiveManager) SetCredentialBridge(bridge CredentialBridge)
- func (m *LiveManager) SetOnChange(fn func())
- func (m *LiveManager) SetSave(fn func(LiveSettings) error)
- func (m *LiveManager) Settings() LiveSettings
- func (m *LiveManager) Statuses() []LiveStatus
- func (m *LiveManager) ToolsFor(ctx context.Context, cwd string, selected []string) []tools.Tool
- func (m *LiveManager) ToolsForTurn(ctx context.Context, cwd string, selected []string, activation *ToolActivation) ([]tools.Tool, func([]tools.Tool) []tools.Tool)
- type LiveServer
- type LiveSettings
- type LiveStatus
- type Manager
- func (m *Manager) AddServers(ctx context.Context, cfgs map[string]ServerConfig)
- func (m *Manager) Close()
- func (m *Manager) Config(name string) (ServerConfig, bool)
- func (m *Manager) Disable(name string) bool
- func (m *Manager) Enable(name string) bool
- func (m *Manager) EnableElicitation()
- func (m *Manager) FireOnChangeForTest()
- func (m *Manager) InstructionsBlock() string
- func (m *Manager) Reconnect(name string) bool
- func (m *Manager) RemoveServers(names ...string)
- func (m *Manager) SetOnChange(fn func())
- func (m *Manager) Start(ctx context.Context)
- func (m *Manager) Statuses() []Server
- func (m *Manager) Tools() []tools.Tool
- type ProbeResult
- type Server
- type ServerConfig
- type Status
- type ToolActivation
Constants ¶
View Source
const (
ToolSearchName = "ToolSearch"
)
Variables ¶
This section is empty.
Functions ¶
func FilterRequestTools ¶ added in v0.107.0
func FilterRequestTools(activation *ToolActivation) func([]tools.Tool) []tools.Tool
func FromConfigMap ¶
func FromConfigMap(in map[string]config.MCPServer) map[string]ServerConfig
func ParseToolName ¶
Types ¶
type CredentialBridge ¶ added in v0.107.0
CredentialBridge resolves a native-host credential without moving the secret into the K-brain settings file or HTTP API.
type LiveManager ¶ added in v0.107.0
type LiveManager struct {
// contains filtered or unexported fields
}
func NewLiveManager ¶ added in v0.107.0
func NewLiveManager(ctx context.Context, path string, settings LiveSettings) (*LiveManager, error)
func OpenLiveManager ¶ added in v0.107.0
func OpenLiveManager(ctx context.Context, path string, fallback map[string]ServerConfig) (*LiveManager, error)
func (*LiveManager) Close ¶ added in v0.107.0
func (m *LiveManager) Close()
func (*LiveManager) Reload ¶ added in v0.107.0
func (m *LiveManager) Reload() error
func (*LiveManager) Replace ¶ added in v0.107.0
func (m *LiveManager) Replace(ctx context.Context, settings LiveSettings) error
func (*LiveManager) SetCredentialBridge ¶ added in v0.107.0
func (m *LiveManager) SetCredentialBridge(bridge CredentialBridge)
func (*LiveManager) SetOnChange ¶ added in v0.107.0
func (m *LiveManager) SetOnChange(fn func())
func (*LiveManager) SetSave ¶ added in v0.107.0
func (m *LiveManager) SetSave(fn func(LiveSettings) error)
func (*LiveManager) Settings ¶ added in v0.107.0
func (m *LiveManager) Settings() LiveSettings
func (*LiveManager) Statuses ¶ added in v0.107.0
func (m *LiveManager) Statuses() []LiveStatus
func (*LiveManager) ToolsForTurn ¶ added in v0.107.0
type LiveServer ¶ added in v0.107.0
type LiveServer struct {
ID string `json:"id"`
Description string `json:"description,omitempty"`
DocsURL string `json:"docsUrl,omitempty"`
Enabled bool `json:"enabled"`
Transport string `json:"transport"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
URL string `json:"url,omitempty"`
Env map[string]string `json:"env,omitempty"`
Cwd string `json:"cwd,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
TimeoutMs int `json:"timeoutMs,omitempty"`
WorkspaceRoots []string `json:"workspaceRoots,omitempty"`
Policy map[string]string `json:"policy,omitempty"`
Auth *LiveAuth `json:"auth,omitempty"`
}
type LiveSettings ¶ added in v0.107.0
type LiveSettings struct {
Servers []LiveServer `json:"servers"`
Selected []string `json:"selected,omitempty"`
}
type LiveStatus ¶ added in v0.107.0
type LiveStatus struct {
LiveServer
Status string `json:"status"`
Error string `json:"error,omitempty"`
Tools int `json:"tools"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(cfgs map[string]ServerConfig) *Manager
func (*Manager) AddServers ¶
func (m *Manager) AddServers(ctx context.Context, cfgs map[string]ServerConfig)
func (*Manager) EnableElicitation ¶ added in v0.107.26
func (m *Manager) EnableElicitation()
EnableElicitation makes the manager declare the MCP elicitation capability (form mode) and route servers' elicitations to the front end in the tool call's context (internal/elicit). Call it before Start; a manager without it declares no elicitation capability, so servers cannot ask.
func (*Manager) FireOnChangeForTest ¶
func (m *Manager) FireOnChangeForTest()
func (*Manager) InstructionsBlock ¶
func (*Manager) RemoveServers ¶
func (*Manager) SetOnChange ¶
func (m *Manager) SetOnChange(fn func())
type ProbeResult ¶
func Probe ¶
func Probe(ctx context.Context, name string, cfg ServerConfig) ProbeResult
type ServerConfig ¶
type ServerConfig struct {
Command []string `json:"command,omitempty"`
Env map[string]string `json:"env,omitempty"`
Cwd string `json:"cwd,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Note string `json:"note,omitempty"`
StartupTimeout int `json:"startupTimeout,omitempty"`
ToolTimeout int `json:"toolTimeout,omitempty"`
Source string `json:"-"`
}
func (ServerConfig) Disabled ¶
func (c ServerConfig) Disabled() bool
func (ServerConfig) Remote ¶
func (c ServerConfig) Remote() bool
func (ServerConfig) StartupTimeoutDuration ¶
func (c ServerConfig) StartupTimeoutDuration() time.Duration
func (ServerConfig) ToolTimeoutDuration ¶
func (c ServerConfig) ToolTimeoutDuration() time.Duration
func (ServerConfig) Valid ¶
func (c ServerConfig) Valid() string
type ToolActivation ¶ added in v0.107.0
type ToolActivation struct {
// contains filtered or unexported fields
}
func NewToolActivation ¶ added in v0.107.0
func NewToolActivation() *ToolActivation
func (*ToolActivation) Add ¶ added in v0.107.0
func (a *ToolActivation) Add(name string)
func (*ToolActivation) Has ¶ added in v0.107.0
func (a *ToolActivation) Has(name string) bool
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mcptest provides a minimal MCP server for tests that need to control the exact bytes a server sends, such as an elicitation's requestedSchema with its property order or a schema outside the subset.
|
Package mcptest provides a minimal MCP server for tests that need to control the exact bytes a server sends, such as an elicitation's requestedSchema with its property order or a schema outside the subset. |
Click to show internal directories.
Click to hide internal directories.