mcp

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSSEServer

func CreateSSEServer(mcpServer *server.MCPServer) *server.SSEServer

CreateSSEServer creates a new SSE server for the MCP server

func CreateServer

func CreateServer(k8sClient *k8s.Client, config *Config) *server.MCPServer

CreateServer creates a new MCP server for Kubernetes

func NewApplyResourceTool

func NewApplyResourceTool() mcp.Tool

NewApplyResourceTool creates a new apply_resource tool

func NewClusteredResourceTemplate

func NewClusteredResourceTemplate() mcp.ResourceTemplate

NewClusteredResourceTemplate creates a new clustered resource template

func NewGetResourceTool added in v0.0.3

func NewGetResourceTool() mcp.Tool

NewGetResourceTool creates a new get_resource tool

func NewListResourcesTool

func NewListResourcesTool() mcp.Tool

NewListResourcesTool creates a new list_resources tool

func NewNamespacedResourceTemplate

func NewNamespacedResourceTemplate() mcp.ResourceTemplate

NewNamespacedResourceTemplate creates a new namespaced resource template

Types

type Config added in v0.0.4

type Config struct {
	// ServeResources determines whether to serve cluster resources
	// Setting this to false can reduce context size for LLMs when working with large clusters
	ServeResources bool

	// ReadWrite determines whether the MCP server can modify resources in the cluster
	// When false, the server operates in read-only mode and does not serve the apply_resource tool
	ReadWrite bool
}

Config holds configuration options for the MCP server

func DefaultConfig added in v0.0.4

func DefaultConfig() *Config

DefaultConfig returns a Config with default values

type Implementation

type Implementation struct {
	// contains filtered or unexported fields
}

Implementation implements the MCP protocol

func NewImplementation

func NewImplementation(k8sClient *k8s.Client) *Implementation

NewImplementation creates a new MCP implementation

func (*Implementation) HandleApplyResource

func (m *Implementation) HandleApplyResource(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

HandleApplyResource handles the apply_resource tool

func (*Implementation) HandleClusteredResource

func (m *Implementation) HandleClusteredResource(ctx context.Context, request mcp.ReadResourceRequest) ([]mcp.ResourceContents, error)

HandleClusteredResource handles the clustered resource template

func (*Implementation) HandleGetResource added in v0.0.3

func (m *Implementation) HandleGetResource(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

HandleGetResource handles the get_resource tool

func (*Implementation) HandleListAllResources

func (m *Implementation) HandleListAllResources(ctx context.Context) ([]mcp.Resource, error)

HandleListAllResources handles the listResources request

func (*Implementation) HandleListResources

func (m *Implementation) HandleListResources(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

HandleListResources handles the list_resources tool

func (*Implementation) HandleNamespacedResource

func (m *Implementation) HandleNamespacedResource(ctx context.Context, request mcp.ReadResourceRequest) ([]mcp.ResourceContents, error)

HandleNamespacedResource handles the namespaced resource template

type ResourceURIComponents

type ResourceURIComponents struct {
	Group     string
	Version   string
	Resource  string
	Name      string
	Namespace string // Only for namespaced resources
}

ResourceURIComponents represents the components of a Kubernetes resource URI

Jump to

Keyboard shortcuts

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