config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleConfigPath

func ExampleConfigPath() string

ExampleConfigPath returns the default config file path (for help messages).

func LoadFallbackServers

func LoadFallbackServers() (map[string]ServerConfig, error)

LoadFallbackServers imports server configs from standard mcpServers JSON documents used by existing MCP clients.

func MergeFallbackServers

func MergeFallbackServers(cfg *Config) error

MergeFallbackServers fills cfg.Servers from external MCP fallback sources when the primary config has no servers.

func Validate

func Validate(cfg *Config) error

Validate checks configuration invariants and returns actionable errors.

Types

type Config

type Config struct {
	Servers         map[string]ServerConfig `toml:"servers"`
	FallbackSources []string                `toml:"fallback_sources"`
}

Config is the top-level mcpx configuration.

func Load

func Load() (*Config, error)

Load reads the config file and returns the parsed Config. If the config file does not exist, it returns an empty Config (no error).

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom reads and parses a config file at the given path.

type ServerConfig

type ServerConfig struct {
	// Stdio transport
	Command string            `toml:"command"`
	Args    []string          `toml:"args"`
	Env     map[string]string `toml:"env"`

	// HTTP transport
	URL     string            `toml:"url"`
	Headers map[string]string `toml:"headers"`

	// Caching
	DefaultCacheTTL string                `toml:"default_cache_ttl"`
	NoCacheTools    []string              `toml:"no_cache_tools"`
	Tools           map[string]ToolConfig `toml:"tools"`
}

ServerConfig describes how to connect to a single MCP server.

func (ServerConfig) IsHTTP

func (s ServerConfig) IsHTTP() bool

IsHTTP returns true if the server uses HTTP transport.

func (ServerConfig) IsStdio

func (s ServerConfig) IsStdio() bool

IsStdio returns true if the server uses stdio transport.

type ToolConfig

type ToolConfig struct {
	Cache *bool `toml:"cache"`
}

ToolConfig holds per-tool overrides.

Jump to

Keyboard shortcuts

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