backend

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 25 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

This section is empty.

Variables

This section is empty.

Functions

func NewOutboundHTTPClient added in v1.2.0

func NewOutboundHTTPClient(ctx context.Context, cfg OutboundHTTPConfig) (*http.Client, error)

NewOutboundHTTPClient builds the shared credentialed transport used by MCP backends and administrator-defined HTTP tools. The returned client owns tracked connections bound to ctx and never follows redirects.

Types

type Catalog

type Catalog struct {
	Tools             []*mcp.Tool
	Prompts           []*mcp.Prompt
	Resources         []*mcp.Resource
	ResourceTemplates []*mcp.ResourceTemplate
	Capabilities      *mcp.ServerCapabilities
	RefreshAfter      time.Duration
}

type Client

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

func NewClient

func NewClient(
	cfg config.BackendConfig,
	refreshMaximum time.Duration,
	logger *slog.Logger,
	onCatalogChanged func(string),
	onResourceUpdated func(string, string),
) *Client

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, upstream *mcp.ServerSession, params *mcp.CallToolParams) (*mcp.CallToolResult, error)

func (*Client) Catalog

func (c *Client) Catalog() *Catalog

func (*Client) Close

func (c *Client) Close()

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, upstream *mcp.ServerSession, params *mcp.CompleteParams) (*mcp.CompleteResult, error)

func (*Client) Config

func (c *Client) Config() config.BackendConfig

func (*Client) ConnectOnce

func (c *Client) ConnectOnce(ctx context.Context) error

func (*Client) GetPrompt

func (c *Client) GetPrompt(ctx context.Context, upstream *mcp.ServerSession, params *mcp.GetPromptParams) (*mcp.GetPromptResult, error)

func (*Client) ID

func (c *Client) ID() string

func (*Client) ReadResource

func (c *Client) ReadResource(ctx context.Context, upstream *mcp.ServerSession, params *mcp.ReadResourceParams) (*mcp.ReadResourceResult, error)

func (*Client) Ready

func (c *Client) Ready() bool

func (*Client) Required

func (c *Client) Required() bool

func (*Client) Run

func (c *Client) Run(ctx context.Context)

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, uri string) error

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(ctx context.Context, uri string) error

type Manager

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

func NewManager

func NewManager(
	cfg *config.Config,
	logger *slog.Logger,
	onCatalogChanged func(string),
	onResourceUpdated func(string, string),
) *Manager

func (*Manager) AllowedIDs

func (m *Manager) AllowedIDs(scopes []string) []string

func (*Manager) AllowedProfile added in v1.1.0

func (m *Manager) AllowedProfile(scopes []string) ([]string, []string)

func (*Manager) Client

func (m *Manager) Client(id string) (*Client, bool)

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) IDs

func (m *Manager) IDs() []string

func (*Manager) MissingScopes

func (m *Manager) MissingScopes(id string, scopes []string) ([]string, bool)

func (*Manager) Ready

func (m *Manager) Ready() bool

func (*Manager) SeedUnavailableCatalogs

func (m *Manager) SeedUnavailableCatalogs(previous *Manager) []string

SeedUnavailableCatalogs carries forward discovery data only for the same backend identity and endpoint. It never marks the new connection ready.

func (*Manager) Start

func (m *Manager) Start(parent context.Context, requireReady bool) error

func (*Manager) Status

func (m *Manager) Status() (ready, total, requiredReady, requiredTotal int)

func (*Manager) StatusDetails added in v1.2.0

func (m *Manager) StatusDetails() map[string]StatusDetail

type OutboundHTTPConfig added in v1.2.0

type OutboundHTTPConfig struct {
	Headers        map[string]string
	OAuth          *config.OAuthConfig
	RequestTimeout time.Duration
}

type ProbeCounts added in v1.2.0

type ProbeCounts struct {
	Tools             int `json:"tools"`
	Prompts           int `json:"prompts"`
	Resources         int `json:"resources"`
	ResourceTemplates int `json:"resource_templates"`
}

type ProbeFeatures added in v1.2.0

type ProbeFeatures struct {
	Tools       bool `json:"tools"`
	Prompts     bool `json:"prompts"`
	Resources   bool `json:"resources"`
	Completions bool `json:"completions"`
}

type ProbeResult added in v1.2.0

type ProbeResult struct {
	LatencyMS       int64         `json:"latency_ms"`
	ProtocolVersion string        `json:"protocol_version"`
	Server          ProbeServer   `json:"server"`
	Capabilities    ProbeFeatures `json:"capabilities"`
	Counts          ProbeCounts   `json:"counts"`
}

func Probe added in v1.2.0

func Probe(ctx context.Context, cfg config.BackendConfig, maximumRefresh time.Duration) (*ProbeResult, error)

type ProbeServer added in v1.2.0

type ProbeServer struct {
	Name    string `json:"name"`
	Title   string `json:"title,omitempty"`
	Version string `json:"version,omitempty"`
}

type StatusDetail added in v1.2.0

type StatusDetail struct {
	ID                string `json:"id"`
	Ready             bool   `json:"ready"`
	Required          bool   `json:"required"`
	Tools             int    `json:"tools"`
	Prompts           int    `json:"prompts"`
	Resources         int    `json:"resources"`
	ResourceTemplates int    `json:"resource_templates"`
}

Jump to

Keyboard shortcuts

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