MCPcopy Create free account
hub / github.com/VersusControl/devops-ai-guidelines / NewServer

Function NewServer

02-mcp-for-devops/code/03/pkg/mcp/server.go:27–45  ·  view source on GitHub ↗

NewServer creates a new MCP server instance with proper MCP protocol implementation

(cfg *config.Config, k8sClient *k8s.Client)

Source from the content-addressed store, hash-verified

25
26// NewServer creates a new MCP server instance with proper MCP protocol implementation
27func NewServer(cfg *config.Config, k8sClient *k8s.Client) *Server {
28 logger := logging.NewLogger("info", "text")
29
30 // Create MCP server
31 mcpServer := server.NewMCPServer("k8s-mcp-server", "1.0.0", server.WithResourceCapabilities(true, true))
32
33 s := &Server{
34 config: cfg,
35 k8sClient: k8sClient,
36 logger: logger,
37 mcpServer: mcpServer,
38 formatter: NewResourceFormatter(),
39 }
40
41 // Register MCP resources
42 s.registerResources()
43
44 return s
45}
46
47// registerResources discovers and registers actual Kubernetes resources
48func (s *Server) registerResources() {

Callers

nothing calls this directly

Calls 2

registerResourcesMethod · 0.95
NewResourceFormatterFunction · 0.70

Tested by

no test coverage detected