Documentation
¶
Overview ¶
Package connection implements MCP connection handling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConnectionsMutex sync.RWMutex
View Source
var RemoteConnections = make(map[string]*MCPConnection)
RemoteConnections stores active connections to remote servers
Functions ¶
func CleanupConnections ¶
CleanupConnections closes all active connections and clears the map
Types ¶
type ConnectionState ¶
type ConnectionState int32
ConnectionState tracks the lifecycle state of a connection
const ( ConnectionStateIdle ConnectionState = iota ConnectionStateConnecting ConnectionStateConnected ConnectionStateDisconnecting ConnectionStateDisconnected ConnectionStateFailed )
type MCPConnection ¶
type MCPConnection struct { Client *client.SSEMCPClient // Use original client type for compatibility URL string Ctx context.Context Cancel context.CancelFunc Tools []mcp.Tool EnhancedMode bool // Whether this connection uses the enhanced client wrapper // contains filtered or unexported fields }
MCPConnection represents a connection to a remote MCP server
func ConnectToRemoteServer ¶
func ConnectToRemoteServer(ctx context.Context, logger log.Logger, remote config.RemoteMCPServer) (*MCPConnection, error)
ConnectToRemoteServer establishes a connection to a remote MCP server
func (*MCPConnection) GetTools ¶
func (c *MCPConnection) GetTools() []mcp.Tool
GetTools returns the tools list in a thread-safe way
func (*MCPConnection) SetState ¶
func (c *MCPConnection) SetState(state ConnectionState)
SetState sets the connection state atomically
func (*MCPConnection) State ¶
func (c *MCPConnection) State() ConnectionState
State gets the current connection state
Click to show internal directories.
Click to hide internal directories.