connection

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMCPPageSize          = mcpServer.DefaultMCPPageSize
	MaxMCPServerPageSize        = mcpServer.MaxMCPServerPageSize
	NotificationRefreshDebounce = mcpServer.NotificationRefreshDebounce

	MCPServerStatusDisabled     = mcpServer.MCPServerStatusDisabled
	MCPServerStatusDisconnected = mcpServer.MCPServerStatusDisconnected
	MCPServerStatusConnecting   = mcpServer.MCPServerStatusConnecting
	MCPServerStatusReady        = mcpServer.MCPServerStatusReady
	MCPServerStatusError        = mcpServer.MCPServerStatusError

	MCPTaskSupportForbidden = mcpServer.MCPTaskSupportForbidden
	MCPTaskSupportOptional  = mcpServer.MCPTaskSupportOptional
	MCPTaskSupportRequired  = mcpServer.MCPTaskSupportRequired
)

Variables

View Source
var (
	ErrMCPInvalidRuntimeRequest = mcpServer.ErrMCPInvalidRuntimeRequest
	ErrMCPRuntimeNotReady       = mcpServer.ErrMCPRuntimeNotReady
	ErrMCPPolicyDenied          = mcpServer.ErrMCPPolicyDenied
	ErrMCPApprovalNeeded        = mcpServer.ErrMCPApprovalNeeded
	ErrMCPStaleReference        = mcpServer.ErrMCPStaleReference
)

Functions

This section is empty.

Types

type ClientFactory

type ClientFactory interface {
	Connect(
		ctx context.Context,
		config mcpServer.RuntimeConfig,
		authorization PreparedConnection,
		notifications ClientNotificationSink,
	) (ClientSession, error)
}

type ClientNotification

type ClientNotification = mcpServer.ClientNotification

type ClientNotificationKind

type ClientNotificationKind = mcpServer.ClientNotificationKind

type ClientNotificationSink

type ClientNotificationSink = mcpServer.ClientNotificationSink

type ClientSession

type ClientSession interface {
	Close(ctx context.Context) error

	Discover(
		ctx context.Context,
		config mcpServer.RuntimeConfig,
	) (MCPDiscoverySnapshot, error)

	CallTool(
		ctx context.Context,
		toolName string,
		arguments map[string]any,
	) (*InvokeMCPToolResponseBody, error)

	ReadResource(
		ctx context.Context,
		uri string,
	) (*MCPReadResourceResponseBody, error)

	GetPrompt(
		ctx context.Context,
		name string,
		arguments map[string]string,
	) (*MCPGetPromptResponseBody, error)

	Complete(
		ctx context.Context,
		request MCPCompleteArgumentRequestBody,
	) (*MCPCompletionResult, error)
}

type ConnectionAuthorizer

type ConnectionAuthorizer interface {
	PrepareConnection(
		ctx context.Context,
		config mcpServer.RuntimeConfig,
	) (PreparedConnection, error)

	ConnectionSucceeded(
		ctx context.Context,
		config mcpServer.RuntimeConfig,
	)

	ConnectionFailed(
		ctx context.Context,
		config mcpServer.RuntimeConfig,
		err error,
	)
}

ConnectionAuthorizer is a narrow runtime port. The runtime session manager knows nothing about settings, secret persistence, artifact storage, OAuth loopback listeners, or concrete SDK types.

type InvokeMCPToolRequestBody

type InvokeMCPToolRequestBody = mcpServer.InvokeMCPToolRequestBody

type InvokeMCPToolResponseBody

type InvokeMCPToolResponseBody = mcpServer.InvokeMCPToolResponseBody

type MCPCompleteArgumentRequestBody

type MCPCompleteArgumentRequestBody = mcpServer.MCPCompleteArgumentRequestBody

type MCPCompletionResult

type MCPCompletionResult = mcpServer.MCPCompletionResult

type MCPDiscoveryPageToken

type MCPDiscoveryPageToken = mcpServer.MCPDiscoveryPageToken

type MCPDiscoverySnapshot

type MCPDiscoverySnapshot = mcpServer.MCPDiscoverySnapshot

type MCPGetPromptResponseBody

type MCPGetPromptResponseBody = mcpServer.MCPGetPromptResponseBody

type MCPImplementationInfo

type MCPImplementationInfo = mcpServer.MCPImplementationInfo

type MCPPromptRef

type MCPPromptRef = mcpServer.MCPPromptRef

type MCPReadResourceResponseBody

type MCPReadResourceResponseBody = mcpServer.MCPReadResourceResponseBody

type MCPResourceRef

type MCPResourceRef = mcpServer.MCPResourceRef

type MCPResourceTemplateRef

type MCPResourceTemplateRef = mcpServer.MCPResourceTemplateRef

type MCPRuntimeManager

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

func NewMCPRuntimeManager

func NewMCPRuntimeManager(
	source mcpServer.ServerSource,
	authorizer ConnectionAuthorizer,
	factory ClientFactory,
) (*MCPRuntimeManager, error)

func (*MCPRuntimeManager) CallTool

func (*MCPRuntimeManager) CallToolDryRun

