downstream

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package downstream connects to configured downstream MCP servers and returns initialized client sessions isolated per server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scrub

func Scrub(msg string, server config.ServerConfig) string

Scrub replaces every configured secret value in msg with the redaction mask. Empty values and {env:...} placeholders are left alone.

Types

type Connector

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

Connector opens MCP client sessions for enabled downstream servers.

func New

func New(opts ...Option) *Connector

New constructs a Connector backed by the official MCP Go SDK client.

func (*Connector) Connect

func (c *Connector) Connect(ctx context.Context, serverID string, server config.ServerConfig) Result

Connect opens a single initialized MCP client session.

func (*Connector) ConnectAll

func (c *Connector) ConnectAll(ctx context.Context, cfg *config.Config) []Result

ConnectAll connects every enabled server in stable order. Each server receives an independent result; one failure does not abort the rest.

type Option

type Option func(*Connector)

Option customizes a Connector.

func WithMaxConcurrency

func WithMaxConcurrency(limit int) Option

WithMaxConcurrency bounds concurrent connection attempts.

func WithTransportFactory

func WithTransportFactory(factory TransportFactory) Option

WithTransportFactory replaces default local/remote transport construction. Tests use this to connect to in-memory MCP servers.

type Result

type Result struct {
	ServerID string
	Session  Session
	Error    *contract.Error
	Skipped  bool
}

Result is the per-server outcome of a connection attempt.

type Session

type Session interface {
	ListTools(ctx context.Context, params *mcpsdk.ListToolsParams) (*mcpsdk.ListToolsResult, error)
	CallTool(ctx context.Context, params *mcpsdk.CallToolParams) (*mcpsdk.CallToolResult, error)
	Close() error
}

Session is the downstream MCP client surface used by discovery and brokered invocation. The MCP Go SDK's *ClientSession satisfies it.

type TransportFactory

type TransportFactory func(serverID string, server config.ServerConfig) (mcpsdk.Transport, error)

TransportFactory builds a fresh MCP transport for one configured server.

Jump to

Keyboard shortcuts

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