Documentation
¶
Overview ¶
Package server provides the MCP server context for klausctl.
Index ¶
- func JSONResult(v any) (*mcp.CallToolResult, error)
- type ServerContext
- func (sc *ServerContext) DetectRuntime(cfg *config.Config) (runtime.Runtime, error)
- func (sc *ServerContext) InstancePaths(name string) *config.Paths
- func (sc *ServerContext) LoadInstanceConfig(name string) (*config.Config, error)
- func (sc *ServerContext) ReloadSourceConfig() error
- func (sc *ServerContext) SetSourceConfig(cfg *config.SourceConfig)
- func (sc *ServerContext) SourceConfig() *config.SourceConfig
- func (sc *ServerContext) SourceResolver() *config.SourceResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONResult ¶
func JSONResult(v any) (*mcp.CallToolResult, error)
JSONResult serializes v as indented JSON and returns it as an MCP text result.
Types ¶
type ServerContext ¶
type ServerContext struct {
Paths *config.Paths
MCPClient *mcpclient.Client
// contains filtered or unexported fields
}
ServerContext is a lightweight dependency container passed to MCP tool handlers. It provides access to klausctl paths, runtime detection, and the MCP client for agent communication.
func (*ServerContext) DetectRuntime ¶
DetectRuntime creates a Runtime from the given config, auto-detecting when the config runtime field is empty.
func (*ServerContext) InstancePaths ¶
func (sc *ServerContext) InstancePaths(name string) *config.Paths
InstancePaths returns config paths scoped to a named instance.
func (*ServerContext) LoadInstanceConfig ¶
func (sc *ServerContext) LoadInstanceConfig(name string) (*config.Config, error)
LoadInstanceConfig loads the config for a named instance.
func (*ServerContext) ReloadSourceConfig ¶ added in v0.0.23
func (sc *ServerContext) ReloadSourceConfig() error
ReloadSourceConfig re-reads the sources file from disk and updates the in-memory config. This should be called after mutating the sources file.
func (*ServerContext) SetSourceConfig ¶ added in v0.0.23
func (sc *ServerContext) SetSourceConfig(cfg *config.SourceConfig)
SetSourceConfig sets the loaded source configuration.
func (*ServerContext) SourceConfig ¶ added in v0.0.23
func (sc *ServerContext) SourceConfig() *config.SourceConfig
SourceConfig returns the current in-memory source configuration. If none has been loaded, a default config with only the built-in source is returned.
func (*ServerContext) SourceResolver ¶ added in v0.0.23
func (sc *ServerContext) SourceResolver() *config.SourceResolver
SourceResolver returns a SourceResolver from the loaded source config. If no source config has been loaded, the default built-in source is used.