Documentation
¶
Index ¶
- Constants
- Variables
- func ConfiguredServerCount() (int, error)
- func ExposedToolName(serverName, toolName string) string
- func OpenAITool(t RemoteTool) openai.ChatCompletionToolUnionParam
- func UniqueToolName(base string, used map[string]bool) string
- type CatalogEntry
- type Config
- type InternalAdapterInfo
- type Manager
- func NewManager(ctx context.Context, cfg *Config, stderr io.Writer) *Manager
- func NewManagerWithOptions(ctx context.Context, cfg *Config, stderr io.Writer, options *ManagerOptions) *Manager
- func NewManagerWithRemoteTools(tools []RemoteTool) *Manager
- func Start(ctx context.Context, stderr io.Writer) (*Manager, error)
- func StartLazy(stderr io.Writer) (*Manager, error)
- func StartLazyWithOptions(stderr io.Writer, options *ManagerOptions) (*Manager, error)
- func StartWithOptions(ctx context.Context, stderr io.Writer, options *ManagerOptions) (*Manager, error)
- func (m *Manager) AddRoots(roots ...*sdkmcp.Root)
- func (m *Manager) CallInternalTool(ctx context.Context, serverName, toolName, intent string, args map[string]any) (any, error)
- func (m *Manager) CallTool(ctx context.Context, name string, raw json.RawMessage) (any, error)
- func (m *Manager) Catalog() []CatalogEntry
- func (m *Manager) Close() error
- func (m *Manager) Complete(ctx context.Context, serverName string, params *sdkmcp.CompleteParams) (*sdkmcp.CompleteResult, error)
- func (m *Manager) Connect(ctx context.Context) (servers int, tools int, err error)
- func (m *Manager) GetPrompt(ctx context.Context, serverName, name string, arguments map[string]string) (*sdkmcp.GetPromptResult, error)
- func (m *Manager) HasTool(name string) bool
- func (m *Manager) InternalAdapters() []InternalAdapterInfo
- func (m *Manager) IsReady() bool
- func (m *Manager) ListPrompts(ctx context.Context, serverName string) ([]*sdkmcp.Prompt, error)
- func (m *Manager) ListResourceTemplates(ctx context.Context, serverName string) ([]*sdkmcp.ResourceTemplate, error)
- func (m *Manager) ListResources(ctx context.Context, serverName string) ([]*sdkmcp.Resource, error)
- func (m *Manager) OpenAITools() []openai.ChatCompletionToolUnionParam
- func (m *Manager) Ping(ctx context.Context, serverName string) error
- func (m *Manager) Prompts() []RemotePrompt
- func (m *Manager) ReadResource(ctx context.Context, serverName, uri string) (*sdkmcp.ReadResourceResult, error)
- func (m *Manager) RemoveRoots(uris ...string)
- func (m *Manager) ResourceTemplates() []RemoteResourceTemplate
- func (m *Manager) Resources() []RemoteResource
- func (m *Manager) Servers() []ServerInfo
- func (m *Manager) SetLoggingLevel(ctx context.Context, serverName string, level sdkmcp.LoggingLevel) error
- func (m *Manager) Subscribe(ctx context.Context, serverName, uri string) error
- func (m *Manager) ToolDump() string
- func (m *Manager) Tools() []RemoteTool
- func (m *Manager) Unsubscribe(ctx context.Context, serverName, uri string) error
- func (m *Manager) WaitReady(ctx context.Context) error
- type ManagerOptions
- type OAuthConfig
- type RemotePrompt
- type RemoteResource
- type RemoteResourceTemplate
- type RemoteTool
- type ServerConfig
- type ServerInfo
Constants ¶
const ( TransportStdio = "stdio" TransportSSE = "sse" TransportStreamableHTTP = "streamable-http" )
Variables ¶
var ErrManagerClosed = errors.New("MCP manager closed")
ErrManagerClosed indicates that the MCP manager has already been shut down.
ErrServerUnavailable indicates that a server could not be connected or reconnected. The original cause is wrapped for diagnostics.
var ErrToolCallOutcomeUnknown = errors.New("MCP tool call outcome unknown")
ErrToolCallOutcomeUnknown indicates that an MCP tool call may have reached the remote server, but its response was lost. Such calls must not be replayed automatically unless the host explicitly opts into that policy.
Functions ¶
func ConfiguredServerCount ¶
func ExposedToolName ¶
func OpenAITool ¶
func OpenAITool(t RemoteTool) openai.ChatCompletionToolUnionParam
Types ¶
type CatalogEntry ¶ added in v2026.617.0
type Config ¶
type Config struct {
Servers []ServerConfig
Path string
}
func LoadConfig ¶
func ParseConfig ¶
type InternalAdapterInfo ¶ added in v2026.909.0
InternalAdapterInfo is the non-sensitive part of an internal MCP server configuration needed by a host adapter factory.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManagerWithOptions ¶ added in v2026.909.0
func NewManagerWithRemoteTools ¶
func NewManagerWithRemoteTools(tools []RemoteTool) *Manager
func StartLazyWithOptions ¶ added in v2026.909.0
func StartLazyWithOptions(stderr io.Writer, options *ManagerOptions) (*Manager, error)
func StartWithOptions ¶ added in v2026.909.0
func (*Manager) CallInternalTool ¶ added in v2026.909.0
func (m *Manager) CallInternalTool(ctx context.Context, serverName, toolName, intent string, args map[string]any) (any, error)
CallInternalTool invokes a host-managed MCP tool by its stable server and remote tool names. Internal adapter calls deliberately bypass the model-facing MCP catalog, but still use the Manager's session lifecycle, retry policy, and logging.
func (*Manager) Catalog ¶ added in v2026.617.0
func (m *Manager) Catalog() []CatalogEntry
func (*Manager) Complete ¶ added in v2026.909.0
func (m *Manager) Complete(ctx context.Context, serverName string, params *sdkmcp.CompleteParams) (*sdkmcp.CompleteResult, error)
Complete asks one MCP server for argument completions.
func (*Manager) GetPrompt ¶ added in v2026.909.0
func (m *Manager) GetPrompt(ctx context.Context, serverName, name string, arguments map[string]string) (*sdkmcp.GetPromptResult, error)
GetPrompt gets a rendered prompt from one connected MCP server.
func (*Manager) InternalAdapters ¶ added in v2026.909.0
func (m *Manager) InternalAdapters() []InternalAdapterInfo
InternalAdapters returns configured host-managed adapters, including ones that are not currently connected. The latter still need to be represented so the router can report a backend failure and try its fallback.
func (*Manager) ListPrompts ¶ added in v2026.909.0
ListPrompts refreshes and returns prompts for one connected server.
func (*Manager) ListResourceTemplates ¶ added in v2026.909.0
func (m *Manager) ListResourceTemplates(ctx context.Context, serverName string) ([]*sdkmcp.ResourceTemplate, error)
ListResourceTemplates refreshes and returns resource URI templates for one connected server.
func (*Manager) ListResources ¶ added in v2026.909.0
ListResources refreshes and returns resources for one connected server.
func (*Manager) OpenAITools ¶
func (m *Manager) OpenAITools() []openai.ChatCompletionToolUnionParam
func (*Manager) Prompts ¶ added in v2026.909.0
func (m *Manager) Prompts() []RemotePrompt
Prompts returns a snapshot of all prompts currently advertised by connected servers.
func (*Manager) ReadResource ¶ added in v2026.909.0
func (m *Manager) ReadResource(ctx context.Context, serverName, uri string) (*sdkmcp.ReadResourceResult, error)
ReadResource reads a resource from one connected MCP server.
func (*Manager) RemoveRoots ¶ added in v2026.909.0
func (*Manager) ResourceTemplates ¶ added in v2026.909.0
func (m *Manager) ResourceTemplates() []RemoteResourceTemplate
ResourceTemplates returns a snapshot of all resource templates currently advertised by connected servers.
func (*Manager) Resources ¶ added in v2026.909.0
func (m *Manager) Resources() []RemoteResource
Resources returns a snapshot of all resources currently advertised by connected servers.
func (*Manager) Servers ¶ added in v2026.909.0
func (m *Manager) Servers() []ServerInfo
func (*Manager) SetLoggingLevel ¶ added in v2026.909.0
func (m *Manager) SetLoggingLevel(ctx context.Context, serverName string, level sdkmcp.LoggingLevel) error
SetLoggingLevel requests a minimum log level from one MCP server. Logging is deprecated by MCP July but remains part of the compatibility surface.
func (*Manager) Subscribe ¶ added in v2026.909.0
Subscribe subscribes to updates for a resource. For MCP July servers the SDK maps this to subscriptions/listen; for legacy servers it uses the resources/subscribe request.
func (*Manager) Tools ¶ added in v2026.909.0
func (m *Manager) Tools() []RemoteTool
Tools returns a snapshot of the complete MCP tool descriptors currently advertised by connected servers. The OpenAI projection is available through OpenAITools; this view retains MCP-specific metadata and output schemas.
func (*Manager) Unsubscribe ¶ added in v2026.909.0
Unsubscribe stops a resource subscription.
type ManagerOptions ¶ added in v2026.909.0
type ManagerOptions struct {
ClientOptions sdkmcp.ClientOptions
// Roots are advertised to MCP servers that request roots/list. They can be
// changed later with AddRoots and RemoveRoots.
Roots []*sdkmcp.Root
// OAuthHandler creates the OAuth handler for a configured HTTP server. The
// factory is intentionally injectable: interactive authorization and token
// persistence belong to the host application, not to mcp.json.
OAuthHandler func(context.Context, ServerConfig) (auth.OAuthHandler, error)
// AuthorizationCodeFetcher starts an interactive OAuth authorization-code
// flow when a server config declares OAuth but no custom OAuthHandler
// factory is supplied.
AuthorizationCodeFetcher auth.AuthorizationCodeFetcher
OAuthHTTPClient *http.Client
// DisableCatalogSubscriptions disables the modern subscriptions/listen
// stream used only for catalog-change notifications. Catalogs are still
// refreshed after reconnect and explicit list operations; this is useful
// for stateless/internal adapters that only need request-response calls.
DisableCatalogSubscriptions bool
// RetryToolCall may explicitly authorize replaying a tool call after a
// connection failure. By default the manager only retries calls rejected
// with ErrSessionMissing, because MCP tool annotations are advisory and a
// lost response can otherwise duplicate side effects.
RetryToolCall func(serverName, toolName string, definition *sdkmcp.Tool, cause error) bool
}
ManagerOptions configures the MCP host capabilities exposed by Solomon.
ClientOptions is passed to every MCP client. It can provide handlers for elicitation, sampling, progress, logging, list changes, and resource updates. The manager wraps the list-change handlers so its own catalogs are refreshed asynchronously without blocking the SDK's notification reader.
type OAuthConfig ¶ added in v2026.909.0
type OAuthConfig struct {
ClientID string `json:"clientId,omitempty"`
ClientSecret string `json:"clientSecret,omitempty"`
ClientIDMetadataURL string `json:"clientIdMetadataUrl,omitempty"`
RedirectURL string `json:"redirectUrl,omitempty"`
RedirectURIs []string `json:"redirectUris,omitempty"`
ClientName string `json:"clientName,omitempty"`
ClientURI string `json:"clientUri,omitempty"`
Scope string `json:"scope,omitempty"`
RequestRefresh bool `json:"requestRefreshToken,omitempty"`
}
OAuthConfig configures the MCP OAuth client registration. Interactive authorization and token persistence are deliberately supplied by the host through ManagerOptions; secrets should normally be expanded from the environment in mcp.json rather than committed to a build.
type RemotePrompt ¶ added in v2026.909.0
RemotePrompt is a prompt advertised by a connected MCP server.
type RemoteResource ¶ added in v2026.909.0
RemoteResource is a resource advertised by a connected MCP server.
type RemoteResourceTemplate ¶ added in v2026.909.0
type RemoteResourceTemplate struct {
ServerName string
Definition *sdkmcp.ResourceTemplate
}
RemoteResourceTemplate is a resource URI template advertised by a connected MCP server.
type RemoteTool ¶
type RemoteTool struct {
OpenAIName string
ServerName string
ToolName string
Description string
Schema map[string]any
// Definition retains the complete MCP tool descriptor, including title,
// icons, annotations, and outputSchema that are not representable in an
// OpenAI function definition.
Definition *sdkmcp.Tool
}
type ServerConfig ¶
type ServerConfig struct {
Name string `json:"-"`
Type string `json:"type"`
Internal bool `json:"internal"`
Adapter string `json:"adapter"`
Command string `json:"command"`
Args []string `json:"args"`
Env map[string]string `json:"env"`
CWD string `json:"cwd"`
URL string `json:"url"`
Headers map[string]string `json:"headers"`
OAuth *OAuthConfig `json:"oauth,omitempty"`
Timeout int `json:"timeout"`
Allow []string `json:"allow"`
Deny []string `json:"deny"`
Fallback bool `json:"-"`
SortIndex int `json:"-"`
}
func (ServerConfig) NeedsInternet ¶ added in v2026.609.3
func (sc ServerConfig) NeedsInternet() bool
func (ServerConfig) ToolAllowed ¶
func (sc ServerConfig) ToolAllowed(name string) bool
type ServerInfo ¶ added in v2026.909.0
type ServerInfo struct {
Name string
Type string
URL string
ProtocolVersion string
Implementation *sdkmcp.Implementation
Capabilities *sdkmcp.ServerCapabilities
Instructions string
}
ServerInfo is a snapshot of a connected MCP server's negotiated session.