Documentation
¶
Index ¶
- type AuthRTProvider
- type JarProvider
- type Manager
- func (m *Manager) CloseConversation(convID string)
- func (m *Manager) Get(ctx context.Context, convID, serverName string) (mcpclient.Interface, error)
- func (m *Manager) Options(ctx context.Context, serverName string) (*mcpcfg.MCPClient, error)
- func (m *Manager) Reap()
- func (m *Manager) Reconnect(ctx context.Context, convID, serverName string) (mcpclient.Interface, error)
- func (m *Manager) StartReaper(ctx context.Context, interval time.Duration) (stop func())
- func (m *Manager) Touch(convID, serverName string)
- type Option
- func WithAuthRoundTripper(rt *authtransport.RoundTripper) Option
- func WithAuthRoundTripperProvider(p AuthRTProvider) Option
- func WithCookieJar(jar http.CookieJar) Option
- func WithCookieJarProvider(p JarProvider) Option
- func WithHandlerFactory(newHandler func() protoclient.Handler) Option
- func WithTTL(ttl time.Duration) Option
- type Provider
- type RepoProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthRTProvider ¶ added in v0.2.9
type AuthRTProvider func(ctx context.Context) *authtransport.RoundTripper
AuthRTProvider returns a per-request auth RoundTripper (e.g., per-user) chosen from context. When provided, it takes precedence over the static authRT set via WithAuthRoundTripper.
type JarProvider ¶ added in v0.2.9
JarProvider returns a per-request CookieJar (e.g., per-user) chosen from context. When provided, it takes precedence over the static cookieJar set via WithCookieJar.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager caches MCP clients per (conversationID, serverName) and handles idle reaping.
func (*Manager) CloseConversation ¶
CloseConversation drops all clients for a conversation. Note: underlying transports may keep connections if the library doesn't expose Close.
func (*Manager) Options ¶ added in v0.2.10
Options exposes the underlying provider client options (authoring metadata, timeouts, etc.) for a given server name.
func (*Manager) Reap ¶
func (m *Manager) Reap()
Reap closes idle clients beyond TTL by dropping references.
func (*Manager) Reconnect ¶ added in v0.2.14
func (m *Manager) Reconnect(ctx context.Context, convID, serverName string) (mcpclient.Interface, error)
Reconnect drops the cached client for (convID, serverName) and creates a new one. It returns the fresh client or an error if recreation fails.
func (*Manager) StartReaper ¶
StartReaper launches a background goroutine that periodically invokes Reap until the provided context is cancelled or the returned stop function is called. If interval is non-positive, ttl/2 is used with a minimum of 1 minute.
type Option ¶
Option configures Manager. It can return an error which will be bubbled up by New.
func WithAuthRoundTripper ¶ added in v0.2.9
func WithAuthRoundTripper(rt *authtransport.RoundTripper) Option
WithAuthRoundTripper enables auth integration by attaching the provided RoundTripper as an Authorizer interceptor to created MCP clients.
func WithAuthRoundTripperProvider ¶ added in v0.2.9
func WithAuthRoundTripperProvider(p AuthRTProvider) Option
WithAuthRoundTripperProvider injects a provider that selects an auth RoundTripper per request.
func WithCookieJar ¶ added in v0.2.9
WithCookieJar injects a host-controlled CookieJar that will be applied to newly created MCP clients via ClientOptions, overriding any per-provider jar.
func WithCookieJarProvider ¶ added in v0.2.9
func WithCookieJarProvider(p JarProvider) Option
WithCookieJarProvider injects a provider that selects a CookieJar per request (e.g., per user).
func WithHandlerFactory ¶
func WithHandlerFactory(newHandler func() protoclient.Handler) Option
WithHandlerFactory sets a factory for per-connection client handlers (for elicitation, etc.).
type Provider ¶
type Provider interface {
Options(ctx context.Context, serverName string) (*mcpcfg.MCPClient, error)
}
Provider returns client options for a given MCP server name.
type RepoProvider ¶
type RepoProvider struct {
// contains filtered or unexported fields
}
RepoProvider loads MCP client options from the Agently workspace repo ($AGENTLY_WORKSPACE/mcp).
func NewRepoProvider ¶
func NewRepoProvider() *RepoProvider