server

package
v0.0.63 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package server provides the MCP server context for klausctl.

Index

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

func (sc *ServerContext) DetectRuntime(cfg *config.Config) (runtime.Runtime, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL