mcp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package mcp implements the MCP server logic for Agent Browser.

Index

Constants

View Source
const (
	AgentName    = "CoBrowser Agent 🚀"
	AgentVersion = "1.0.0"
)

Version information

Variables

View Source
var (
	// Connection metrics
	MCPConnectionsTotal = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "mcp_connections_total",
		Help: "Total number of MCP server connections by state",
	}, []string{"state"})

	// Tool metrics
	MCPToolsTotal = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "mcp_tools_total",
		Help: "Total number of tools by server",
	}, []string{"server_url"})

	MCPToolSyncLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "mcp_tool_sync_latency_seconds",
		Help:    "Latency of tool synchronization operations",
		Buckets: prometheus.DefBuckets,
	}, []string{"operation"})
)

Metrics exposed by the MCP package

Functions

func RegisterEventSubscribers

func RegisterEventSubscribers(bus events.Bus, cm *manager.ConnectionManager, logger log.Logger)

RegisterEventSubscribers registers event handlers with the event bus

func RegisterMCPServerHooks

func RegisterMCPServerHooks(p MCPHookParams)

RegisterMCPServerHooks registers the OnStart and OnStop hooks for the MCP server

Types

type MCPHookParams

type MCPHookParams struct {
	fx.In

	Lifecycle   fx.Lifecycle
	MCPServer   *server.MCPServer
	SSEServer   *server.SSEServer
	ConnManager *manager.ConnectionManager
	Config      config.ServerConfig
	Logger      log.Logger
}

MCPHookParams contains the parameters needed for MCP hooks

type MCPParams

type MCPParams struct {
	fx.In

	Logger   log.Logger
	Config   config.ServerConfig
	EventBus events.Bus
}

MCPParams contains the parameters needed for MCP components

type MCPResult

type MCPResult struct {
	fx.Out

	Server      *server.MCPServer
	SSEServer   *server.SSEServer
	ConnManager *manager.ConnectionManager
}

MCPResult contains all MCP-related components that need to be provided to Fx

func NewMCPComponents

func NewMCPComponents(p MCPParams) (MCPResult, error)

NewMCPComponents creates all MCP-related components

Directories

Path Synopsis
Package client implements the MCP client logic.
Package client implements the MCP client logic.
Package config provides configuration structures for the MCP component.
Package config provides configuration structures for the MCP component.
Package connection implements MCP connection handling.
Package connection implements MCP connection handling.
Package handlers provides event handler functionality for MCP.
Package handlers provides event handler functionality for MCP.
Package health provides health check functionality for MCP connections.
Package health provides health check functionality for MCP connections.
Package manager provides the ConnectionManager implementation.
Package manager provides the ConnectionManager implementation.
Package tools provides functionality for managing MCP tools.
Package tools provides functionality for managing MCP tools.

Jump to

Keyboard shortcuts

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