mcpproxy

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FallbackEnabledSessionCrypto added in v0.5.0

type FallbackEnabledSessionCrypto struct {
	Primary, Fallback SessionCrypto
}

FallbackEnabledSessionCrypto tries to decrypt using the primary SessionCrypto first for decryption. If that fails and a fallback SessionCrypto is provided, it tries to decrypt using the fallback.

func (FallbackEnabledSessionCrypto) Decrypt added in v0.5.0

func (f FallbackEnabledSessionCrypto) Decrypt(encrypted string) (string, error)

Decrypt tries the primary SessionCrypto first, and if that fails and a fallback is provided, it tries the fallback.

func (FallbackEnabledSessionCrypto) Encrypt added in v0.5.0

func (f FallbackEnabledSessionCrypto) Encrypt(plaintext string) (string, error)

Encrypt always uses the primary SessionCrypto.

type ProxyConfig

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

ProxyConfig holds the main MCP proxy configuration. This implements filterapi.ConfigReceiver to gets the up-to-date configuration.

func NewMCPProxy

func NewMCPProxy(l *slog.Logger, mcpMetrics metrics.MCPMetrics, tracer tracingapi.MCPTracer, sessionCrypto SessionCrypto, logRequestHeaderAttributes map[string]string) (*ProxyConfig, *http.ServeMux, error)

NewMCPProxy creates a new MCPProxy instance.

func (*ProxyConfig) LoadConfig

func (p *ProxyConfig) LoadConfig(_ context.Context, config *filterapi.Config) error

LoadConfig implements [extproc.ConfigReceiver.LoadConfig] which will be called when the configuration is updated on the file system.

type SessionCrypto

type SessionCrypto interface {
	// Encrypt encrypts the given plaintext string and returns ciphertext.
	Encrypt(plaintext string) (string, error)
	// Decrypt decrypts the given ciphertext string and returns plaintext bytes.
	Decrypt(encrypted string) (string, error)
}

SessionCrypto provides methods to encrypt and decrypt session data.

func NewPBKDF2AesGcmSessionCrypto added in v0.5.0

func NewPBKDF2AesGcmSessionCrypto(seed string, iterations int) SessionCrypto

NewPBKDF2AesGcmSessionCrypto creates a SessionCrypto using PBKDF2 for key derivation and AES-GCM for encryption.

Jump to

Keyboard shortcuts

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