config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"`
	AllowedMethods []string `json:"allowed_methods" yaml:"allowed_methods"`
	AllowedHeaders []string `json:"allowed_headers" yaml:"allowed_headers"`
}

CORSConfig contains CORS settings

type CacheConfig

type CacheConfig struct {
	Enabled    bool          `json:"enabled" yaml:"enabled"`
	TTL        time.Duration `json:"ttl" yaml:"ttl"`
	MaxEntries int           `json:"max_entries" yaml:"max_entries"`
}

CacheConfig contains caching settings

type Config

type Config struct {
	// Server configuration
	Server ServerConfig `json:"server" yaml:"server"`

	// gRPC configuration
	GRPC GRPCConfig `json:"grpc" yaml:"grpc"`

	// MCP configuration
	MCP MCPConfig `json:"mcp" yaml:"mcp"`

	// Session configuration
	Session SessionConfig `json:"session" yaml:"session"`

	// Tools configuration
	Tools ToolsConfig `json:"tools" yaml:"tools"`

	// Logging configuration
	Logging LoggingConfig `json:"logging" yaml:"logging"`
}

Config holds all configuration for the ggRMCP application

func Default

func Default() *Config

Default returns a configuration with sensible defaults

func Development

func Development() *Config

Development returns a configuration suitable for development

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type DescriptorSetConfig

type DescriptorSetConfig struct {
	// Enable FileDescriptorSet support
	Enabled bool `json:"enabled" yaml:"enabled"`

	// Path to the FileDescriptorSet file (.binpb)
	Path string `json:"path" yaml:"path"`

	// Prefer descriptor set over reflection (if both available)
	PreferOverReflection bool `json:"prefer_over_reflection" yaml:"prefer_over_reflection"`

	// Include source location info for comment extraction
	IncludeSourceInfo bool `json:"include_source_info" yaml:"include_source_info"`
}

DescriptorSetConfig contains FileDescriptorSet settings

type GRPCConfig

type GRPCConfig struct {
	// gRPC server host
	Host string `json:"host" yaml:"host"`

	// gRPC server port
	Port int `json:"port" yaml:"port"`

	// Connection timeout
	ConnectTimeout time.Duration `json:"connect_timeout" yaml:"connect_timeout"`

	// Request timeout
	RequestTimeout time.Duration `json:"request_timeout" yaml:"request_timeout"`

	// Keep-alive settings
	KeepAlive KeepAliveConfig `json:"keep_alive" yaml:"keep_alive"`

	// Reconnection settings
	Reconnect ReconnectConfig `json:"reconnect" yaml:"reconnect"`

	// Message size limits
	MaxMessageSize int `json:"max_message_size" yaml:"max_message_size"`

	// Header forwarding configuration
	HeaderForwarding HeaderForwardingConfig `json:"header_forwarding" yaml:"header_forwarding"`

	// FileDescriptorSet configuration
	DescriptorSet DescriptorSetConfig `json:"descriptor_set" yaml:"descriptor_set"`
}

GRPCConfig contains gRPC client settings

type HeaderForwardingConfig

type HeaderForwardingConfig struct {
	// Enable header forwarding
	Enabled bool `json:"enabled" yaml:"enabled"`

	// List of headers to forward to gRPC server
	AllowedHeaders []string `json:"allowed_headers" yaml:"allowed_headers"`

	// List of headers to block (takes precedence over allowed)
	BlockedHeaders []string `json:"blocked_headers" yaml:"blocked_headers"`

	// Whether to forward all headers by default (not recommended for security)
	ForwardAll bool `json:"forward_all" yaml:"forward_all"`

	// Case sensitive header matching
	CaseSensitive bool `json:"case_sensitive" yaml:"case_sensitive"`
}

HeaderForwardingConfig contains header forwarding settings

type KeepAliveConfig

type KeepAliveConfig struct {
	Time                time.Duration `json:"time" yaml:"time"`
	Timeout             time.Duration `json:"timeout" yaml:"timeout"`
	PermitWithoutStream bool          `json:"permit_without_stream" yaml:"permit_without_stream"`
}

