@zivis/mcp 0.1.19 → 0.2.2
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/dist/matcher/index.js +1 -1
- package/dist/matcher/inference-candidates.js +1 -1
- package/dist/pattern-packs/zivis-public-0.2.0/manifest.json +1 -1
- package/dist/server.js +22 -143
- package/dist/tools/application.d.ts +53 -0
- package/dist/tools/application.js +232 -0
- package/dist/tools/artifacts.d.ts +21 -57
- package/dist/tools/artifacts.js +116 -150
- package/dist/tools/devx-run.d.ts +15 -37
- package/dist/tools/devx-run.js +66 -77
- package/dist/tools/diagram.d.ts +55 -0
- package/dist/tools/diagram.js +209 -0
- package/dist/tools/document.d.ts +48 -0
- package/dist/tools/document.js +137 -0
- package/dist/tools/finding.d.ts +133 -0
- package/dist/tools/finding.js +211 -0
- package/dist/tools/get-started.d.ts +1 -1
- package/dist/tools/get-started.js +15 -33
- package/dist/tools/security-memory.d.ts +21 -55
- package/dist/tools/security-memory.js +93 -138
- package/dist/tools/threat-library.d.ts +27 -0
- package/dist/tools/threat-library.js +266 -0
- package/package.json +1 -1
- package/dist/tools/create-diagram.d.ts +0 -39
- package/dist/tools/create-diagram.js +0 -74
- package/dist/tools/create-document.d.ts +0 -23
- package/dist/tools/create-document.js +0 -47
- package/dist/tools/create-finding.d.ts +0 -85
- package/dist/tools/create-finding.js +0 -136
- package/dist/tools/delete-finding.d.ts +0 -19
- package/dist/tools/delete-finding.js +0 -36
- package/dist/tools/discover-local-infra.d.ts +0 -14
- package/dist/tools/discover-local-infra.js +0 -686
- package/dist/tools/explain-signal-for-diff.d.ts +0 -34
- package/dist/tools/explain-signal-for-diff.js +0 -75
- package/dist/tools/get-application-overview.d.ts +0 -22
- package/dist/tools/get-application-overview.js +0 -137
- package/dist/tools/get-application.d.ts +0 -22
- package/dist/tools/get-application.js +0 -77
- package/dist/tools/get-diagram.d.ts +0 -22
- package/dist/tools/get-diagram.js +0 -49
- package/dist/tools/get-document.d.ts +0 -17
- package/dist/tools/get-document.js +0 -37
- package/dist/tools/get-signal.d.ts +0 -24
- package/dist/tools/get-signal.js +0 -75
- package/dist/tools/import-openapi-endpoints.d.ts +0 -28
- package/dist/tools/import-openapi-endpoints.js +0 -87
- package/dist/tools/inspect.d.ts +0 -21
- package/dist/tools/inspect.js +0 -222
- package/dist/tools/list-applications.d.ts +0 -29
- package/dist/tools/list-applications.js +0 -68
- package/dist/tools/list-diagrams.d.ts +0 -37
- package/dist/tools/list-diagrams.js +0 -74
- package/dist/tools/list-documents.d.ts +0 -19
- package/dist/tools/list-documents.js +0 -44
- package/dist/tools/list-endpoints.d.ts +0 -42
- package/dist/tools/list-endpoints.js +0 -92
- package/dist/tools/list-signals.d.ts +0 -37
- package/dist/tools/list-signals.js +0 -83
- package/dist/tools/manage-application.d.ts +0 -64
- package/dist/tools/manage-application.js +0 -129
- package/dist/tools/manage-diagram.d.ts +0 -41
- package/dist/tools/manage-diagram.js +0 -91
- package/dist/tools/manage-endpoint-lifecycle.d.ts +0 -80
- package/dist/tools/manage-endpoint-lifecycle.js +0 -180
- package/dist/tools/security-review.d.ts +0 -40
- package/dist/tools/security-review.js +0 -199
- package/dist/tools/threat-get-capsule.d.ts +0 -15
- package/dist/tools/threat-get-capsule.js +0 -53
- package/dist/tools/threat-get-inference-prompt.d.ts +0 -15
- package/dist/tools/threat-get-inference-prompt.js +0 -73
- package/dist/tools/threat-list-relevant-capsules.d.ts +0 -17
- package/dist/tools/threat-list-relevant-capsules.js +0 -158
- package/dist/tools/threat-run-matcher.d.ts +0 -17
- package/dist/tools/threat-run-matcher.js +0 -145
- package/dist/tools/update-document.d.ts +0 -23
- package/dist/tools/update-document.js +0 -57
- package/dist/tools/update-endpoint.d.ts +0 -60
- package/dist/tools/update-endpoint.js +0 -138
- package/dist/tools/update-finding.d.ts +0 -61
- package/dist/tools/update-finding.js +0 -80
- package/dist/tools/update-mermaid-source.d.ts +0 -21
- package/dist/tools/update-mermaid-source.js +0 -60
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { sanitizeResponse } from "../sanitize.js";
|
|
3
|
-
export const CREATE_DIAGRAM_NAME = "zivis_create_diagram";
|
|
4
|
-
export const CREATE_DIAGRAM_DESCRIPTION = `Create a new diagram from Mermaid source.
|
|
5
|
-
|
|
6
|
-
Use this to record system architecture diagrams, data flow diagrams, attack chains, sequence diagrams, etc. from code analysis. Content is Mermaid syntax (flowchart, sequenceDiagram, etc.) — see zivis_update_mermaid_source for editing an existing diagram's source.`;
|
|
7
|
-
export const CREATE_DIAGRAM_SCHEMA = {
|
|
8
|
-
name: z
|
|
9
|
-
.string()
|
|
10
|
-
.describe("Diagram name"),
|
|
11
|
-
description: z
|
|
12
|
-
.string()
|
|
13
|
-
.optional()
|
|
14
|
-
.describe("Diagram description"),
|
|
15
|
-
diagram_type: z
|
|
16
|
-
.enum(["architecture", "data_flow", "attack_chain", "sequence", "trust_boundary", "network", "deployment", "custom"])
|
|
17
|
-
.describe("Type of diagram"),
|
|
18
|
-
content: z
|
|
19
|
-
.string()
|
|
20
|
-
.describe("Mermaid diagram source (e.g., 'flowchart TD\\n A[Client] --> B[Server]')"),
|
|
21
|
-
linked_threat_model_id: z
|
|
22
|
-
.string()
|
|
23
|
-
.optional()
|
|
24
|
-
.describe("Threat model UUID to link this diagram to after creation"),
|
|
25
|
-
};
|
|
26
|
-
export function createCreateDiagramHandler(apiClient) {
|
|
27
|
-
return async (params) => {
|
|
28
|
-
try {
|
|
29
|
-
const data = await apiClient.post("/api/diagrams", {
|
|
30
|
-
name: params.name,
|
|
31
|
-
description: params.description,
|
|
32
|
-
diagramType: params.diagram_type,
|
|
33
|
-
contentType: "mermaid",
|
|
34
|
-
content: params.content,
|
|
35
|
-
sourceType: "manual",
|
|
36
|
-
});
|
|
37
|
-
const sanitized = sanitizeResponse(data);
|
|
38
|
-
const diagramId = sanitized.id;
|
|
39
|
-
let linkedThreatModelId = null;
|
|
40
|
-
if (params.linked_threat_model_id && diagramId) {
|
|
41
|
-
try {
|
|
42
|
-
await apiClient.post(`/api/diagrams/${diagramId}/link`, {
|
|
43
|
-
threatModelId: params.linked_threat_model_id,
|
|
44
|
-
});
|
|
45
|
-
linkedThreatModelId = params.linked_threat_model_id;
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const result = {
|
|
51
|
-
diagram_id: diagramId,
|
|
52
|
-
name: sanitized.name,
|
|
53
|
-
diagram_type: sanitized.diagramType,
|
|
54
|
-
linked_threat_model_id: linkedThreatModelId,
|
|
55
|
-
_instruction: "Diagram created. Use zivis_get_diagram to see full content, or zivis_manage_diagram to modify metadata/links, or zivis_update_mermaid_source to change the diagram source.",
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
content: [
|
|
59
|
-
{
|
|
60
|
-
type: "text",
|
|
61
|
-
text: JSON.stringify(result, null, 2),
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
catch (err) {
|
|
67
|
-
const message = err instanceof Error ? err.message : "Failed to create diagram";
|
|
68
|
-
return {
|
|
69
|
-
content: [{ type: "text", text: `Error: ${message}` }],
|
|
70
|
-
isError: true,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { ApiClient } from "../api-client.js";
|
|
3
|
-
export declare const CREATE_DOCUMENT_NAME = "zivis_create_document";
|
|
4
|
-
export declare const CREATE_DOCUMENT_DESCRIPTION = "Create a new narrative markdown document under a ThreatModel.\n\nUse this when the user wants a rich written artifact to accompany the threat model \u2014 executive summary, remediation plan, architecture narrative, etc. The document can embed standalone Diagrams by reference.";
|
|
5
|
-
export declare const CREATE_DOCUMENT_SCHEMA: {
|
|
6
|
-
threat_model_id: z.ZodString;
|
|
7
|
-
title: z.ZodString;
|
|
8
|
-
content: z.ZodOptional<z.ZodString>;
|
|
9
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
|
-
};
|
|
11
|
-
type CreateDocumentParams = {
|
|
12
|
-
threat_model_id: string;
|
|
13
|
-
title: string;
|
|
14
|
-
content?: string;
|
|
15
|
-
tags?: string[];
|
|
16
|
-
};
|
|
17
|
-
export declare function createCreateDocumentHandler(apiClient: ApiClient): (params: CreateDocumentParams) => Promise<{
|
|
18
|
-
content: {
|
|
19
|
-
type: "text";
|
|
20
|
-
text: string;
|
|
21
|
-
}[];
|
|
22
|
-
}>;
|
|
23
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { sanitizeResponse, sanitizeInboundText } from "../sanitize.js";
|
|
3
|
-
export const CREATE_DOCUMENT_NAME = "zivis_create_document";
|
|
4
|
-
export const CREATE_DOCUMENT_DESCRIPTION = `Create a new narrative markdown document under a ThreatModel.
|
|
5
|
-
|
|
6
|
-
Use this when the user wants a rich written artifact to accompany the threat model — executive summary, remediation plan, architecture narrative, etc. The document can embed standalone Diagrams by reference.`;
|
|
7
|
-
export const CREATE_DOCUMENT_SCHEMA = {
|
|
8
|
-
threat_model_id: z.string().describe("UUID of the parent threat model"),
|
|
9
|
-
title: z.string().describe("Document title (e.g., 'System Architecture Narrative')"),
|
|
10
|
-
content: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe("Initial markdown content. Can include embedded diagrams via ```mermaid or ```zivis:diagram fenced blocks."),
|
|
14
|
-
tags: z.array(z.string()).optional().describe("Optional tags"),
|
|
15
|
-
};
|
|
16
|
-
function errorResult(message) {
|
|
17
|
-
return {
|
|
18
|
-
content: [{ type: "text", text: `Error: ${message}` }],
|
|
19
|
-
isError: true,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function successResult(data) {
|
|
23
|
-
return {
|
|
24
|
-
content: [{ type: "text", text: JSON.stringify(sanitizeResponse(data), null, 2) }],
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export function createCreateDocumentHandler(apiClient) {
|
|
28
|
-
return async (params) => {
|
|
29
|
-
try {
|
|
30
|
-
const { threat_model_id, title, content, tags } = params;
|
|
31
|
-
if (!threat_model_id)
|
|
32
|
-
return errorResult("threat_model_id is required");
|
|
33
|
-
if (!title || !title.trim())
|
|
34
|
-
return errorResult("title is required");
|
|
35
|
-
const data = await apiClient.post(`/api/documents`, {
|
|
36
|
-
threatModelId: threat_model_id,
|
|
37
|
-
title: sanitizeInboundText(title, 500),
|
|
38
|
-
content: sanitizeInboundText(content ?? "", 200_000),
|
|
39
|
-
tags: tags ?? [],
|
|
40
|
-
});
|
|
41
|
-
return successResult(data);
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
return errorResult(err?.message ?? "Failed to create document");
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { ApiClient } from "../api-client.js";
|
|
3
|
-
export declare const CREATE_FINDING_NAME = "zivis_create_finding";
|
|
4
|
-
export declare const CREATE_FINDING_DESCRIPTION = "Create a tracked security finding authored by hand (not from a scanner).\n\nUse when you've identified a vulnerability, misconfiguration, or weakness \u2014 for example one written into a README or surfaced while reviewing code \u2014 and the user wants it captured as a real finding. Provide a clear title and an honest severity. If the finding came from a specific document, pass source_document_id so it links back to that document.\n\nFor service-delivered results (an analyst-run pen test, red-team exercise, or ZRT run), pass source_type (pen_test | red_team | threat_model) so the finding flows to the Signal API, plus producer provenance describing who/what produced it. Non-manual source_type requires the run_agents org permission.";
|
|
5
|
-
export declare const CREATE_FINDING_SCHEMA: {
|
|
6
|
-
title: z.ZodString;
|
|
7
|
-
severity: z.ZodEnum<{
|
|
8
|
-
critical: "critical";
|
|
9
|
-
high: "high";
|
|
10
|
-
medium: "medium";
|
|
11
|
-
low: "low";
|
|
12
|
-
info: "info";
|
|
13
|
-
}>;
|
|
14
|
-
description: z.ZodOptional<z.ZodString>;
|
|
15
|
-
category: z.ZodOptional<z.ZodEnum<{
|
|
16
|
-
vulnerability: "vulnerability";
|
|
17
|
-
misconfiguration: "misconfiguration";
|
|
18
|
-
secret: "secret";
|
|
19
|
-
anomaly: "anomaly";
|
|
20
|
-
other: "other";
|
|
21
|
-
}>>;
|
|
22
|
-
confidence: z.ZodOptional<z.ZodEnum<{
|
|
23
|
-
high: "high";
|
|
24
|
-
medium: "medium";
|
|
25
|
-
low: "low";
|
|
26
|
-
}>>;
|
|
27
|
-
application_id: z.ZodOptional<z.ZodString>;
|
|
28
|
-
source_document_id: z.ZodOptional<z.ZodString>;
|
|
29
|
-
excerpt: z.ZodOptional<z.ZodString>;
|
|
30
|
-
evidence_location: z.ZodOptional<z.ZodString>;
|
|
31
|
-
cwe_id: z.ZodOptional<z.ZodString>;
|
|
32
|
-
owasp_id: z.ZodOptional<z.ZodString>;
|
|
33
|
-
remediation_steps: z.ZodOptional<z.ZodString>;
|
|
34
|
-
source_type: z.ZodOptional<z.ZodEnum<{
|
|
35
|
-
threat_model: "threat_model";
|
|
36
|
-
red_team: "red_team";
|
|
37
|
-
pen_test: "pen_test";
|
|
38
|
-
manual: "manual";
|
|
39
|
-
}>>;
|
|
40
|
-
producer: z.ZodOptional<z.ZodObject<{
|
|
41
|
-
kind: z.ZodEnum<{
|
|
42
|
-
human: "human";
|
|
43
|
-
zrt: "zrt";
|
|
44
|
-
frontier_tool: "frontier_tool";
|
|
45
|
-
third_party: "third_party";
|
|
46
|
-
}>;
|
|
47
|
-
id: z.ZodOptional<z.ZodString>;
|
|
48
|
-
name: z.ZodOptional<z.ZodString>;
|
|
49
|
-
toolVersion: z.ZodOptional<z.ZodString>;
|
|
50
|
-
engagementId: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, z.core.$strip>>;
|
|
52
|
-
scenario_id: z.ZodOptional<z.ZodString>;
|
|
53
|
-
attack_step_id: z.ZodOptional<z.ZodString>;
|
|
54
|
-
};
|
|
55
|
-
type CreateFindingParams = {
|
|
56
|
-
title: string;
|
|
57
|
-
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
58
|
-
description?: string;
|
|
59
|
-
category?: "vulnerability" | "misconfiguration" | "secret" | "anomaly" | "other";
|
|
60
|
-
confidence?: "high" | "medium" | "low";
|
|
61
|
-
application_id?: string;
|
|
62
|
-
source_document_id?: string;
|
|
63
|
-
excerpt?: string;
|
|
64
|
-
evidence_location?: string;
|
|
65
|
-
cwe_id?: string;
|
|
66
|
-
owasp_id?: string;
|
|
67
|
-
remediation_steps?: string;
|
|
68
|
-
source_type?: "manual" | "pen_test" | "red_team" | "threat_model";
|
|
69
|
-
producer?: {
|
|
70
|
-
kind: "human" | "zrt" | "frontier_tool" | "third_party";
|
|
71
|
-
id?: string;
|
|
72
|
-
name?: string;
|
|
73
|
-
toolVersion?: string;
|
|
74
|
-
engagementId?: string;
|
|
75
|
-
};
|
|
76
|
-
scenario_id?: string;
|
|
77
|
-
attack_step_id?: string;
|
|
78
|
-
};
|
|
79
|
-
export declare function createCreateFindingHandler(apiClient: ApiClient): (params: CreateFindingParams) => Promise<{
|
|
80
|
-
content: {
|
|
81
|
-
type: "text";
|
|
82
|
-
text: string;
|
|
83
|
-
}[];
|
|
84
|
-
}>;
|
|
85
|
-
export {};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { sanitizeResponse, sanitizeInboundText } from "../sanitize.js";
|
|
3
|
-
import { requireApplicationId } from "../resolve-application-id.js";
|
|
4
|
-
export const CREATE_FINDING_NAME = "zivis_create_finding";
|
|
5
|
-
export const CREATE_FINDING_DESCRIPTION = `Create a tracked security finding authored by hand (not from a scanner).
|
|
6
|
-
|
|
7
|
-
Use when you've identified a vulnerability, misconfiguration, or weakness — for example one written into a README or surfaced while reviewing code — and the user wants it captured as a real finding. Provide a clear title and an honest severity. If the finding came from a specific document, pass source_document_id so it links back to that document.
|
|
8
|
-
|
|
9
|
-
For service-delivered results (an analyst-run pen test, red-team exercise, or ZRT run), pass source_type (pen_test | red_team | threat_model) so the finding flows to the Signal API, plus producer provenance describing who/what produced it. Non-manual source_type requires the run_agents org permission.`;
|
|
10
|
-
export const CREATE_FINDING_SCHEMA = {
|
|
11
|
-
title: z.string().describe("Short summary of the finding"),
|
|
12
|
-
severity: z
|
|
13
|
-
.enum(["critical", "high", "medium", "low", "info"])
|
|
14
|
-
.describe("Severity — be honest; reserve critical/high for genuinely exploitable issues"),
|
|
15
|
-
description: z
|
|
16
|
-
.string()
|
|
17
|
-
.optional()
|
|
18
|
-
.describe("Details: what the weakness is, why it matters, and any evidence/excerpt"),
|
|
19
|
-
category: z
|
|
20
|
-
.enum(["vulnerability", "misconfiguration", "secret", "anomaly", "other"])
|
|
21
|
-
.optional()
|
|
22
|
-
.describe("Finding category (default: vulnerability)"),
|
|
23
|
-
confidence: z
|
|
24
|
-
.enum(["high", "medium", "low"])
|
|
25
|
-
.optional()
|
|
26
|
-
.describe("How confident you are this is real (default: medium)"),
|
|
27
|
-
application_id: z
|
|
28
|
-
.string()
|
|
29
|
-
.optional()
|
|
30
|
-
.describe("Application UUID. Defaults to applicationId in .zivis/project.json if omitted."),
|
|
31
|
-
source_document_id: z
|
|
32
|
-
.string()
|
|
33
|
-
.optional()
|
|
34
|
-
.describe("UUID of a ZIVIS Document this finding came from. Links the finding back to it."),
|
|
35
|
-
excerpt: z
|
|
36
|
-
.string()
|
|
37
|
-
.optional()
|
|
38
|
-
.describe("The exact source text the finding was drawn from (e.g. the README snippet)."),
|
|
39
|
-
evidence_location: z
|
|
40
|
-
.string()
|
|
41
|
-
.optional()
|
|
42
|
-
.describe("Human-readable locator, e.g. 'README.md:L40-L51' or a file path."),
|
|
43
|
-
cwe_id: z.string().optional().describe("Optional CWE id, e.g. 'CWE-89'"),
|
|
44
|
-
owasp_id: z.string().optional().describe("Optional OWASP id, e.g. 'A01'"),
|
|
45
|
-
remediation_steps: z.string().optional().describe("Optional remediation guidance"),
|
|
46
|
-
source_type: z
|
|
47
|
-
.enum(["manual", "pen_test", "red_team", "threat_model"])
|
|
48
|
-
.optional()
|
|
49
|
-
.describe("Source family (default: manual). Non-manual values mark the finding as a service-delivered result that flows to the Signal API; requires the run_agents org permission."),
|
|
50
|
-
producer: z
|
|
51
|
-
.object({
|
|
52
|
-
kind: z
|
|
53
|
-
.enum(["human", "zrt", "frontier_tool", "third_party"])
|
|
54
|
-
.describe("Who/what produced the finding"),
|
|
55
|
-
id: z.string().optional().describe("Stable producer identifier (e.g. analyst email)"),
|
|
56
|
-
name: z.string().optional().describe("Display name (e.g. 'Jake Miller', 'ZRT')"),
|
|
57
|
-
toolVersion: z.string().optional().describe("Tool version, if applicable"),
|
|
58
|
-
engagementId: z.string().optional().describe("Engagement/campaign this run belongs to"),
|
|
59
|
-
})
|
|
60
|
-
.optional()
|
|
61
|
-
.describe("Producer provenance, stored on the finding as metadata.producer"),
|
|
62
|
-
scenario_id: z
|
|
63
|
-
.string()
|
|
64
|
-
.optional()
|
|
65
|
-
.describe("GraphNode logicalId (UUID) of the ATTACK_SCENARIO this finding proves out"),
|
|
66
|
-
attack_step_id: z
|
|
67
|
-
.string()
|
|
68
|
-
.optional()
|
|
69
|
-
.describe("GraphNode logicalId (UUID) of the ATTACK_STEP this finding corresponds to"),
|
|
70
|
-
};
|
|
71
|
-
function errorResult(message) {
|
|
72
|
-
return {
|
|
73
|
-
content: [{ type: "text", text: `Error: ${message}` }],
|
|
74
|
-
isError: true,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function successResult(data) {
|
|
78
|
-
return {
|
|
79
|
-
content: [{ type: "text", text: JSON.stringify(sanitizeResponse(data), null, 2) }],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
export function createCreateFindingHandler(apiClient) {
|
|
83
|
-
return async (params) => {
|
|
84
|
-
try {
|
|
85
|
-
if (!params.title || !params.title.trim())
|
|
86
|
-
return errorResult("title is required");
|
|
87
|
-
if (!params.severity)
|
|
88
|
-
return errorResult("severity is required");
|
|
89
|
-
let applicationId;
|
|
90
|
-
if (!params.source_document_id) {
|
|
91
|
-
const resolved = requireApplicationId(params.application_id);
|
|
92
|
-
if (!resolved.ok)
|
|
93
|
-
return errorResult(resolved.message);
|
|
94
|
-
applicationId = resolved.id;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
applicationId = resolveApplicationIdSafe(params.application_id);
|
|
98
|
-
}
|
|
99
|
-
const data = await apiClient.post(`/api/findings/unified`, {
|
|
100
|
-
title: sanitizeInboundText(params.title, 500),
|
|
101
|
-
severity: params.severity,
|
|
102
|
-
description: sanitizeInboundText(params.description, 8000),
|
|
103
|
-
category: params.category,
|
|
104
|
-
confidence: params.confidence,
|
|
105
|
-
origin: "mcp",
|
|
106
|
-
applicationId,
|
|
107
|
-
sourceDocumentId: params.source_document_id,
|
|
108
|
-
excerpt: sanitizeInboundText(params.excerpt, 8000),
|
|
109
|
-
evidenceLocation: sanitizeInboundText(params.evidence_location, 500),
|
|
110
|
-
cweId: params.cwe_id,
|
|
111
|
-
owaspId: params.owasp_id,
|
|
112
|
-
remediationSteps: sanitizeInboundText(params.remediation_steps, 4000),
|
|
113
|
-
sourceType: params.source_type,
|
|
114
|
-
producer: params.producer
|
|
115
|
-
? {
|
|
116
|
-
kind: params.producer.kind,
|
|
117
|
-
id: sanitizeInboundText(params.producer.id, 300),
|
|
118
|
-
name: sanitizeInboundText(params.producer.name, 300),
|
|
119
|
-
toolVersion: sanitizeInboundText(params.producer.toolVersion, 300),
|
|
120
|
-
engagementId: sanitizeInboundText(params.producer.engagementId, 300),
|
|
121
|
-
}
|
|
122
|
-
: undefined,
|
|
123
|
-
scenarioId: params.scenario_id,
|
|
124
|
-
attackStepId: params.attack_step_id,
|
|
125
|
-
});
|
|
126
|
-
return successResult(data);
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
return errorResult(err?.message ?? "Failed to create finding");
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function resolveApplicationIdSafe(explicit) {
|
|
134
|
-
const r = requireApplicationId(explicit);
|
|
135
|
-
return r.ok ? r.id : undefined;
|
|
136
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { ApiClient } from "../api-client.js";
|
|
3
|
-
export declare const DELETE_FINDING_NAME = "zivis_delete_finding";
|
|
4
|
-
export declare const DELETE_FINDING_DESCRIPTION = "Delete a manually-created security finding (soft-delete \u2014 it's retained for audit and removed from the default views).\n\nUse when a hand-authored finding (from zivis_create_finding or a document highlight) is no longer wanted \u2014 e.g. a mistake or a duplicate. Only manual findings can be deleted; scanner findings should be dismissed or suppressed via zivis_update_finding instead. Pass the finding's id and, ideally, a short reason for the audit trail.";
|
|
5
|
-
export declare const DELETE_FINDING_SCHEMA: {
|
|
6
|
-
finding_id: z.ZodString;
|
|
7
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
8
|
-
};
|
|
9
|
-
type DeleteFindingParams = {
|
|
10
|
-
finding_id: string;
|
|
11
|
-
reason?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function createDeleteFindingHandler(apiClient: ApiClient): (params: DeleteFindingParams) => Promise<{
|
|
14
|
-
content: {
|
|
15
|
-
type: "text";
|
|
16
|
-
text: string;
|
|
17
|
-
}[];
|
|
18
|
-
}>;
|
|
19
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { sanitizeResponse } from "../sanitize.js";
|
|
3
|
-
export const DELETE_FINDING_NAME = "zivis_delete_finding";
|
|
4
|
-
export const DELETE_FINDING_DESCRIPTION = `Delete a manually-created security finding (soft-delete — it's retained for audit and removed from the default views).
|
|
5
|
-
|
|
6
|
-
Use when a hand-authored finding (from zivis_create_finding or a document highlight) is no longer wanted — e.g. a mistake or a duplicate. Only manual findings can be deleted; scanner findings should be dismissed or suppressed via zivis_update_finding instead. Pass the finding's id and, ideally, a short reason for the audit trail.`;
|
|
7
|
-
export const DELETE_FINDING_SCHEMA = {
|
|
8
|
-
finding_id: z.string().describe("UUID of the manual finding to delete"),
|
|
9
|
-
reason: z.string().optional().describe("Short reason for deleting (recorded in audit history)"),
|
|
10
|
-
};
|
|
11
|
-
function errorResult(message) {
|
|
12
|
-
return {
|
|
13
|
-
content: [{ type: "text", text: `Error: ${message}` }],
|
|
14
|
-
isError: true,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function successResult(data) {
|
|
18
|
-
return {
|
|
19
|
-
content: [{ type: "text", text: JSON.stringify(sanitizeResponse(data), null, 2) }],
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export function createDeleteFindingHandler(apiClient) {
|
|
23
|
-
return async (params) => {
|
|
24
|
-
try {
|
|
25
|
-
if (!params.finding_id || !params.finding_id.trim()) {
|
|
26
|
-
return errorResult("finding_id is required");
|
|
27
|
-
}
|
|
28
|
-
const query = params.reason ? `?reason=${encodeURIComponent(params.reason)}` : "";
|
|
29
|
-
const data = await apiClient.del(`/api/findings/unified/${encodeURIComponent(params.finding_id)}${query}`);
|
|
30
|
-
return successResult(data);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
return errorResult(err?.message ?? "Failed to delete finding");
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const DISCOVER_LOCAL_INFRA_NAME = "zivis_discover_local_infra";
|
|
3
|
-
export declare const DISCOVER_LOCAL_INFRA_DESCRIPTION = "Discover AI infrastructure in a local project directory by reading Docker, compose, and dependency files.\n\nAnalyzes the project to understand what services are defined, which are running, and what AI/LLM frameworks are in use. Returns a suggested target shape (URL, chat endpoint) for the coding agent to use as grounding context before running `zivis test ai`.\n\nWhat it reads:\n- docker-compose.yml / docker-compose.yaml / compose.yml / compose.yaml\n- Dockerfile(s) in the project root and subdirectories\n- .env files (structure only \u2014 values are redacted for safety)\n- package.json, requirements.txt, pyproject.toml, go.mod (to detect AI frameworks)\n\nWhat it checks:\n- Docker daemon status\n- Currently running containers (docker compose ps)\n- Port mappings and exposed services\n\nWhat it returns:\n- List of services with ports and images\n- Running vs stopped status per service\n- Detected AI/LLM patterns (OpenAI, Anthropic, LangChain, etc.)\n- Suggested target_url/target_type/chat_endpoint \u2014 informational context, not a tool call to make\n- Whether the zivis-local-runner Docker image is available\n\nFor actually testing the discovered AI system, run `zivis test ai` in the terminal \u2014 this tool only maps what's running locally.\n\nThis tool makes NO network requests and requires NO authentication. It only reads local files and queries the Docker daemon.";
|
|
4
|
-
export declare const DISCOVER_LOCAL_INFRA_SCHEMA: {
|
|
5
|
-
project_dir: z.ZodOptional<z.ZodString>;
|
|
6
|
-
};
|
|
7
|
-
export declare function createDiscoverLocalInfraHandler(): (params: {
|
|
8
|
-
project_dir?: string;
|
|
9
|
-
}) => Promise<{
|
|
10
|
-
content: {
|
|
11
|
-
type: "text";
|
|
12
|
-
text: string;
|
|
13
|
-
}[];
|
|
14
|
-
}>;
|