mcp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTools

func AllTools() []mcp.Tool

AllTools returns all available MCP tools. When adding a new tool, add it to pkg/tools/definitions.go to keep both MCP and Toolset in sync, as well as docs.

func CreateExecuteInstantQueryTool

func CreateExecuteInstantQueryTool() mcp.Tool

func CreateExecuteRangeQueryTool

func CreateExecuteRangeQueryTool() mcp.Tool

func CreateGetAlertsTool

func CreateGetAlertsTool() mcp.Tool

func CreateGetLabelNamesTool

func CreateGetLabelNamesTool() mcp.Tool

func CreateGetLabelValuesTool

func CreateGetLabelValuesTool() mcp.Tool

func CreateGetSeriesTool

func CreateGetSeriesTool() mcp.Tool

func CreateGetSilencesTool

func CreateGetSilencesTool() mcp.Tool

func CreateListMetricsTool

func CreateListMetricsTool() mcp.Tool

Individual tool creation functions for backward compatibility and testing

func CreateShowTimeseriesTool

func CreateShowTimeseriesTool() mcp.Tool

func ExecuteInstantQueryHandler

ExecuteInstantQueryHandler handles the execution of Prometheus instant queries.

func ExecuteRangeQueryHandler

ExecuteRangeQueryHandler handles the execution of Prometheus range queries.

func GetAlertsHandler

GetAlertsHandler handles the retrieval of alerts from Alertmanager.

func GetLabelNamesHandler

GetLabelNamesHandler handles the retrieval of label names.

func GetLabelValuesHandler

GetLabelValuesHandler handles the retrieval of label values.

func GetSeriesHandler

GetSeriesHandler handles the retrieval of time series.

func GetSilencesHandler

GetSilencesHandler handles the retrieval of silences from Alertmanager.

func ListMetricsHandler

ListMetricsHandler handles the listing of available Prometheus metrics.

func NewMCPServer

func NewMCPServer(opts ObsMCPOptions) (*mcp.Server, error)

func Serve

func Serve(ctx context.Context, mcpServer *mcp.Server, listenAddr string) error

func SetupTools

func SetupTools(mcpServer *mcp.Server, opts ObsMCPOptions) error

func ShowTimeseriesHandler

func ShowTimeseriesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.ShowTimeseriesInput, struct{}]

ShowTimeseriesHandler handles the show_timeseries tool.

Types

type AuthMode

type AuthMode string

AuthMode defines the authentication mode for Prometheus client

const (
	AuthModeKubeConfig     AuthMode = "kubeconfig"
	AuthModeServiceAccount AuthMode = "serviceaccount"
	AuthModeHeader         AuthMode = "header"
)

func ParseAuthMode

func ParseAuthMode(mode string) (AuthMode, error)

ParseAuthMode validates and converts a string to AuthMode

type ContextKey

type ContextKey string
const (
	// AuthHeaderKey is the context key for the authorization header
	AuthHeaderKey ContextKey = "Authorization"

	// TestPromClientKey is the context key for injecting a test Prometheus client
	TestPromClientKey ContextKey = "test-prometheus-client"

	// TestAlertmanagerClientKey is the context key for injecting a test Alertmanager client
	TestAlertmanagerClientKey ContextKey = "test-alertmanager-client"
)

type ObsMCPOptions

type ObsMCPOptions struct {
	AuthMode               AuthMode
	MetricsBackendURL      string
	AlertmanagerURL        string
	Insecure               bool
	Guardrails             *prometheus.Guardrails
	FullRangeQueryResponse bool
}

ObsMCPOptions contains configuration options for the MCP server

Jump to

Keyboard shortcuts

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