json-rpc mcp protocol handler with initialization handshake
Implements the Model Context Protocol specification using JSON-RPC 2.0 for bidirectional communication between MCP clients and the Kubernetes server. The handler manages request parsing, capability negotiation during initialization handshakes, and response formatting according to the MCP specification. It routes incoming JSON-RPC calls to appropriate tool, prompt, and resource handlers while maintaining protocol compliance and error handling.
Unique: Implements full MCP specification compliance in Go with explicit initialization handshake support (testdata/initialize/init_test.yaml), enabling proper capability negotiation before tool execution rather than assuming client capabilities
vs alternatives: More lightweight than Python-based MCP servers while maintaining full protocol compliance, with native Go concurrency for handling multiple simultaneous client connections
multi-context kubernetes client pool management
Maintains a connection pool to multiple Kubernetes clusters by managing kubeconfig contexts, allowing clients to switch between clusters without reconnecting. The system dynamically loads and caches Kubernetes clients for each configured context, handling context switching through a client pool abstraction that maps context names to initialized Kubernetes clients. This enables seamless multi-cluster operations within a single MCP server instance.
Unique: Implements context pooling at the MCP server level rather than requiring per-context server instances, allowing single MCP connection to manage multiple Kubernetes clusters through context switching commands
vs alternatives: More efficient than running separate MCP servers per cluster, reducing operational overhead while maintaining isolation through context-based access control
interactive prompt for namespace discovery and selection
Provides an interactive MCP prompt that guides users through discovering and selecting namespaces in the cluster. The prompt presents available namespaces with filtering options, enabling users to interactively choose a namespace for scoped operations. Implements the MCP prompts system to create a conversational interface for namespace selection, useful for multi-namespace environments.
Unique: Implements MCP prompts for namespace selection, enabling Claude to guide users through namespace discovery in multi-namespace environments with interactive filtering
vs alternatives: More intuitive than requiring users to know namespace names, with interactive guidance suitable for complex cluster organizations
kubernetes context resource exposure for client awareness
Exposes available Kubernetes contexts as MCP resources, allowing clients to discover and understand which clusters are accessible through the MCP server. The implementation registers contexts as resources in the MCP resource system, enabling clients to query available contexts and understand cluster connectivity. This provides metadata about configured contexts without requiring separate API calls.
Unique: Exposes Kubernetes contexts as first-class MCP resources, enabling clients to discover available clusters through the MCP resource system rather than requiring separate context listing tools
vs alternatives: More discoverable than tool-based context listing, with resource-based access enabling better client integration with MCP resource patterns
pod log retrieval with streaming and filtering
Retrieves logs from Kubernetes pods through the Kubernetes API client, supporting both historical log retrieval and real-time streaming. The implementation queries the pod's container logs with optional filtering by timestamp, line count, and container selection. Logs are returned as structured text that can be parsed by MCP clients for analysis, debugging, or integration with AI models.
Unique: Integrates Kubernetes API log streaming directly into MCP tool responses, allowing Claude to analyze pod logs in real-time without requiring separate log aggregation systems or external log storage
vs alternatives: Faster than querying external log aggregation systems (ELK, Datadog) since it pulls directly from kubelet, with no additional infrastructure dependencies
in-pod command execution with container shell access
Executes arbitrary commands inside running Kubernetes pods by establishing a remote execution session through the Kubernetes API's exec endpoint. The implementation handles container selection, stdin/stdout/stderr stream management, and exit code capture. Commands are executed with the pod's service account permissions and container runtime environment, enabling interactive debugging and operational tasks directly from MCP clients.
Unique: Exposes Kubernetes exec API through MCP tool interface, enabling Claude to execute arbitrary commands in pods as if it had direct shell access, with full stdout/stderr/exit code capture
vs alternatives: More direct than kubectl exec wrapper scripts, with structured output suitable for AI analysis; no SSH keys or bastion hosts required
kubernetes resource listing with namespace and type filtering
Lists Kubernetes resources (pods, deployments, services, nodes, events, etc.) across namespaces with optional filtering by resource type, label selectors, and field selectors. The implementation queries the Kubernetes API for each resource type, aggregates results, and returns structured resource metadata. Supports both cluster-wide and namespace-scoped queries, enabling comprehensive resource discovery and inventory operations.
Unique: Provides unified resource listing across all Kubernetes resource types through a single MCP tool, with support for Kubernetes-native label and field selectors, enabling complex queries without custom query language
vs alternatives: More flexible than kubectl get with built-in filtering, and integrates directly into Claude's reasoning without requiring separate kubectl invocations
detailed kubernetes resource inspection with full specification retrieval
Retrieves complete specifications and status information for individual Kubernetes resources by querying the Kubernetes API for a specific resource by name and namespace. Returns the full resource definition including spec, status, metadata, and annotations, enabling detailed analysis of resource configuration and current state. Supports all Kubernetes resource types and provides structured YAML/JSON output suitable for configuration analysis and comparison.
Unique: Exposes full Kubernetes resource definitions through MCP, allowing Claude to analyze complete resource specifications including nested configurations, status conditions, and metadata without requiring separate API calls
vs alternatives: More comprehensive than kubectl describe output, with structured data suitable for programmatic analysis and comparison operations
+4 more capabilities