KeepAliveConfig contains keep-alive settings

type LoggingConfig

type LoggingConfig struct {
	Level       string `json:"level" yaml:"level"`
	Format      string `json:"format" yaml:"format"`
	Development bool   `json:"development" yaml:"development"`
}

LoggingConfig contains logging settings

type MCPConfig

type MCPConfig struct {
	// Validation limits
	Validation ValidationConfig `json:"validation" yaml:"validation"`

	// Protocol version
	ProtocolVersion string `json:"protocol_version" yaml:"protocol_version"`
}

MCPConfig contains MCP protocol settings

type RateLimitConfig

type RateLimitConfig struct {
	RequestsPerMinute int           `json:"requests_per_minute" yaml:"requests_per_minute"`
	BurstSize         int           `json:"burst_size" yaml:"burst_size"`
	WindowSize        time.Duration `json:"window_size" yaml:"window_size"`
}

RateLimitConfig contains rate limiting settings

type ReconnectConfig

type ReconnectConfig struct {
	Interval    time.Duration `json:"interval" yaml:"interval"`
	MaxAttempts int           `json:"max_attempts" yaml:"max_attempts"`
}

ReconnectConfig contains reconnection settings

type SecurityConfig

type SecurityConfig struct {
	// Enable security headers
	EnableHeaders bool `json:"enable_headers" yaml:"enable_headers"`

	// CORS settings
	CORS CORSConfig `json:"cors" yaml:"cors"`

	// Rate limiting
	RateLimit RateLimitConfig `json:"rate_limit" yaml:"rate_limit"`
}

SecurityConfig contains security-related settings

type ServerConfig

type ServerConfig struct {
	// HTTP server port
	Port int `json:"port" yaml:"port"`

	// Request timeout
	Timeout time.Duration `json:"timeout" yaml:"timeout"`

	// Maximum request size
	MaxRequestSize int64 `json:"max_request_size" yaml:"max_request_size"`

	// Security headers configuration
	Security SecurityConfig `json:"security" yaml:"security"`
}

ServerConfig contains HTTP server settings

type SessionConfig

type SessionConfig struct {
	// Session expiration time
	Expiration time.Duration `json:"expiration" yaml:"expiration"`

	// Cleanup interval
	CleanupInterval time.Duration `json:"cleanup_interval" yaml:"cleanup_interval"`

	// Maximum number of concurrent sessions
	MaxSessions int `json:"max_sessions" yaml:"max_sessions"`

	// Session rate limiting
	RateLimit SessionRateLimitConfig `json:"rate_limit" yaml:"rate_limit"`
}

SessionConfig contains session management settings

type SessionRateLimitConfig

type SessionRateLimitConfig struct {
	RequestsPerMinute int           `json:"requests_per_minute" yaml:"requests_per_minute"`
	BurstSize         int           `json:"burst_size" yaml:"burst_size"`
	WindowSize        time.Duration `json:"window_size" yaml:"window_size"`
}

SessionRateLimitConfig contains session-specific rate limiting

type ToolsConfig

type ToolsConfig struct {
	// Schema cache settings
	Cache CacheConfig `json:"cache" yaml:"cache"`

	// Schema generation limits
	MaxDepth      int `json:"max_depth" yaml:"max_depth"`
	MaxFields     int `json:"max_fields" yaml:"max_fields"`
	MaxEnumValues int `json:"max_enum_values" yaml:"max_enum_values"`
}

ToolsConfig contains tool building settings

type ValidationConfig

type ValidationConfig struct {
	MaxFieldLength    int   `json:"max_field_length" yaml:"max_field_length"`
	MaxToolNameLength int   `json:"max_tool_name_length" yaml:"max_tool_name_length"`
	MaxRequestSize    int64 `json:"max_request_size" yaml:"max_request_size"`
	MaxResponseSize   int64 `json:"max_response_size" yaml:"max_response_size"`
}

ValidationConfig contains validation limits

Jump to

Keyboard shortcuts

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