config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config loads and validates runtime configuration for the aws-mcp server from environment variables.

Credentials are NOT read here: aws-mcp uses the standard AWS credential chain (environment, shared config/credentials files, SSO, or an attached IAM role) via aws-sdk-go-v2. This package only carries server behavior plus an optional region override.

Index

Constants

View Source
const (
	EnvRegion   = "AWS_REGION"   // optional region override (standard AWS var)
	EnvToolsets = "AWS_TOOLSETS" // comma-separated toolset names, or "all"
	EnvReadOnly = "AWS_READONLY" // "true" disables all write tools
)

Environment variable names recognised by the server. AWS_REGION is the standard SDK variable and is reused here as the region override.

View Source
const EnvFile = ".env"

EnvFile is the default dotenv filename loaded for local development.

Variables

This section is empty.

Functions

func LoadEnvFile

func LoadEnvFile(path string) error

LoadEnvFile loads KEY=VALUE pairs from a dotenv file into the process environment. It is intended for local development: run `cp .env.example .env`, fill it in, and the server picks it up on startup.

Lines may be blank, comments (#...), or KEY=VALUE (an optional leading "export " is ignored, and surrounding single/double quotes are stripped from the value). A variable that already has a non-empty value in the environment is left untouched, so real shell variables take precedence over the file. A missing file is not an error.

Types

type Config

type Config struct {
	// Region overrides the credential-chain region when non-empty.
	Region string
	// Toolsets is the set of enabled toolset names. A nil/empty set means "all".
	Toolsets []string
	// ReadOnly, when true, suppresses mutating tools at registration time.
	ReadOnly bool
}

Config holds validated server configuration.

func Load

func Load() (*Config, error)

Load reads configuration from the process environment. aws-mcp has no required configuration (credentials come from the AWS chain), so Load never fails today; it returns an error for signature parity with the other servers.

func (*Config) AllToolsets

func (c *Config) AllToolsets() bool

AllToolsets reports whether every toolset should be enabled.

func (*Config) ToolsetEnabled

func (c *Config) ToolsetEnabled(name string) bool

ToolsetEnabled reports whether the named toolset should be registered.

Jump to

Keyboard shortcuts

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