You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/mcp/pods.go
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,21 +14,39 @@ func (s *Server) initPods() []server.ServerTool {
14
14
{Tool: mcp.NewTool("pods_list",
15
15
mcp.WithDescription("List all the Kubernetes pods in the current cluster from all namespaces"),
16
16
mcp.WithString("labelSelector", mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")),
17
+
// Tool annotations
18
+
mcp.WithTitleAnnotation("Pods: List"),
19
+
mcp.WithReadOnlyHintAnnotation(true),
20
+
mcp.WithOpenWorldHintAnnotation(true),
17
21
), Handler: s.podsListInAllNamespaces},
18
22
{Tool: mcp.NewTool("pods_list_in_namespace",
19
23
mcp.WithDescription("List all the Kubernetes pods in the specified namespace in the current cluster"),
20
24
mcp.WithString("namespace", mcp.Description("Namespace to list pods from"), mcp.Required()),
21
25
mcp.WithString("labelSelector", mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")),
26
+
// Tool annotations
27
+
mcp.WithTitleAnnotation("Pods: List in Namespace"),
28
+
mcp.WithReadOnlyHintAnnotation(true),
29
+
mcp.WithOpenWorldHintAnnotation(true),
22
30
), Handler: s.podsListInNamespace},
23
31
{Tool: mcp.NewTool("pods_get",
24
32
mcp.WithDescription("Get a Kubernetes Pod in the current or provided namespace with the provided name"),
25
33
mcp.WithString("namespace", mcp.Description("Namespace to get the Pod from")),
26
34
mcp.WithString("name", mcp.Description("Name of the Pod"), mcp.Required()),
35
+
// Tool annotations
36
+
mcp.WithTitleAnnotation("Pods: Get"),
37
+
mcp.WithReadOnlyHintAnnotation(true),
38
+
mcp.WithOpenWorldHintAnnotation(true),
27
39
), Handler: s.podsGet},
28
40
{Tool: mcp.NewTool("pods_delete",
29
41
mcp.WithDescription("Delete a Kubernetes Pod in the current or provided namespace with the provided name"),
30
42
mcp.WithString("namespace", mcp.Description("Namespace to delete the Pod from")),
31
43
mcp.WithString("name", mcp.Description("Name of the Pod to delete"), mcp.Required()),
44
+
// Tool annotations
45
+
mcp.WithTitleAnnotation("Pods: Delete"),
46
+
mcp.WithReadOnlyHintAnnotation(false),
47
+
mcp.WithDestructiveHintAnnotation(true),
48
+
mcp.WithIdempotentHintAnnotation(true),
49
+
mcp.WithOpenWorldHintAnnotation(true),
32
50
), Handler: s.podsDelete},
33
51
{Tool: mcp.NewTool("pods_exec",
34
52
mcp.WithDescription("Execute a command in a Kubernetes Pod in the current or provided namespace with the provided name and command"),
@@ -48,19 +66,35 @@ func (s *Server) initPods() []server.ServerTool {
48
66
mcp.Required(),
49
67
),
50
68
mcp.WithString("container", mcp.Description("Name of the Pod container where the command will be executed (Optional)")),
69
+
// Tool annotations
70
+
mcp.WithTitleAnnotation("Pods: Exec"),
71
+
mcp.WithReadOnlyHintAnnotation(false),
72
+
mcp.WithDestructiveHintAnnotation(true), // Depending on the Pod's entrypoint, executing certain commands may kill the Pod
73
+
mcp.WithIdempotentHintAnnotation(false),
74
+
mcp.WithOpenWorldHintAnnotation(true),
51
75
), Handler: s.podsExec},
52
76
{Tool: mcp.NewTool("pods_log",
53
77
mcp.WithDescription("Get the logs of a Kubernetes Pod in the current or provided namespace with the provided name"),
54
78
mcp.WithString("namespace", mcp.Description("Namespace to get the Pod logs from")),
55
79
mcp.WithString("name", mcp.Description("Name of the Pod to get the logs from"), mcp.Required()),
56
80
mcp.WithString("container", mcp.Description("Name of the Pod container to get the logs from (Optional)")),
81
+
// Tool annotations
82
+
mcp.WithTitleAnnotation("Pods: Log"),
83
+
mcp.WithReadOnlyHintAnnotation(true),
84
+
mcp.WithOpenWorldHintAnnotation(true),
57
85
), Handler: s.podsLog},
58
86
{Tool: mcp.NewTool("pods_run",
59
87
mcp.WithDescription("Run a Kubernetes Pod in the current or provided namespace with the provided container image and optional name"),
60
88
mcp.WithString("namespace", mcp.Description("Namespace to run the Pod in")),
61
89
mcp.WithString("name", mcp.Description("Name of the Pod (Optional, random name if not provided)")),
62
90
mcp.WithString("image", mcp.Description("Container Image to run in the Pod"), mcp.Required()),
63
91
mcp.WithNumber("port", mcp.Description("TCP/IP port to expose from the Pod container (Optional, no port exposed if not provided)")),
Copy file name to clipboardExpand all lines: pkg/mcp/resources.go
+22-2Lines changed: 22 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -31,8 +31,12 @@ func (s *Server) initResources() []server.ServerTool {
31
31
mcp.WithString("namespace",
32
32
mcp.Description("Optional Namespace to retrieve the namespaced resources from (ignored in case of cluster scoped resources). If not provided, will list resources from all namespaces")),
33
33
mcp.WithString("labelSelector",
34
-
mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]"))),
35
-
Handler: s.resourcesList},
34
+
mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")),
35
+
// Tool annotations
36
+
mcp.WithTitleAnnotation("Resources: List"),
37
+
mcp.WithReadOnlyHintAnnotation(true),
38
+
mcp.WithOpenWorldHintAnnotation(true),
39
+
), Handler: s.resourcesList},
36
40
{Tool: mcp.NewTool("resources_get",
37
41
mcp.WithDescription("Get a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name\n"+
38
42
commonApiVersion),
@@ -48,6 +52,10 @@ func (s *Server) initResources() []server.ServerTool {
48
52
mcp.Description("Optional Namespace to retrieve the namespaced resource from (ignored in case of cluster scoped resources). If not provided, will get resource from configured namespace"),
49
53
),
50
54
mcp.WithString("name", mcp.Description("Name of the resource"), mcp.Required()),
55
+
// Tool annotations
56
+
mcp.WithTitleAnnotation("Resources: Get"),
57
+
mcp.WithReadOnlyHintAnnotation(true),
58
+
mcp.WithOpenWorldHintAnnotation(true),
51
59
), Handler: s.resourcesGet},
52
60
{Tool: mcp.NewTool("resources_create_or_update",
53
61
mcp.WithDescription("Create or update a Kubernetes resource in the current cluster by providing a YAML or JSON representation of the resource\n"+
@@ -56,6 +64,12 @@ func (s *Server) initResources() []server.ServerTool {
56
64
mcp.Description("A JSON or YAML containing a representation of the Kubernetes resource. Should include top-level fields such as apiVersion,kind,metadata, and spec"),
57
65
mcp.Required(),
58
66
),
67
+
// Tool annotations
68
+
mcp.WithTitleAnnotation("Resources: Create or Update"),
69
+
mcp.WithReadOnlyHintAnnotation(false),
70
+
mcp.WithDestructiveHintAnnotation(true),
71
+
mcp.WithIdempotentHintAnnotation(true),
72
+
mcp.WithOpenWorldHintAnnotation(true),
59
73
), Handler: s.resourcesCreateOrUpdate},
60
74
{Tool: mcp.NewTool("resources_delete",
61
75
mcp.WithDescription("Delete a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name\n"+
@@ -72,6 +86,12 @@ func (s *Server) initResources() []server.ServerTool {
72
86
mcp.Description("Optional Namespace to delete the namespaced resource from (ignored in case of cluster scoped resources). If not provided, will delete resource from configured namespace"),
73
87
),
74
88
mcp.WithString("name", mcp.Description("Name of the resource"), mcp.Required()),
0 commit comments