s3

package
v1.87.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package s3 provides an S3 toolkit adapter for the MCP data platform.

Index

Constants

View Source
const (
	// DefaultTimeout is the default HTTP client timeout for S3 operations.
	DefaultTimeout = 30 * time.Second

	// DefaultMaxGetSize is the default maximum size for S3 GET operations (10MB).
	DefaultMaxGetSize = 10 * 1024 * 1024

	// DefaultMaxPutSize is the default maximum size for S3 PUT operations (100MB).
	DefaultMaxPutSize = 100 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotationConfig added in v0.20.0

type AnnotationConfig struct {
	ReadOnlyHint    *bool `yaml:"read_only_hint"`
	DestructiveHint *bool `yaml:"destructive_hint"`
	IdempotentHint  *bool `yaml:"idempotent_hint"`
	OpenWorldHint   *bool `yaml:"open_world_hint"`
}

AnnotationConfig holds tool annotation overrides from configuration.

type Config

type Config struct {
	Region          string                      `yaml:"region"`
	Endpoint        string                      `yaml:"endpoint"`
	PublicEndpoint  string                      `yaml:"public_endpoint"`
	AccessKeyID     string                      `yaml:"access_key_id"`
	SecretAccessKey string                      `yaml:"secret_access_key"`
	SessionToken    string                      `yaml:"session_token"` // #nosec G117 -- S3 session token from admin YAML config
	Profile         string                      `yaml:"profile"`
	UsePathStyle    bool                        `yaml:"use_path_style"`
	Timeout         time.Duration               `yaml:"timeout"`
	DisableSSL      bool                        `yaml:"disable_ssl"`
	ReadOnly        bool                        `yaml:"read_only"`
	MaxGetSize      int64                       `yaml:"max_get_size"`
	MaxPutSize      int64                       `yaml:"max_put_size"`
	ConnectionName  string                      `yaml:"connection_name"`
	BucketPrefix    string                      `yaml:"bucket_prefix"`
	Titles          map[string]string           `yaml:"titles"`
	Descriptions    map[string]string           `yaml:"descriptions"`
	Annotations     map[string]AnnotationConfig `yaml:"annotations"`
}

Config holds S3 toolkit configuration.

func ParseConfig

func ParseConfig(cfg map[string]any) (Config, error)

ParseConfig parses an S3 toolkit configuration from a map.

type Toolkit

type Toolkit struct {
	// contains filtered or unexported fields
}

Toolkit wraps mcp-s3 toolkit for the platform.

func New

func New(name string, cfg Config) (*Toolkit, error)

New creates a new S3 toolkit.

func (*Toolkit) AddConnection added in v1.48.0

func (t *Toolkit) AddConnection(name string, config map[string]any) error

AddConnection adds a named S3 connection at runtime.

func (*Toolkit) Client

func (t *Toolkit) Client() *s3client.Client

Client returns the underlying S3 client for direct use.

func (*Toolkit) Close

func (t *Toolkit) Close() error

Close releases resources.

func (*Toolkit) Config

func (t *Toolkit) Config() Config

Config returns the toolkit configuration.

func (*Toolkit) Connection added in v0.12.1

func (t *Toolkit) Connection() string

Connection returns the connection name for audit logging.

func (*Toolkit) HasConnection added in v1.48.0

func (t *Toolkit) HasConnection(name string) bool

HasConnection returns true if a connection with the given name exists.

func (*Toolkit) Kind

func (*Toolkit) Kind() string

Kind returns the toolkit kind.

func (*Toolkit) Name

func (t *Toolkit) Name() string

Name returns the toolkit instance name.

func (*Toolkit) RegisterTools

func (t *Toolkit) RegisterTools(s *mcp.Server)

RegisterTools registers S3 tools with the MCP server. The platform provides a unified list_connections tool, so the per-toolkit s3_list_connections is excluded.

func (*Toolkit) RemoveConnection added in v1.48.0

func (t *Toolkit) RemoveConnection(name string) error

RemoveConnection removes a named S3 connection at runtime.

func (*Toolkit) SetMetrics added in v1.70.0

func (t *Toolkit) SetMetrics(m *observability.Metrics)

SetMetrics installs the per-operation S3 observability middleware (metrics + spans) by rebuilding the underlying mcp-s3 toolkit; this must happen before RegisterTools registers the tool handlers, so the platform wires toolkit observability ahead of tool registration (see Platform.WireToolkitMetrics). The platform calls this only when metrics OR tracing is enabled, so the middleware is installed unconditionally here — it records metrics nil-safely (no-op when m is disabled) and emits spans only inside an active trace, which is what makes a tracing-only deployment (m nil) still produce S3 spans.

func (*Toolkit) SetQueryProvider

func (t *Toolkit) SetQueryProvider(provider query.Provider)

SetQueryProvider sets the query execution provider for enrichment.

func (*Toolkit) SetSemanticProvider

func (t *Toolkit) SetSemanticProvider(provider semantic.Provider)

SetSemanticProvider sets the semantic metadata provider for enrichment.

func (*Toolkit) Tools

func (t *Toolkit) Tools() []string

Tools returns the list of tool names that would be provided by this toolkit.

Jump to

Keyboard shortcuts

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