Documentation
¶
Index ¶
- type BackendConfig
- type Config
- type HTTPConfig
- type LoggingConfig
- type ObservabilityConfig
- type Option
- func WithBackend(b backend.ServerBackend) Option
- func WithBackendType(backendType string) Option
- func WithConfig(config *Config) Option
- func WithConfigFile(path string) Option
- func WithHTTPAddress(addr string) Option
- func WithLogLevel(level string) Option
- func WithMaxConcurrent(max int) Option
- func WithMaxEvents(max int64) Option
- func WithMetricsAddress(addr string) Option
- func WithObservability(enabled bool) Option
- func WithStreaming(enabled bool) Option
- func WithStreamingBufferSize(size int) Option
- func WithStreamingTimeout(timeout time.Duration) Option
- func WithTransport(transport string) Option
- type Server
- func (s *Server) GetBackend() backend.ServerBackend
- func (s *Server) GetExecutor() *engine.Executor
- func (s *Server) Initialize(ctx context.Context) error
- func (s *Server) RegisterBackend(b backend.ServerBackend)
- func (s *Server) RegisterFunction(name string, handler backend.StreamingHandler)
- func (s *Server) Run(ctx context.Context) error
- type StreamingConfig
- type TransportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendConfig ¶
type BackendConfig struct {
Type string `yaml:"type"`
Config map[string]interface{} `yaml:"config"`
}
BackendConfig configures the backend
type Config ¶
type Config struct {
Backend BackendConfig `yaml:"backend"`
Transport TransportConfig `yaml:"transport"`
Observability ObservabilityConfig `yaml:"observability"`
Logging LoggingConfig `yaml:"logging"`
Streaming StreamingConfig `yaml:"streaming"` // NEW
}
Config represents the complete server configuration
func DefaultConfig ¶ added in v0.2.0
func DefaultConfig() *Config
DefaultConfig returns the default configuration
func LoadConfig ¶
LoadConfig loads configuration from a YAML file
type HTTPConfig ¶
type HTTPConfig struct {
Address string `yaml:"address"`
ReadTimeout time.Duration `yaml:"read_timeout"`
WriteTimeout time.Duration `yaml:"write_timeout"`
MaxRequestSize int64 `yaml:"max_request_size"`
AllowedOrigins []string `yaml:"allowed_origins"`
}
HTTPConfig configures HTTP transport
type LoggingConfig ¶
type LoggingConfig struct {
Level string `yaml:"level"`
Format string `yaml:"format"`
AddSource bool `yaml:"add_source"`
}
LoggingConfig configures logging
type ObservabilityConfig ¶
type ObservabilityConfig struct {
Enabled bool `yaml:"enabled"`
MetricsAddress string `yaml:"metrics_address"`
}
ObservabilityConfig configures observability features
type Option ¶
type Option func(*Server)
Option configures the server
func WithBackend ¶
func WithBackend(b backend.ServerBackend) Option
WithBackend sets a specific backend instance
func WithBackendType ¶
WithBackendType sets the backend type
func WithConfigFile ¶
WithConfigFile sets the config file path
func WithHTTPAddress ¶
WithHTTPAddress sets the HTTP server address
func WithMaxConcurrent ¶ added in v0.2.0
WithMaxConcurrent sets maximum concurrent executions (v2 semaphore)
func WithMaxEvents ¶ added in v0.2.0
WithMaxEvents sets maximum events per execution
func WithMetricsAddress ¶
WithMetricsAddress sets the metrics server address
func WithObservability ¶
WithObservability enables/disables observability
func WithStreaming ¶ added in v0.2.0
WithStreaming enables/disables streaming
func WithStreamingBufferSize ¶ added in v0.2.0
WithStreamingBufferSize sets the event buffer size
func WithStreamingTimeout ¶ added in v0.2.0
WithStreamingTimeout sets the execution timeout
func WithTransport ¶
WithTransport sets the transport type
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the main MCP server
func (*Server) GetBackend ¶ added in v0.2.0
func (s *Server) GetBackend() backend.ServerBackend
GetBackend returns the current backend
func (*Server) GetExecutor ¶ added in v0.2.0
GetExecutor returns the streaming executor
func (*Server) Initialize ¶ added in v0.2.0
Initialize initializes the server
func (*Server) RegisterBackend ¶ added in v0.2.0
func (s *Server) RegisterBackend(b backend.ServerBackend)
RegisterBackend registers a full backend (v0.2.0 style) This is the complete API for production use cases with multiple tools
func (*Server) RegisterFunction ¶ added in v0.2.0
func (s *Server) RegisterFunction(name string, handler backend.StreamingHandler)
RegisterFunction registers a single streaming function as a tool (v2 style) This is a simplified API for quick prototyping and simple use cases
type StreamingConfig ¶ added in v0.2.0
type StreamingConfig struct {
Enabled bool `yaml:"enabled"`
BufferSize int `yaml:"buffer_size"`
Timeout time.Duration `yaml:"timeout"`
MaxEvents int64 `yaml:"max_events"`
MaxConcurrent int `yaml:"max_concurrent"` // NEW: v2 semaphore
}
StreamingConfig configures streaming execution (NEW - v2 feature)
type TransportConfig ¶
type TransportConfig struct {
Type string `yaml:"type"`
HTTP HTTPConfig `yaml:"http"`
Stdio struct{} `yaml:"stdio"`
}
TransportConfig configures the transport layer