downstreammcp

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OutcomeCreated   = "created"
	OutcomeUnchanged = "unchanged"
	OutcomeReplaced  = "replaced"
	OutcomeConflict  = "conflict"
	OutcomeRemoved   = "removed"
)
View Source
const (
	TransportCommand        = "command"
	TransportSSE            = "sse"
	TransportStreamableHTTP = "streamable-http"
	DefaultTimeoutMS        = 30000
	DefaultMaxBytes         = 20000
)

Variables

View Source
var ErrExternalEdit = errors.New("downstream MCP state changed on disk")

Functions

func ParseArguments

func ParseArguments(raw string) (map[string]any, error)

func Save

func Save(path string, state State) error

Types

type CallResult

type CallResult struct {
	Server            string `json:"server"`
	Tool              string `json:"tool"`
	IsError           bool   `json:"is_error,omitempty"`
	Content           string `json:"content,omitempty"`
	StructuredContent any    `json:"structured_content,omitempty"`
	Truncated         bool   `json:"truncated,omitempty"`
	// FullContent is available only to the in-process run evidence store.
	FullContent string `json:"-"`
}

type CallToolOptions added in v0.1.27

type CallToolOptions struct {
	MaxBytes int
}

CallToolOptions overrides the response budget for one call. Zero uses the server's configured max_bytes; it never means an unlimited response.

type Client

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

func New

func New(state State) *Client

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, serverName, toolName string, args map[string]any) (CallResult, error)

func (*Client) CallToolWithOptions added in v0.1.27

func (c *Client) CallToolWithOptions(ctx context.Context, serverName, toolName string, args map[string]any, opts CallToolOptions) (CallResult, error)

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context, serverName string, opts ListToolsOptions) (ListToolsResult, error)

func (*Client) Servers

func (c *Client) Servers() []Server

type FileStore added in v0.1.22

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

func NewFileStore added in v0.1.22

func NewFileStore(path string) *FileStore

func (*FileStore) Read added in v0.1.22

func (s *FileStore) Read(_ context.Context) (Snapshot, error)

func (*FileStore) Write added in v0.1.22

func (s *FileStore) Write(ctx context.Context, snapshot Snapshot) error

type ListToolsOptions

type ListToolsOptions struct {
	IncludeSchema bool
	MaxTools      int
}

type ListToolsResult added in v0.1.19

type ListToolsResult struct {
	Tools     []ToolSummary `json:"tools"`
	Total     int           `json:"total"`
	Truncated bool          `json:"truncated,omitempty"`
}

ListToolsResult reports the bounded tool inventory plus the true total so callers (and the models reading their output) can tell when the list was cut by MaxTools.

type MutateResult added in v0.1.22

type MutateResult struct {
	Outcome string `json:"outcome"`
	Server  Server `json:"server,omitempty"`
}

type Server

type Server struct {
	Name        string            `yaml:"name" json:"name"`
	Transport   string            `yaml:"transport" json:"transport"`
	Command     string            `yaml:"command,omitempty" json:"command,omitempty"`
	Args        []string          `yaml:"args,omitempty" json:"args,omitempty"`
	EnvRefs     map[string]string `yaml:"env_refs,omitempty" json:"env_refs,omitempty"`
	URL         string            `yaml:"url,omitempty" json:"url,omitempty"`
	HeaderRefs  map[string]string `yaml:"header_refs,omitempty" json:"header_refs,omitempty"`
	TimeoutMS   int               `yaml:"timeout_ms,omitempty" json:"timeout_ms,omitempty"`
	MaxBytes    int               `yaml:"max_bytes,omitempty" json:"max_bytes,omitempty"`
	Description string            `yaml:"description,omitempty" json:"description,omitempty"`
}

func (Server) Equals added in v0.1.22

func (s Server) Equals(other Server) bool

func (Server) Validate

func (s Server) Validate() error

type Service added in v0.1.22

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

func NewService added in v0.1.22

func NewService(path string) *Service

func NewServiceWithStore added in v0.1.22

func NewServiceWithStore(store Store) *Service

func (*Service) AddOrUpdate added in v0.1.22

func (s *Service) AddOrUpdate(ctx context.Context, server Server, replace bool) (MutateResult, error)

func (*Service) Remove added in v0.1.22

func (s *Service) Remove(ctx context.Context, name string) (MutateResult, error)

type Snapshot added in v0.1.22

type Snapshot struct {
	State    State
	Revision string
}

type State

type State struct {
	Servers []Server `yaml:"servers" json:"servers"`
}

func Load

func Load(path string) (State, error)

func (State) Get

func (s State) Get(name string) (Server, bool)

func (State) PublicServers

func (s State) PublicServers() []Server

func (*State) Remove added in v0.1.22

func (s *State) Remove(name string) (Server, bool)

func (*State) Upsert

func (s *State) Upsert(server Server)

func (State) Validate added in v0.1.22

func (s State) Validate() error

type Store added in v0.1.22

type Store interface {
	Read(ctx context.Context) (Snapshot, error)
	Write(ctx context.Context, snapshot Snapshot) error
}

type ToolSummary

type ToolSummary struct {
	Name        string `json:"name"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	InputSchema any    `json:"input_schema,omitempty"`
}

Jump to

Keyboard shortcuts

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