@@ -2,12 +2,15 @@ package mcp
22
33import (
44 "context"
5+ "net/http"
6+
7+ "github.com/mark3labs/mcp-go/mcp"
8+ "github.com/mark3labs/mcp-go/server"
9+ "k8s.io/utils/ptr"
10+
511 "github.com/manusa/kubernetes-mcp-server/pkg/kubernetes"
612 "github.com/manusa/kubernetes-mcp-server/pkg/output"
713 "github.com/manusa/kubernetes-mcp-server/pkg/version"
8- "github.com/mark3labs/mcp-go/mcp"
9- "github.com/mark3labs/mcp-go/server"
10- "net/http"
1114)
1215
1316type Configuration struct {
@@ -45,10 +48,6 @@ func NewSever(configuration Configuration) (*Server, error) {
4548 return s , nil
4649}
4750
48- func isFalse (value * bool ) bool {
49- return value == nil || ! * value
50- }
51-
5251func (s * Server ) reloadKubernetesClient () error {
5352 k , err := kubernetes .NewKubernetes (s .configuration .Kubeconfig )
5453 if err != nil {
@@ -57,10 +56,10 @@ func (s *Server) reloadKubernetesClient() error {
5756 s .k = k
5857 applicableTools := make ([]server.ServerTool , 0 )
5958 for _ , tool := range s .configuration .Profile .GetTools (s ) {
60- if s .configuration .ReadOnly && isFalse (tool .Tool .Annotations .ReadOnlyHint ) {
59+ if s .configuration .ReadOnly && ! ptr . Deref (tool .Tool .Annotations .ReadOnlyHint , false ) {
6160 continue
6261 }
63- if s .configuration .DisableDestructive && isFalse (tool .Tool .Annotations .ReadOnlyHint ) && ! isFalse (tool .Tool .Annotations .DestructiveHint ) {
62+ if s .configuration .DisableDestructive && ! ptr . Deref (tool .Tool .Annotations .ReadOnlyHint , false ) && ptr . Deref (tool .Tool .Annotations .DestructiveHint , false ) {
6463 continue
6564 }
6665 applicableTools = append (applicableTools , tool )
0 commit comments