Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"mcpServers": {
"sysdig": {
"type": "stdio",
"command": "go",
"args": [
"run",
"./cmd/server/"
]
}
}
}
288 changes: 229 additions & 59 deletions AGENTS.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
mkShell {
packages = [
ginkgo
go_1_25
go
gofumpt
golangci-lint
just
Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_generate_sysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (h *ToolGenerateSysql) RegisterInServer(s *server.MCPServer) {
),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions("sage.exec"),
)
s.AddTool(tool, h.handle)
Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_get_event_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func (h *ToolGetEventInfo) RegisterInServer(s *server.MCPServer) {
mcp.Required(),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions("policy-events.read"),
)

Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_get_event_process_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func (h *ToolGetEventProcessTree) RegisterInServer(s *server.MCPServer) {
mcp.Required(),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions("policy-events.read"),
)

Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_kubernetes_list_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func (t *KubernetesListClusters) RegisterInServer(s *server.MCPServer) {
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_kubernetes_list_cronjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ func (t *KubernetesListCronjobs) RegisterInServer(s *server.MCPServer) {
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_kubernetes_list_nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func (t *KubernetesListNodes) RegisterInServer(s *server.MCPServer) {
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func (t *KubernetesListPodContainers) RegisterInServer(s *server.MCPServer) {
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_kubernetes_list_workloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func (t *KubernetesListWorkloads) RegisterInServer(s *server.MCPServer) {
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_list_runtime_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ You can specify the severity of the events based on the following cases:
),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions("policy-events.read"),
)

Expand Down
2 changes: 2 additions & 0 deletions internal/infra/mcp/tools/tool_run_sysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func (h *ToolRunSysql) RegisterInServer(s *server.MCPServer) {
),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions("sage.exec", "risks.read"),
)
s.AddTool(tool, h.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func (t *TroubleshootKubernetesListCountPodsPerCluster) RegisterInServer(s *serv
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func (t *TroubleshootKubernetesListTop400500HttpErrorsInPods) RegisterInServer(s
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (t *TroubleshootKubernetesListTopCPUConsumedByContainer) RegisterInServer(s
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (t *TroubleshootKubernetesListTopCPUConsumedByWorkload) RegisterInServer(s
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (t *TroubleshootKubernetesListTopMemoryConsumedByContainer) RegisterInServe
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (t *TroubleshootKubernetesListTopMemoryConsumedByWorkload) RegisterInServer
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func (t *TroubleshootKubernetesListTopNetworkErrorsInPods) RegisterInServer(s *s
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func (t *TroubleshootKubernetesListTopRestartedPods) RegisterInServer(s *server.
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (t *TroubleshootKubernetesListTopUnavailablePods) RegisterInServer(s *serve
mcp.DefaultNumber(20),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func (t *TroubleshootKubernetesListUnderutilizedPodsByCPUQuota) RegisterInServer
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func (t *TroubleshootKubernetesListUnderutilizedPodsByMemoryQuota) RegisterInSer
mcp.DefaultNumber(10),
),
mcp.WithOutputSchema[map[string]any](),
mcp.WithReadOnlyHintAnnotation(true),
mcp.WithDestructiveHintAnnotation(false),
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
)
s.AddTool(tool, t.handle)
Expand Down
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ bump:
nix develop --command go get -u -t -v ./...
nix develop --command go mod tidy
nix develop --command just rehash-package-nix
nix develop --command pre-commit autoupdate


rehash-package-nix:
sd 'vendorHash = ".*";' 'vendorHash = "";' package.nix; h="$((nix build -L --no-link .#default || true) 2>&1 | sed -nE 's/.*got:[[:space:]]+([^ ]+).*/\1/p' | tail -1)"; [ -n "$h" ] && sd 'vendorHash = ".*";' "vendorHash = \"$h\";" package.nix && echo "vendorHash -> $h"