mcp

package
v0.183.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 20 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

This section is empty.

Types

type Manager

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

Manager manages multiple MCP server connections and their container lifecycle

func NewManager

func NewManager(sessionID convdomain.SessionID, cfg *config.MCPConfig, runtime containerruntime.ContainerRuntime, notifier agentdomain.UINotifier) *Manager

NewManager creates a new MCP manager. notifier is the single UI ingress the liveness probes push MCPServerStatusUpdateEvent through; a nil notifier degrades to no UI pushes.

func (*Manager) ClearToolCount

func (m *Manager) ClearToolCount(serverName string)

ClearToolCount removes the tool count for a specific server

func (*Manager) Close

func (m *Manager) Close() error

Close stops monitoring, stops containers, and cleans up resources

func (*Manager) GetClient

func (m *Manager) GetClient(serverName string) agentdomain.MCPClient

GetClient returns the client for a specific server by name, or nil if no such client exists. Direct map lookup - does not perform any network I/O, in contrast to iterating GetClients() and calling DiscoverTools to identify the owning client.

func (*Manager) GetClients

func (m *Manager) GetClients() []agentdomain.MCPClient

GetClients returns a list of MCP clients

func (*Manager) GetTotalServers

func (m *Manager) GetTotalServers() int

GetTotalServers returns the total number of configured MCP servers from config

func (*Manager) StartMonitoring

func (m *Manager) StartMonitoring(ctx context.Context)

StartMonitoring begins background health monitoring, pushing every MCPServerStatusUpdateEvent through the injected UI notifier. It is idempotent - subsequent calls are no-ops. The initial status is emitted from a goroutine because Notify wraps the unbuffered (*tea.Program).Send, which blocks until the Bubble Tea loop consumes; emitting it synchronously from app.Init (before the loop runs) would deadlock.

func (*Manager) StartServer

func (m *Manager) StartServer(ctx context.Context, server config.MCPServerEntry) error

StartServer starts a single MCP server container

func (*Manager) StartServers

func (m *Manager) StartServers(ctx context.Context) error

StartServers starts all MCP servers that have run=true This method is non-fatal and always returns nil

func (*Manager) StopServers

func (m *Manager) StopServers(ctx context.Context) error

StopServers stops all running MCP server containers

func (*Manager) UpdateToolCount

func (m *Manager) UpdateToolCount(serverName string, count int)

UpdateToolCount updates the tool count for a specific server

type SSEHTTPClientTransport

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

SSEHTTPClientTransport implements an SSE-aware HTTP client transport for MCP This handles servers that respond with Server-Sent Events format

func NewSSEHTTPClientTransport

func NewSSEHTTPClientTransport(endpoint string) *SSEHTTPClientTransport

NewSSEHTTPClientTransport creates a new SSE-aware HTTP client transport

func (*SSEHTTPClientTransport) Close

func (t *SSEHTTPClientTransport) Close() error

Close implements Transport.Close

func (*SSEHTTPClientTransport) Send

Send implements Transport.Send

func (*SSEHTTPClientTransport) SetCloseHandler

func (t *SSEHTTPClientTransport) SetCloseHandler(handler func())

SetCloseHandler implements Transport.SetCloseHandler

func (*SSEHTTPClientTransport) SetErrorHandler

func (t *SSEHTTPClientTransport) SetErrorHandler(handler func(error))

SetErrorHandler implements Transport.SetErrorHandler

func (*SSEHTTPClientTransport) SetMessageHandler

func (t *SSEHTTPClientTransport) SetMessageHandler(handler func(ctx context.Context, message *transport.BaseJsonRpcMessage))

SetMessageHandler implements Transport.SetMessageHandler

func (*SSEHTTPClientTransport) Start

Start implements Transport.Start

func (*SSEHTTPClientTransport) WithHeader

func (t *SSEHTTPClientTransport) WithHeader(key, value string) *SSEHTTPClientTransport

WithHeader adds a header to the request

Jump to

Keyboard shortcuts

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