Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config loads and validates server configuration from environment variables.

Index

Constants

View Source
const (
	DefaultMaxFileSize = 2 * 1024 * 1024 * 1024    // 2 GB
	MaxFileSize        = 1024 * 1024 * 1024 * 1024 // 1 TB upper bound
)

Upload size defaults.

View Source
const (
	DefaultMaxHTTPClients     = 100
	DefaultSessionTimeout     = 30 * time.Minute
	DefaultRevalidateInterval = 15 * time.Minute
	MaxHTTPClients            = 10000
	MaxSessionTimeout         = 24 * time.Hour
	MaxRevalidateInterval     = 24 * time.Hour
)

HTTP pool defaults.

View Source
const (
	DefaultOAuthCacheTTL = 15 * time.Minute
	MinOAuthCacheTTL     = 1 * time.Minute
	MaxOAuthCacheTTL     = 2 * time.Hour
)

OAuth defaults.

View Source
const (
	DefaultAutoUpdateRepo     = "jmrplens/gitlab-mcp-server"
	DefaultAutoUpdateInterval = 1 * time.Hour
	DefaultAutoUpdateTimeout  = 60 * time.Second
	MinAutoUpdateTimeout      = 5 * time.Second
	MaxAutoUpdateTimeout      = 10 * time.Minute
)

Auto-update defaults.

View Source
const (
	// DefaultRateLimitBurst is the bucket size used when rps > 0 and the
	// operator did not set RATE_LIMIT_BURST explicitly.
	DefaultRateLimitBurst = 40
)

Rate-limit defaults.

View Source
const EnvFileName = ".gitlab-mcp-server.env"

EnvFileName is the name of the env file where the setup wizard stores secrets.

Variables

This section is empty.

Functions

func ParseCSV added in v1.0.6

func ParseCSV(s string) []string

ParseCSV splits a comma-separated string into trimmed, non-empty tokens.

Types

type Config

type Config struct {
	GitLabURL     string
	GitLabToken   string
	SkipTLSVerify bool
	MetaTools     bool
	Enterprise    bool
	ReadOnly      bool
	SafeMode      bool

	EmbeddedResources bool // Append EmbeddedResource content blocks to get_* tool results (default true)

	UploadMaxFileSize int64

	MaxHTTPClients     int           // Maximum unique tokens in the server pool (HTTP mode only)
	SessionTimeout     time.Duration // Idle MCP session timeout (HTTP mode only)
	RevalidateInterval time.Duration // Token re-validation interval (HTTP mode only)

	AutoUpdate         string        // Auto-update mode: "true" (auto), "check" (log-only), "false" (disabled)
	AutoUpdateRepo     string        // GitLab project path for update checks
	AutoUpdateInterval time.Duration // How often to check for updates (HTTP mode)
	AutoUpdateTimeout  time.Duration // Timeout for pre-start update check (stdio mode)

	AuthMode      string        // Auth mode for HTTP: "legacy" (default) or "oauth"
	OAuthCacheTTL time.Duration // OAuth token cache TTL (HTTP mode, oauth auth mode)

	TrustedProxyHeader string   // HTTP header with real client IP (e.g. X-Forwarded-For, X-Real-IP)
	ExcludeTools       []string // Tool names to exclude from registration (comma-separated via EXCLUDE_TOOLS)
	IgnoreScopes       bool     // When true, skip PAT scope detection and register all tools
	TokenScopes        []string // Detected PAT scopes (populated at runtime, not from env)

	RateLimitRPS   float64 // Per-server tools/call rate limit in requests/second (0 = disabled)
	RateLimitBurst int     // Token-bucket burst size when RateLimitRPS > 0
}

Config holds all configuration values for the MCP server.

func Load

func Load() (*Config, error)

Load reads configuration from environment variables. It attempts to load a .env file from the current directory first, then falls back to ~/.gitlab-mcp-server.env (written by the setup wizard) for secrets not provided via the environment or CWD .env.

Jump to

Keyboard shortcuts

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