config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config provides configuration management for CoreMCP. It supports YAML configuration files and environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server      ServerConfig       `mapstructure:"server"`
	Logging     LoggingConfig      `mapstructure:"logging"`
	Sources     []SourceConfig     `mapstructure:"sources"`
	CustomTools []CustomToolConfig `mapstructure:"custom_tools"`
	Security    SecurityConfig     `mapstructure:"security"`
}

Config represents the complete CoreMCP configuration.

func LoadConfig

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

LoadConfig loads the CoreMCP configuration from a YAML file. It supports environment variables with COREMCP_ prefix and provides sensible defaults. The path parameter can be a directory or a full file path.

type CustomToolConfig added in v0.2.0

type CustomToolConfig struct {
	Name        string          `mapstructure:"name"`        // Tool name (e.g., "get_daily_sales")
	Description string          `mapstructure:"description"` // Tool description for AI
	Source      string          `mapstructure:"source"`      // Which source to run against
	Query       string          `mapstructure:"query"`       // SQL query template
	Parameters  []ToolParameter `mapstructure:"parameters"`  // Optional parameters
}

CustomToolConfig defines a custom MCP tool with a predefined query.

type LoggingConfig

type LoggingConfig struct {
	Level  string `mapstructure:"level"`
	Format string `mapstructure:"format"`
}

type PIIMaskPattern added in v0.2.0

type PIIMaskPattern struct {
	Name        string `mapstructure:"name"`        // Pattern name (e.g., "credit_card")
	Pattern     string `mapstructure:"pattern"`     // Regex pattern
	Replacement string `mapstructure:"replacement"` // Replacement string (default: "***")
	Enabled     bool   `mapstructure:"enabled"`     // Whether this pattern is active
}

PIIMaskPattern defines a pattern for masking PII data.

type SecurityConfig added in v0.2.0

type SecurityConfig struct {
	MaxRowLimit      int              `mapstructure:"max_row_limit"`      // Maximum rows to return (default: 1000)
	EnablePIIMasking bool             `mapstructure:"enable_pii_masking"` // Enable PII data masking
	PIIPatterns      []PIIMaskPattern `mapstructure:"pii_patterns"`       // PII patterns to mask
	AllowedKeywords  []string         `mapstructure:"allowed_keywords"`   // SQL keywords to allow beyond SELECT/WITH
	BlockedKeywords  []string         `mapstructure:"blocked_keywords"`   // Additional SQL keywords to block
}

SecurityConfig holds security-related configuration.

type ServerConfig

type ServerConfig struct {
	Name      string `mapstructure:"name"`
	Version   string `mapstructure:"version"`
	Transport string `mapstructure:"transport"`
	Port      int    `mapstructure:"port"`
}

ServerConfig holds server-related configuration.

type SourceConfig

type SourceConfig struct {
	Name     string `mapstructure:"name"`
	Type     string `mapstructure:"type"` // mssql, firebird, postgres
	DSN      string `mapstructure:"dsn"`  // Data Source Name (Connection String)
	ReadOnly bool   `mapstructure:"readonly"`
}

type ToolParameter added in v0.2.0

type ToolParameter struct {
	Name        string `mapstructure:"name"`
	Description string `mapstructure:"description"`
	Required    bool   `mapstructure:"required"`
	Default     string `mapstructure:"default"`
}

ToolParameter defines a parameter for a custom tool.

Jump to

Keyboard shortcuts

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