mcplog

package
v0.0.60 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MCPSessionContextKey = ContextKey("mcp_session")

MCPSessionContextKey is the context key for storing MCP ServerSession

Variables

This section is empty.

Functions

func HandleK8sError

func HandleK8sError(ctx context.Context, err error, operation string)

HandleK8sError sends appropriate MCP log messages based on Kubernetes API error types. operation should describe the operation (e.g., "pod access", "deployment deletion").

func SendMCPLog

func SendMCPLog(ctx context.Context, level Level, message string)

SendMCPLog sends a log notification to the MCP client and server logs. Uses dedicated "mcp" named logger. Message is automatically sanitized.

Types

type ContextKey

type ContextKey string

ContextKey is a type for context keys to avoid collisions

type Level

type Level int

Level represents MCP log severity levels per RFC 5424 syslog specification. https://modelcontextprotocol.io/specification/2025-11-25/server/utilities/logging#log-levels

const (
	// LevelDebug is for detailed debugging information.
	LevelDebug Level = iota
	// LevelInfo is for general informational messages.
	LevelInfo
	// LevelNotice is for normal but significant events.
	LevelNotice
	// LevelWarning is for warning conditions.
	LevelWarning
	// LevelError is for error conditions.
	LevelError
	// LevelCritical is for critical conditions.
	LevelCritical
	// LevelAlert is for conditions requiring immediate action.
	LevelAlert
	// LevelEmergency is for system unusable conditions.
	LevelEmergency
)

Log levels from least to most severe, per MCP specification.

func (Level) String

func (l Level) String() string

String returns the MCP protocol string representation of the level.

Jump to

Keyboard shortcuts

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