Documentation
¶
Overview ¶
Package config turns the command line and the environment into a validated Config.
Index ¶
Constants ¶
const ( // Restricted is the default access mode: read-only, with the SQL safety checks. Restricted = "restricted" // Unrestricted lets tools modify the database. Unrestricted = "unrestricted" )
Access modes.
const ( // Stdio serves MCP over stdin and stdout. Stdio = "stdio" // StreamableHTTP serves MCP streamable HTTP on /mcp. StreamableHTTP = "streamable-http" // SSE serves the deprecated MCP SSE transport on /sse. SSE = "sse" )
Transports.
Variables ¶
var Groups = []string{"schema", "query", "explain", "stats", "health", "index", "locks"}
Groups lists the tool groups, in the order used by error messages.
Functions ¶
func IsLoopback ¶
IsLoopback reports whether host is the name localhost or an address of 127.0.0.0/8 or ::1.
Types ¶
type Config ¶
type Config struct {
DSN string
AccessMode string // Restricted or Unrestricted
Transport string // Stdio, StreamableHTTP or SSE
Host string // HTTP transports: bind address
Port int // HTTP transports: bind port
AllowRemote bool // HTTP transports: allow a non-loopback Host
AllowedHosts, AllowedOrigins []string
Tools []string // enabled groups, "all" expanded
MaxRows, MaxRowsLimit int
MaxBytes, MaxCell int
MaxCellLimit int
StatementTimeout time.Duration
AllowFunctions, DenyFunctions []string
ShowVersion bool // --version: Parse returned before any other validation
}
Config is the effective configuration of one server process.
func Parse ¶
Parse reads the flags in args (without the program name) and the environment. The returned error text is meant to be printed after "error: ".
func (*Config) ToolEnabled ¶
ToolEnabled reports whether the tool group is enabled by --tools.