func (*MCPRuntimeManager) Close

func (m *MCPRuntimeManager) Close(ctx context.Context) error

func (*MCPRuntimeManager) Complete

func (*MCPRuntimeManager) Connect

Connect resolves and verifies the full Artifact-backed server state once, materializes the runtime configuration, establishes the client session, and captures the session version.

Tool calls do not repeat Source snapshot verification. Mutations explicitly invalidate sessions, while explicit Refresh performs a new full resolution.

func (*MCPRuntimeManager) Disconnect

func (m *MCPRuntimeManager) Disconnect(
	ctx context.Context,
	ref mcpServer.ServerID,
) error

func (*MCPRuntimeManager) GetPrompt

func (m *MCPRuntimeManager) GetPrompt(
	ctx context.Context,
	ref mcpServer.ServerID,
	name string,
	arguments map[string]string,
) (*MCPGetPromptResponseBody, error)

func (*MCPRuntimeManager) Invalidate

func (m *MCPRuntimeManager) Invalidate(
	ctx context.Context,
	ref mcpServer.ServerID,
) error

Invalidate removes the derived runtime session after an MCP lifecycle, policy, installation-overlay, or secret-binding mutation.

It deliberately does not resolve the server again. The mutation path has already established that the prior runtime version is obsolete.

func (*MCPRuntimeManager) InvalidateCollection

func (m *MCPRuntimeManager) InvalidateCollection(
	ctx context.Context,
	ref mcpServer.CatalogID,
) error

func (*MCPRuntimeManager) ListPrompts

func (m *MCPRuntimeManager) ListPrompts(
	ctx context.Context,
	ref mcpServer.ServerID,
) ([]MCPPromptRef, error)

func (*MCPRuntimeManager) ListPromptsPage

func (m *MCPRuntimeManager) ListPromptsPage(
	ctx context.Context,
	ref mcpServer.ServerID,
	pageSize int,
	pageToken string,
) (out []MCPPromptRef, next *string, err error)

func (*MCPRuntimeManager) ListResourceTemplates

func (m *MCPRuntimeManager) ListResourceTemplates(
	ctx context.Context,
	ref mcpServer.ServerID,
) ([]MCPResourceTemplateRef, error)

func (*MCPRuntimeManager) ListResourceTemplatesPage

func (m *MCPRuntimeManager) ListResourceTemplatesPage(
	ctx context.Context,
	ref mcpServer.ServerID,
	pageSize int,
	pageToken string,
) (out []MCPResourceTemplateRef, next *string, err error)

func (*MCPRuntimeManager) ListResources

func (m *MCPRuntimeManager) ListResources(
	ctx context.Context,
	ref mcpServer.ServerID,
) ([]MCPResourceRef, error)

func (*MCPRuntimeManager) ListResourcesPage

func (m *MCPRuntimeManager) ListResourcesPage(
	ctx context.Context,
	ref mcpServer.ServerID,
	pageSize int,
	pageToken string,
) (out []MCPResourceRef, next *string, err error)

func (*MCPRuntimeManager) ListTools

func (*MCPRuntimeManager) ListToolsPage

func (m *MCPRuntimeManager) ListToolsPage(
	ctx context.Context,
	ref mcpServer.ServerID,
	pageSize int,
	pageToken string,
) (out []MCPToolCapability, next *string, err error)

func (*MCPRuntimeManager) OnClientNotification

func (m *MCPRuntimeManager) OnClientNotification(
	ctx context.Context,
	event ClientNotification,
)

func (*MCPRuntimeManager) ReadResource

func (*MCPRuntimeManager) Refresh

func (*MCPRuntimeManager) SetSessionLifecycleCleaner

func (m *MCPRuntimeManager) SetSessionLifecycleCleaner(
	cleaner SessionLifecycleCleaner,
)

func (*MCPRuntimeManager) StartConnect

func (*MCPRuntimeManager) Status

type MCPServerCapabilitiesSummary

type MCPServerCapabilitiesSummary = mcpServer.MCPServerCapabilitiesSummary

type MCPServerRuntimeSnapshot

type MCPServerRuntimeSnapshot = mcpServer.MCPServerRuntimeSnapshot

type MCPServerStatus

type MCPServerStatus = mcpServer.MCPServerStatus

type MCPTaskSupport

type MCPTaskSupport = mcpServer.MCPTaskSupport

type MCPToolAppRenderInfo

type MCPToolAppRenderInfo = mcpServer.MCPToolAppRenderInfo

type MCPToolCapability

type MCPToolCapability = mcpServer.MCPToolCapability

type PreparedConnection

type PreparedConnection struct {
	Env     map[string]string
	Headers map[string]string

	SensitiveValues []string
	OAuthHandler    any
}

PreparedConnection is the runtime-owned result of authorization preparation. OAuthHandler is intentionally opaque to the core runtime. A concrete transport adapter, such as sdkclient, may interpret it.

type SessionLifecycleCleaner

type SessionLifecycleCleaner interface {
	ClearServer(server mcpServer.ServerID)
	Clear()
}

Jump to

Keyboard shortcuts

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