@rad-security/mcp-server 0.0.47 → 0.0.48-3.g9b8c3ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/dist/apiPath.js +3 -1
- package/dist/apiPath.js.map +1 -1
- package/dist/client.d.ts +30 -0
- package/dist/client.js +83 -11
- package/dist/client.js.map +1 -1
- package/dist/index.js +149 -65
- package/dist/index.js.map +1 -1
- package/dist/operations/audit.d.ts +1 -17
- package/dist/operations/clusters.d.ts +2 -12
- package/dist/operations/containers.d.ts +2 -16
- package/dist/operations/custom-workflows.d.ts +5 -59
- package/dist/operations/cve-dispositions.d.ts +8 -24
- package/dist/operations/dashboards.d.ts +10 -68
- package/dist/operations/dashboards.js +2 -2
- package/dist/operations/dashboards.js.map +1 -1
- package/dist/operations/findings.d.ts +32 -38
- package/dist/operations/images.d.ts +4 -30
- package/dist/operations/inbox.d.ts +3 -23
- package/dist/operations/integrations.d.ts +1 -7
- package/dist/operations/knowledge-base.d.ts +8 -50
- package/dist/operations/kubeobject.d.ts +3 -21
- package/dist/operations/radql.d.ts +56 -122
- package/dist/operations/runtime.d.ts +5 -19
- package/dist/operations/workflows.d.ts +6 -32
- package/dist/operations/workflows.js +1 -1
- package/dist/operations/workflows.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +9 -6
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
4
4
|
import cors from "cors";
|
|
5
5
|
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
6
6
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
7
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
8
7
|
import { z } from "zod";
|
|
9
8
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
10
9
|
import express from "express";
|
|
@@ -26,6 +25,19 @@ import * as dashboards from "./operations/dashboards.js";
|
|
|
26
25
|
import * as integrations from "./operations/integrations.js";
|
|
27
26
|
import { VERSION } from "./version.js";
|
|
28
27
|
import { logger } from "./logger.js";
|
|
28
|
+
// Tool input schemas: what clients may send, so fields with defaults stay optional.
|
|
29
|
+
// Objects stay closed (additionalProperties: false), as they were with zod-to-json-schema.
|
|
30
|
+
function toolInputSchema(schema) {
|
|
31
|
+
return z.toJSONSchema(schema, {
|
|
32
|
+
target: "draft-7",
|
|
33
|
+
io: "input",
|
|
34
|
+
override: (ctx) => {
|
|
35
|
+
if (ctx.jsonSchema.type === "object" && ctx.jsonSchema.additionalProperties === undefined) {
|
|
36
|
+
ctx.jsonSchema.additionalProperties = false;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
29
41
|
// Parse toolkit filters from environment variables
|
|
30
42
|
function parseToolkitFilters() {
|
|
31
43
|
const includeEnv = process.env.INCLUDE_TOOLKITS;
|
|
@@ -41,14 +53,25 @@ function parseToolkitFilters() {
|
|
|
41
53
|
.split(",")
|
|
42
54
|
.map((s) => s.trim());
|
|
43
55
|
}
|
|
56
|
+
result.readonly = parseReadonly(process.env.RAD_SECURITY_READONLY);
|
|
44
57
|
return result;
|
|
45
58
|
}
|
|
59
|
+
// Tri-state, because "not set" has its own meaning: tenant-scoped sessions default to read-only.
|
|
60
|
+
function parseReadonly(value) {
|
|
61
|
+
const v = (value || "").trim();
|
|
62
|
+
if (/^(1|true|yes)$/i.test(v))
|
|
63
|
+
return true;
|
|
64
|
+
if (/^(0|false|no)$/i.test(v))
|
|
65
|
+
return false;
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
46
68
|
// Per-request toolkit selection via headers, so a single hosted endpoint can
|
|
47
69
|
// serve different agents a scoped subset. Falls back to the env filters when no
|
|
48
70
|
// toolkit header is present.
|
|
49
71
|
// X-Rad-Toolkits: comma-separated include list (only these enabled)
|
|
50
72
|
// X-Rad-Exclude-Toolkits: comma-separated exclude list (all others enabled)
|
|
51
73
|
// X-Rad-Readonly: true expose/allow only read-only tools (drops writes)
|
|
74
|
+
// X-Rad-Readonly: false allow writes (needed for writes in a tenant-scoped session)
|
|
52
75
|
function toolkitFiltersForRequest(req) {
|
|
53
76
|
const header = (name) => {
|
|
54
77
|
const v = req.headers[name];
|
|
@@ -61,7 +84,8 @@ function toolkitFiltersForRequest(req) {
|
|
|
61
84
|
.filter(Boolean);
|
|
62
85
|
return items.length ? items : undefined;
|
|
63
86
|
};
|
|
64
|
-
const readonly =
|
|
87
|
+
const readonly = parseReadonly(header("x-rad-readonly")) ??
|
|
88
|
+
parseReadonly(process.env.RAD_SECURITY_READONLY);
|
|
65
89
|
const include = parseList(header("x-rad-toolkits"));
|
|
66
90
|
const exclude = parseList(header("x-rad-exclude-toolkits"));
|
|
67
91
|
// A toolkit header, when present, overrides the env filters.
|
|
@@ -88,7 +112,34 @@ function isToolkitEnabled(toolkitType, filters) {
|
|
|
88
112
|
// By default, every toolkit is enabled
|
|
89
113
|
return true;
|
|
90
114
|
}
|
|
91
|
-
|
|
115
|
+
// Tools a tenant-scoped session calls without naming an account.
|
|
116
|
+
const TENANT_LEVEL_TOOLS = new Set(["list_accounts", "list_external_integrations"]);
|
|
117
|
+
const LIST_ACCOUNTS_TOOL = {
|
|
118
|
+
name: "list_accounts",
|
|
119
|
+
annotations: { title: "List Accounts", readOnlyHint: true },
|
|
120
|
+
description: "List the accounts in your tenant. Call this first: every account-scoped tool requires an account_id from this list.",
|
|
121
|
+
inputSchema: toolInputSchema(z.object({})),
|
|
122
|
+
};
|
|
123
|
+
// Add the required account_id argument to a tool's advertised schema for tenant-scoped sessions.
|
|
124
|
+
// It is removed again in the CallTool handler, before the tool's own schema parses the arguments.
|
|
125
|
+
function withRequiredAccountId(tool) {
|
|
126
|
+
return {
|
|
127
|
+
...tool,
|
|
128
|
+
inputSchema: {
|
|
129
|
+
...tool.inputSchema,
|
|
130
|
+
properties: {
|
|
131
|
+
...tool.inputSchema.properties,
|
|
132
|
+
account_id: {
|
|
133
|
+
type: "string",
|
|
134
|
+
minLength: 1,
|
|
135
|
+
description: "ID of the account to run this tool against. Find account IDs with list_accounts.",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
required: [...(tool.inputSchema.required ?? []), "account_id"],
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
async function newServer(rootClient, toolkitFilters) {
|
|
92
143
|
const server = new Server({
|
|
93
144
|
name: "RAD Security MCP Server",
|
|
94
145
|
version: VERSION,
|
|
@@ -107,13 +158,13 @@ async function newServer(client, toolkitFilters) {
|
|
|
107
158
|
name: "list_containers",
|
|
108
159
|
annotations: { title: "List Containers", readOnlyHint: true },
|
|
109
160
|
description: "List containers secured by RAD Security with optional filtering by image name, image digest, namespace, cluster_id, or free text search",
|
|
110
|
-
inputSchema:
|
|
161
|
+
inputSchema: toolInputSchema(containers.ListContainersSchema),
|
|
111
162
|
},
|
|
112
163
|
{
|
|
113
164
|
name: "get_container_details",
|
|
114
165
|
annotations: { title: "Get Container Details", readOnlyHint: true },
|
|
115
166
|
description: "Get detailed information about a container secured by RAD Security",
|
|
116
|
-
inputSchema:
|
|
167
|
+
inputSchema: toolInputSchema(containers.GetContainerDetailsSchema),
|
|
117
168
|
},
|
|
118
169
|
]
|
|
119
170
|
: []),
|
|
@@ -124,13 +175,13 @@ async function newServer(client, toolkitFilters) {
|
|
|
124
175
|
name: "list_clusters",
|
|
125
176
|
annotations: { title: "List Clusters", readOnlyHint: true },
|
|
126
177
|
description: "List Kubernetes clusters managed by RAD Security",
|
|
127
|
-
inputSchema:
|
|
178
|
+
inputSchema: toolInputSchema(clusters.ListClustersSchema),
|
|
128
179
|
},
|
|
129
180
|
{
|
|
130
181
|
name: "get_cluster_details",
|
|
131
182
|
annotations: { title: "Get Cluster Details", readOnlyHint: true },
|
|
132
183
|
description: "Get detailed information about a specific Kubernetes cluster managed by RAD Security",
|
|
133
|
-
inputSchema:
|
|
184
|
+
inputSchema: toolInputSchema(clusters.GetClusterDetailsSchema),
|
|
134
185
|
},
|
|
135
186
|
]
|
|
136
187
|
: []),
|
|
@@ -141,7 +192,7 @@ async function newServer(client, toolkitFilters) {
|
|
|
141
192
|
name: "who_shelled_into_pod",
|
|
142
193
|
annotations: { title: "Who Shelled Into Pod", readOnlyHint: true },
|
|
143
194
|
description: "Get k8s audit logs with information about users who shelled into a pod",
|
|
144
|
-
inputSchema:
|
|
195
|
+
inputSchema: toolInputSchema(audit.WhoShelledIntoPodSchema),
|
|
145
196
|
},
|
|
146
197
|
]
|
|
147
198
|
: []),
|
|
@@ -152,43 +203,43 @@ async function newServer(client, toolkitFilters) {
|
|
|
152
203
|
name: "list_images",
|
|
153
204
|
annotations: { title: "List Images", readOnlyHint: true },
|
|
154
205
|
description: "List container images with optional filtering by page, page size, sort, and search query",
|
|
155
|
-
inputSchema:
|
|
206
|
+
inputSchema: toolInputSchema(images.ListImagesSchema),
|
|
156
207
|
},
|
|
157
208
|
{
|
|
158
209
|
name: "list_image_vulnerabilities",
|
|
159
210
|
annotations: { title: "List Image Vulnerabilities", readOnlyHint: true },
|
|
160
211
|
description: "List vulnerabilities in a container image with optional filtering by severity",
|
|
161
|
-
inputSchema:
|
|
212
|
+
inputSchema: toolInputSchema(images.ListImageVulnerabilitiesSchema),
|
|
162
213
|
},
|
|
163
214
|
{
|
|
164
215
|
name: "get_top_vulnerable_images",
|
|
165
216
|
annotations: { title: "Get Top Vulnerable Images", readOnlyHint: true },
|
|
166
217
|
description: "Get the most vulnerable images from your account",
|
|
167
|
-
inputSchema:
|
|
218
|
+
inputSchema: toolInputSchema(z.object({})),
|
|
168
219
|
},
|
|
169
220
|
{
|
|
170
221
|
name: "get_image_sbom",
|
|
171
222
|
annotations: { title: "Get Image SBOM", readOnlyHint: true },
|
|
172
223
|
description: "Get the SBOM of a container image",
|
|
173
|
-
inputSchema:
|
|
224
|
+
inputSchema: toolInputSchema(images.GetImageSBOMSchema),
|
|
174
225
|
},
|
|
175
226
|
{
|
|
176
227
|
name: "ignore_cve",
|
|
177
228
|
annotations: { title: "Ignore CVE", readOnlyHint: false, destructiveHint: false },
|
|
178
229
|
description: "Ignore a CVE for this account so it no longer appears in vulnerability reporting. Use for confirmed false positives, accepted risks, or won't-fix decisions. Do NOT use for remediated CVEs — those drop off automatically on the next scan.",
|
|
179
|
-
inputSchema:
|
|
230
|
+
inputSchema: toolInputSchema(cveDispositions.ignoreCveSchema),
|
|
180
231
|
},
|
|
181
232
|
{
|
|
182
233
|
name: "unignore_cve",
|
|
183
234
|
annotations: { title: "Unignore CVE", readOnlyHint: false, destructiveHint: true },
|
|
184
235
|
description: "Remove an account-wide CVE disposition, restoring the CVE to vulnerability reporting.",
|
|
185
|
-
inputSchema:
|
|
236
|
+
inputSchema: toolInputSchema(cveDispositions.unignoreCveSchema),
|
|
186
237
|
},
|
|
187
238
|
{
|
|
188
239
|
name: "list_cve_dispositions",
|
|
189
240
|
annotations: { title: "List CVE Dispositions", readOnlyHint: true },
|
|
190
241
|
description: "List active CVE dispositions (ignored / false positive) for this account, with reason and author.",
|
|
191
|
-
inputSchema:
|
|
242
|
+
inputSchema: toolInputSchema(cveDispositions.listCveDispositionsSchema),
|
|
192
243
|
},
|
|
193
244
|
]
|
|
194
245
|
: []),
|
|
@@ -199,13 +250,13 @@ async function newServer(client, toolkitFilters) {
|
|
|
199
250
|
name: "get_k8s_resource_details",
|
|
200
251
|
annotations: { title: "Get Kubernetes Resource Details", readOnlyHint: true },
|
|
201
252
|
description: "Get the latest manifest of a Kubernetes resource",
|
|
202
|
-
inputSchema:
|
|
253
|
+
inputSchema: toolInputSchema(kubeobject.GetKubernetesResourceDetailsSchema),
|
|
203
254
|
},
|
|
204
255
|
{
|
|
205
256
|
name: "list_k8s_resources",
|
|
206
257
|
annotations: { title: "List Kubernetes Resources", readOnlyHint: true },
|
|
207
258
|
description: "List Kubernetes resources with optional filtering by namespace, resource types, and cluster",
|
|
208
|
-
inputSchema:
|
|
259
|
+
inputSchema: toolInputSchema(kubeobject.ListKubernetesResourcesSchema),
|
|
209
260
|
},
|
|
210
261
|
]
|
|
211
262
|
: []),
|
|
@@ -216,19 +267,19 @@ async function newServer(client, toolkitFilters) {
|
|
|
216
267
|
name: "get_containers_process_trees",
|
|
217
268
|
annotations: { title: "Get Container Process Trees", readOnlyHint: true },
|
|
218
269
|
description: "Get process trees for multiple containers",
|
|
219
|
-
inputSchema:
|
|
270
|
+
inputSchema: toolInputSchema(runtime.GetContainersProcessTreesSchema),
|
|
220
271
|
},
|
|
221
272
|
{
|
|
222
273
|
name: "get_containers_baselines",
|
|
223
274
|
annotations: { title: "Get Container Baselines", readOnlyHint: true },
|
|
224
275
|
description: "Get runtime baselines for multiple containers",
|
|
225
|
-
inputSchema:
|
|
276
|
+
inputSchema: toolInputSchema(runtime.GetContainersBaselinesSchema),
|
|
226
277
|
},
|
|
227
278
|
{
|
|
228
279
|
name: "get_container_llm_analysis",
|
|
229
280
|
annotations: { title: "Get Container LLM Analysis", readOnlyHint: true },
|
|
230
281
|
description: "Get LLM analysis of a container's process tree",
|
|
231
|
-
inputSchema:
|
|
282
|
+
inputSchema: toolInputSchema(runtime.GetContainerLLMAnalysisSchema),
|
|
232
283
|
},
|
|
233
284
|
]
|
|
234
285
|
: []),
|
|
@@ -239,13 +290,13 @@ async function newServer(client, toolkitFilters) {
|
|
|
239
290
|
name: "list_security_findings",
|
|
240
291
|
annotations: { title: "List Security Findings", readOnlyHint: true },
|
|
241
292
|
description: "List security findings with optional filtering by types, severities, sources, and status",
|
|
242
|
-
inputSchema:
|
|
293
|
+
inputSchema: toolInputSchema(findings.listFindingsSchema),
|
|
243
294
|
},
|
|
244
295
|
{
|
|
245
296
|
name: "update_security_finding_status",
|
|
246
297
|
annotations: { title: "Update Security Finding Status", readOnlyHint: false, destructiveHint: false },
|
|
247
298
|
description: "Update the status of a security finding",
|
|
248
|
-
inputSchema:
|
|
299
|
+
inputSchema: toolInputSchema(findings.updateFindingStatusSchema),
|
|
249
300
|
},
|
|
250
301
|
]
|
|
251
302
|
: []),
|
|
@@ -256,19 +307,19 @@ async function newServer(client, toolkitFilters) {
|
|
|
256
307
|
name: "mark_inbox_item_as_false_positive",
|
|
257
308
|
annotations: { title: "Mark Inbox Item as False Positive", readOnlyHint: false, destructiveHint: false },
|
|
258
309
|
description: "Mark an inbox item as a false positive with a reason",
|
|
259
|
-
inputSchema:
|
|
310
|
+
inputSchema: toolInputSchema(inbox.MarkInboxItemAsFalsePositiveSchema),
|
|
260
311
|
},
|
|
261
312
|
{
|
|
262
313
|
name: "list_inbox_items",
|
|
263
314
|
annotations: { title: "List Inbox Items", readOnlyHint: true },
|
|
264
315
|
description: "List inbox items with optional filtering by any field. Multiple filters can be combined eg. 'search:cve-2024-12345 and severity:high'",
|
|
265
|
-
inputSchema:
|
|
316
|
+
inputSchema: toolInputSchema(inbox.ListInboxItemsSchema),
|
|
266
317
|
},
|
|
267
318
|
{
|
|
268
319
|
name: "get_inbox_item_details",
|
|
269
320
|
annotations: { title: "Get Inbox Item Details", readOnlyHint: true },
|
|
270
321
|
description: "Get detailed information about a specific inbox item",
|
|
271
|
-
inputSchema:
|
|
322
|
+
inputSchema: toolInputSchema(inbox.GetInboxItemDetailsSchema),
|
|
272
323
|
},
|
|
273
324
|
]
|
|
274
325
|
: []),
|
|
@@ -279,37 +330,37 @@ async function newServer(client, toolkitFilters) {
|
|
|
279
330
|
name: "list_workflows",
|
|
280
331
|
annotations: { title: "List Workflows", readOnlyHint: true },
|
|
281
332
|
description: "List all workflows",
|
|
282
|
-
inputSchema:
|
|
333
|
+
inputSchema: toolInputSchema(workflows.ListWorkflowsSchema),
|
|
283
334
|
},
|
|
284
335
|
{
|
|
285
336
|
name: "get_workflow",
|
|
286
337
|
annotations: { title: "Get Workflow", readOnlyHint: true },
|
|
287
338
|
description: "Get detailed information about a specific workflow by ID. It contains the workflow definition, default arguments, and schema how to run the workflow",
|
|
288
|
-
inputSchema:
|
|
339
|
+
inputSchema: toolInputSchema(workflows.GetWorkflowSchema),
|
|
289
340
|
},
|
|
290
341
|
{
|
|
291
342
|
name: "list_workflow_runs",
|
|
292
343
|
annotations: { title: "List Workflow Runs", readOnlyHint: true },
|
|
293
344
|
description: "List workflow runs with optional filtering by workflow ID",
|
|
294
|
-
inputSchema:
|
|
345
|
+
inputSchema: toolInputSchema(workflows.ListWorkflowRunsSchema),
|
|
295
346
|
},
|
|
296
347
|
{
|
|
297
348
|
name: "get_workflow_run",
|
|
298
349
|
annotations: { title: "Get Workflow Run", readOnlyHint: true },
|
|
299
350
|
description: "Get detailed information about a specific workflow run",
|
|
300
|
-
inputSchema:
|
|
351
|
+
inputSchema: toolInputSchema(workflows.GetWorkflowRunSchema),
|
|
301
352
|
},
|
|
302
353
|
{
|
|
303
354
|
name: "run_workflow",
|
|
304
355
|
annotations: { title: "Run Workflow", readOnlyHint: false, destructiveHint: true },
|
|
305
356
|
description: "Run a workflow with optional argument overrides",
|
|
306
|
-
inputSchema:
|
|
357
|
+
inputSchema: toolInputSchema(workflows.RunWorkflowSchema),
|
|
307
358
|
},
|
|
308
359
|
{
|
|
309
360
|
name: "list_workflow_schedules",
|
|
310
361
|
annotations: { title: "List Workflow Schedules", readOnlyHint: true },
|
|
311
362
|
description: "List workflow schedules with optional filtering by workflow ID",
|
|
312
|
-
inputSchema:
|
|
363
|
+
inputSchema: toolInputSchema(workflows.ListWorkflowSchedulesSchema),
|
|
313
364
|
},
|
|
314
365
|
]
|
|
315
366
|
: []),
|
|
@@ -325,13 +376,13 @@ async function newServer(client, toolkitFilters) {
|
|
|
325
376
|
name: "create_custom_workflow",
|
|
326
377
|
annotations: { title: "Create Automation", readOnlyHint: false, destructiveHint: false },
|
|
327
378
|
description: "Create a new automation (a Windmill workflow) from a YAML definition. Pass the YAML document itself as a string, not a file path. It is validated server-side before deployment; on failure nothing is deployed and the errors are returned. Returns the new automation WITHOUT echoing the definition back — use `id` from the result when referring to it, and `get_workflow` if you need to read the definition.",
|
|
328
|
-
inputSchema:
|
|
379
|
+
inputSchema: toolInputSchema(customWorkflows.CreateCustomWorkflowSchema),
|
|
329
380
|
},
|
|
330
381
|
{
|
|
331
382
|
name: "update_custom_workflow",
|
|
332
383
|
annotations: { title: "Update Automation", readOnlyHint: false, destructiveHint: false },
|
|
333
384
|
description: "Update an existing automation with new YAML. Only automations created via create_custom_workflow can be updated. Returns the updated automation without echoing the definition back.",
|
|
334
|
-
inputSchema:
|
|
385
|
+
inputSchema: toolInputSchema(customWorkflows.UpdateCustomWorkflowSchema),
|
|
335
386
|
},
|
|
336
387
|
{
|
|
337
388
|
name: "add_workflow_schedule",
|
|
@@ -339,21 +390,21 @@ async function newServer(client, toolkitFilters) {
|
|
|
339
390
|
description: "Add a cron-based schedule to an automation so it runs automatically at the specified times. " +
|
|
340
391
|
"This ADDS a schedule; to change when an automation runs, use update_workflow_schedule instead, " +
|
|
341
392
|
"or the automation will fire at both the old time and the new one.",
|
|
342
|
-
inputSchema:
|
|
393
|
+
inputSchema: toolInputSchema(customWorkflows.AddWorkflowScheduleSchema),
|
|
343
394
|
},
|
|
344
395
|
{
|
|
345
396
|
name: "update_workflow_schedule",
|
|
346
397
|
annotations: { title: "Update Automation Schedule", readOnlyHint: false, destructiveHint: false },
|
|
347
398
|
description: "Change an existing schedule's cron expression or timezone. Use this to move when an " +
|
|
348
399
|
"automation runs. Get the schedule_id from list_workflow_schedules.",
|
|
349
|
-
inputSchema:
|
|
400
|
+
inputSchema: toolInputSchema(customWorkflows.UpdateWorkflowScheduleSchema),
|
|
350
401
|
},
|
|
351
402
|
{
|
|
352
403
|
name: "delete_workflow_schedule",
|
|
353
404
|
annotations: { title: "Delete Automation Schedule", readOnlyHint: false, destructiveHint: true },
|
|
354
405
|
description: "Remove a schedule from an automation so it stops running on that cadence. The automation " +
|
|
355
406
|
"itself is not deleted. Get the schedule_id from list_workflow_schedules.",
|
|
356
|
-
inputSchema:
|
|
407
|
+
inputSchema: toolInputSchema(customWorkflows.DeleteWorkflowScheduleSchema),
|
|
357
408
|
},
|
|
358
409
|
]
|
|
359
410
|
: []),
|
|
@@ -364,37 +415,37 @@ async function newServer(client, toolkitFilters) {
|
|
|
364
415
|
name: "search_knowledge_base",
|
|
365
416
|
annotations: { title: "Search Knowledge Base", readOnlyHint: true },
|
|
366
417
|
description: "Search your organization's knowledge base to find relevant uploaded documents, procedures, reports, and other content using natural language queries",
|
|
367
|
-
inputSchema:
|
|
418
|
+
inputSchema: toolInputSchema(knowledgeBase.SearchKnowledgeBaseSchema),
|
|
368
419
|
},
|
|
369
420
|
{
|
|
370
421
|
name: "list_knowledge_base_collections",
|
|
371
422
|
annotations: { title: "List Knowledge Base Collections", readOnlyHint: true },
|
|
372
423
|
description: "List all collections in your organization's knowledge base. Collections are used to organize and categorize documents",
|
|
373
|
-
inputSchema:
|
|
424
|
+
inputSchema: toolInputSchema(knowledgeBase.ListCollectionsSchema),
|
|
374
425
|
},
|
|
375
426
|
{
|
|
376
427
|
name: "list_knowledge_base_documents",
|
|
377
428
|
annotations: { title: "List Knowledge Base Documents", readOnlyHint: true },
|
|
378
429
|
description: "List documents in your organization's knowledge base with optional filtering by collections, file type, or status",
|
|
379
|
-
inputSchema:
|
|
430
|
+
inputSchema: toolInputSchema(knowledgeBase.ListDocumentsSchema),
|
|
380
431
|
},
|
|
381
432
|
{
|
|
382
433
|
name: "query_knowledge_base_document",
|
|
383
434
|
annotations: { title: "Query Knowledge Base Document", readOnlyHint: true },
|
|
384
435
|
description: "Query a CSV document from the knowledge base using natural language. IMPORTANT: This tool ONLY works with CSV documents. Use list_knowledge_base_documents with filters='file_type:csv' to find CSV document IDs (search_knowledge_base results also contain document IDs). Results are returned as a markdown table",
|
|
385
|
-
inputSchema:
|
|
436
|
+
inputSchema: toolInputSchema(knowledgeBase.StructuredQueryDocumentSchema),
|
|
386
437
|
},
|
|
387
438
|
{
|
|
388
439
|
name: "get_knowledge_base_document_content",
|
|
389
440
|
annotations: { title: "Get Knowledge Base Document Content", readOnlyHint: true },
|
|
390
441
|
description: "Get the FULL text content of a knowledge base document (extracted text for PDF/DOCX, the raw file for markdown/plaintext/CSV). Use this to read or analyze a whole document rather than the excerpts search_knowledge_base returns. Find document IDs via list_knowledge_base_documents or search_knowledge_base results",
|
|
391
|
-
inputSchema:
|
|
442
|
+
inputSchema: toolInputSchema(knowledgeBase.GetDocumentContentSchema),
|
|
392
443
|
},
|
|
393
444
|
{
|
|
394
445
|
name: "get_knowledge_base_document_download_url",
|
|
395
446
|
annotations: { title: "Get Knowledge Base Document Download URL", readOnlyHint: true },
|
|
396
447
|
description: "Get a time-limited download URL for the ORIGINAL document file (any format, including PDF/DOCX binaries). Use when you need the original file itself — e.g. to fetch it into a sandbox for structural parsing (tables, layout), or when get_knowledge_base_document_content reports no text available. For reading text, prefer get_knowledge_base_document_content",
|
|
397
|
-
inputSchema:
|
|
448
|
+
inputSchema: toolInputSchema(knowledgeBase.GetDocumentDownloadUrlSchema),
|
|
398
449
|
},
|
|
399
450
|
]
|
|
400
451
|
: []),
|
|
@@ -405,19 +456,19 @@ async function newServer(client, toolkitFilters) {
|
|
|
405
456
|
name: "radql_list_data_types",
|
|
406
457
|
annotations: { title: "RadQL: List Data Types", readOnlyHint: true },
|
|
407
458
|
description: "List all available RadQL data types (discovery). ALWAYS call this FIRST before using other RadQL tools to discover what data is available to query. Returns data types like 'containers', 'kubernetes_resources', 'inbox_items', 'cloud_resources', 'cloud_benchmarks', 'cloud_benchmark_summaries', etc. with descriptions.",
|
|
408
|
-
inputSchema:
|
|
459
|
+
inputSchema: toolInputSchema(radql.RadQLListDataTypesSchema),
|
|
409
460
|
},
|
|
410
461
|
{
|
|
411
462
|
name: "radql_get_type_metadata",
|
|
412
463
|
annotations: { title: "RadQL: Get Type Metadata", readOnlyHint: true },
|
|
413
464
|
description: "Get schema/metadata for a specific RadQL data type. Shows available fields, data types, which fields can be filtered/searched, and provides query examples. Call this AFTER radql_list_data_types to understand how to query a specific data type.",
|
|
414
|
-
inputSchema:
|
|
465
|
+
inputSchema: toolInputSchema(radql.RadQLGetTypeMetadataSchema),
|
|
415
466
|
},
|
|
416
467
|
{
|
|
417
468
|
name: "radql_list_filter_values",
|
|
418
469
|
annotations: { title: "RadQL: List Filter Values", readOnlyHint: true },
|
|
419
470
|
description: "List possible values for a filter field (e.g., namespace list, cluster list, severity values). Useful for building dynamic filters when you need to know available enum-like values. Call this when constructing filters that need specific values.",
|
|
420
|
-
inputSchema:
|
|
471
|
+
inputSchema: toolInputSchema(radql.RadQLListFilterValuesSchema),
|
|
421
472
|
},
|
|
422
473
|
{
|
|
423
474
|
name: "radql_query",
|
|
@@ -466,19 +517,19 @@ OK to leave unquoted:
|
|
|
466
517
|
- Simple wildcards: name:nginx*
|
|
467
518
|
|
|
468
519
|
For complete schema: call radql_get_type_metadata with target data_type`,
|
|
469
|
-
inputSchema:
|
|
520
|
+
inputSchema: toolInputSchema(radql.RadQLQuerySchema),
|
|
470
521
|
},
|
|
471
522
|
{
|
|
472
523
|
name: "radql_query_builder",
|
|
473
524
|
annotations: { title: "RadQL: Query Builder", readOnlyHint: true },
|
|
474
525
|
description: "Helper tool to build RadQL queries programmatically from structured conditions. Useful when you need to construct complex filter or stats queries from structured inputs.",
|
|
475
|
-
inputSchema:
|
|
526
|
+
inputSchema: toolInputSchema(radql.RadQLQueryBuilderSchema),
|
|
476
527
|
},
|
|
477
528
|
{
|
|
478
529
|
name: "radql_batch_query",
|
|
479
530
|
annotations: { title: "RadQL: Batch Query", readOnlyHint: true },
|
|
480
531
|
description: "Execute multiple RadQL queries in parallel for efficiency. Useful for fetching related data from different data types simultaneously (e.g., container details + vulnerabilities + network connections).",
|
|
481
|
-
inputSchema:
|
|
532
|
+
inputSchema: toolInputSchema(radql.RadQLBatchQuerySchema),
|
|
482
533
|
},
|
|
483
534
|
]
|
|
484
535
|
: []),
|
|
@@ -489,13 +540,13 @@ For complete schema: call radql_get_type_metadata with target data_type`,
|
|
|
489
540
|
name: "list_widget_templates",
|
|
490
541
|
annotations: { title: "List Widget Templates", readOnlyHint: true },
|
|
491
542
|
description: "List widget templates with optional filtering by visualization type and category",
|
|
492
|
-
inputSchema:
|
|
543
|
+
inputSchema: toolInputSchema(dashboards.ListWidgetTemplatesSchema),
|
|
493
544
|
},
|
|
494
545
|
{
|
|
495
546
|
name: "get_widget_template",
|
|
496
547
|
annotations: { title: "Get Widget Template", readOnlyHint: true },
|
|
497
548
|
description: "Get detailed information about a specific widget template",
|
|
498
|
-
inputSchema:
|
|
549
|
+
inputSchema: toolInputSchema(dashboards.GetWidgetTemplateSchema),
|
|
499
550
|
},
|
|
500
551
|
{
|
|
501
552
|
name: "list_dashboard_templates",
|
|
@@ -504,37 +555,37 @@ For complete schema: call radql_get_type_metadata with target data_type`,
|
|
|
504
555
|
"given area (containers, images, runtime, compliance, findings). Returns id, " +
|
|
505
556
|
"title, description and category WITHOUT the rows — call get_dashboard_template " +
|
|
506
557
|
"with the id to read a definition and copy its widgets and queries.",
|
|
507
|
-
inputSchema:
|
|
558
|
+
inputSchema: toolInputSchema(dashboards.ListDashboardTemplatesSchema),
|
|
508
559
|
},
|
|
509
560
|
{
|
|
510
561
|
name: "get_dashboard_template",
|
|
511
562
|
annotations: { title: "Get Dashboard Template", readOnlyHint: true },
|
|
512
563
|
description: "Get detailed information about a specific dashboard template",
|
|
513
|
-
inputSchema:
|
|
564
|
+
inputSchema: toolInputSchema(dashboards.GetDashboardTemplateSchema),
|
|
514
565
|
},
|
|
515
566
|
{
|
|
516
567
|
name: "list_dashboards",
|
|
517
568
|
annotations: { title: "List Dashboards", readOnlyHint: true },
|
|
518
569
|
description: "List dashboards for the account",
|
|
519
|
-
inputSchema:
|
|
570
|
+
inputSchema: toolInputSchema(dashboards.ListDashboardsSchema),
|
|
520
571
|
},
|
|
521
572
|
{
|
|
522
573
|
name: "get_dashboard",
|
|
523
574
|
annotations: { title: "Get Dashboard", readOnlyHint: true },
|
|
524
575
|
description: "Get detailed information about a specific dashboard",
|
|
525
|
-
inputSchema:
|
|
576
|
+
inputSchema: toolInputSchema(dashboards.GetDashboardSchema),
|
|
526
577
|
},
|
|
527
578
|
{
|
|
528
579
|
name: "create_dashboard",
|
|
529
580
|
annotations: { title: "Create Dashboard", readOnlyHint: false, destructiveHint: false },
|
|
530
581
|
description: "Create a dashboard for the account. Build `rows` from the widget templates (list_widget_templates / get_widget_template) so the visualization and query shapes are valid.",
|
|
531
|
-
inputSchema:
|
|
582
|
+
inputSchema: toolInputSchema(dashboards.CreateDashboardSchema),
|
|
532
583
|
},
|
|
533
584
|
{
|
|
534
585
|
name: "update_dashboard",
|
|
535
586
|
annotations: { title: "Update Dashboard", readOnlyHint: false, destructiveHint: false },
|
|
536
587
|
description: "Update an existing dashboard. Omitted fields are left unchanged, so a small edit (a title, one row) does not require resending the whole dashboard.",
|
|
537
|
-
inputSchema:
|
|
588
|
+
inputSchema: toolInputSchema(dashboards.UpdateDashboardSchema),
|
|
538
589
|
},
|
|
539
590
|
]
|
|
540
591
|
: []),
|
|
@@ -545,22 +596,36 @@ For complete schema: call radql_get_type_metadata with target data_type`,
|
|
|
545
596
|
name: "list_external_integrations",
|
|
546
597
|
annotations: { title: "List External Integrations", readOnlyHint: true },
|
|
547
598
|
description: "List external integrations configured for the tenant (e.g., Slack, AWS CloudTrail, Okta). Returns integration details including capabilities, configuration, mcp support and sync status.",
|
|
548
|
-
inputSchema:
|
|
599
|
+
inputSchema: toolInputSchema(integrations.ListExternalIntegrationsSchema),
|
|
549
600
|
},
|
|
550
601
|
]
|
|
551
602
|
: []),
|
|
552
603
|
];
|
|
604
|
+
const tenantScoped = rootClient.isTenantScoped();
|
|
605
|
+
const scopedTools = tenantScoped
|
|
606
|
+
? [
|
|
607
|
+
LIST_ACCOUNTS_TOOL,
|
|
608
|
+
...allTools.map((t) => TENANT_LEVEL_TOOLS.has(t.name) ? t : withRequiredAccountId(t)),
|
|
609
|
+
]
|
|
610
|
+
: allTools;
|
|
611
|
+
// A tenant credential reaches every account, so text read from one account could steer a write
|
|
612
|
+
// in another. Tenant-scoped sessions therefore stay read-only unless writes are explicitly enabled.
|
|
613
|
+
const readonly = toolkitFilters.readonly ?? tenantScoped;
|
|
553
614
|
// In read-only mode, expose only tools whose readOnlyHint is true.
|
|
554
|
-
const tools =
|
|
555
|
-
?
|
|
615
|
+
const tools = readonly
|
|
616
|
+
? scopedTools.filter((t) => t.annotations
|
|
556
617
|
?.readOnlyHint === true)
|
|
557
|
-
:
|
|
618
|
+
: scopedTools;
|
|
558
619
|
// The advertised set is also the allowed set — CallTool enforces it below.
|
|
559
620
|
const enabledToolNames = new Set(tools.map((t) => t.name));
|
|
560
621
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
|
|
561
|
-
server.setRequestHandler(CallToolRequestSchema, async (
|
|
622
|
+
server.setRequestHandler(CallToolRequestSchema, async (rawRequest) => {
|
|
562
623
|
const startTime = Date.now();
|
|
563
|
-
const toolName =
|
|
624
|
+
const toolName = rawRequest.params.name;
|
|
625
|
+
// In a tenant-scoped session these become the named account's client and the arguments
|
|
626
|
+
// without account_id, so the tool implementations don't need to know about tenant scope.
|
|
627
|
+
let client = rootClient;
|
|
628
|
+
let request = rawRequest;
|
|
564
629
|
try {
|
|
565
630
|
if (!enabledToolNames.has(toolName)) {
|
|
566
631
|
throw new Error(`Tool "${toolName}" is not enabled for this session`);
|
|
@@ -568,12 +633,31 @@ For complete schema: call radql_get_type_metadata with target data_type`,
|
|
|
568
633
|
if (!request.params.arguments) {
|
|
569
634
|
throw new Error("Arguments are required");
|
|
570
635
|
}
|
|
636
|
+
if (tenantScoped && !TENANT_LEVEL_TOOLS.has(toolName)) {
|
|
637
|
+
const { account_id: accountId, ...toolArguments } = request.params.arguments;
|
|
638
|
+
if (typeof accountId !== "string" || !accountId) {
|
|
639
|
+
throw new Error(`"account_id" is required for ${toolName}. Call list_accounts to find valid account IDs.`);
|
|
640
|
+
}
|
|
641
|
+
client = await rootClient.forAccount(accountId);
|
|
642
|
+
request = {
|
|
643
|
+
...request,
|
|
644
|
+
params: { ...request.params, arguments: toolArguments },
|
|
645
|
+
};
|
|
646
|
+
}
|
|
571
647
|
logger.info({
|
|
572
648
|
tool: toolName,
|
|
573
|
-
|
|
649
|
+
...client.getLogContext(),
|
|
574
650
|
arguments: request.params.arguments,
|
|
575
651
|
}, "tool_invoked");
|
|
576
652
|
switch (toolName) {
|
|
653
|
+
case "list_accounts": {
|
|
654
|
+
const accounts = await client.listTenantAccounts();
|
|
655
|
+
return {
|
|
656
|
+
content: [
|
|
657
|
+
{ type: "text", text: JSON.stringify({ accounts }, null, 2) },
|
|
658
|
+
],
|
|
659
|
+
};
|
|
660
|
+
}
|
|
577
661
|
// Container tools
|
|
578
662
|
case "list_containers": {
|
|
579
663
|
const args = containers.ListContainersSchema.parse(request.params.arguments);
|
|
@@ -1084,7 +1168,7 @@ For complete schema: call radql_get_type_metadata with target data_type`,
|
|
|
1084
1168
|
const duration = Date.now() - startTime;
|
|
1085
1169
|
logger.info({
|
|
1086
1170
|
tool: toolName,
|
|
1087
|
-
|
|
1171
|
+
...client.getLogContext(),
|
|
1088
1172
|
duration_ms: duration,
|
|
1089
1173
|
}, "tool_execution_completed");
|
|
1090
1174
|
}
|
|
@@ -1093,7 +1177,7 @@ For complete schema: call radql_get_type_metadata with target data_type`,
|
|
|
1093
1177
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1094
1178
|
logger.error({
|
|
1095
1179
|
tool: toolName,
|
|
1096
|
-
|
|
1180
|
+
...client.getLogContext(),
|
|
1097
1181
|
error: errorMessage,
|
|
1098
1182
|
duration_ms: duration,
|
|
1099
1183
|
}, "tool_execution_failed");
|