@zivis/mcp 0.1.8 → 0.1.11

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.
Files changed (346) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +19 -0
  3. package/dist/api-client.d.ts +2 -24
  4. package/dist/api-client.js +32 -52
  5. package/dist/auth/index.d.ts +1 -22
  6. package/dist/auth/index.js +17 -38
  7. package/dist/auth/jwt.d.ts +0 -16
  8. package/dist/auth/jwt.js +0 -13
  9. package/dist/auth/keychain.d.ts +6 -32
  10. package/dist/auth/keychain.js +83 -114
  11. package/dist/auth/oauth.d.ts +3 -32
  12. package/dist/auth/oauth.js +67 -61
  13. package/dist/auth/sessions.d.ts +5 -25
  14. package/dist/auth/sessions.js +20 -39
  15. package/dist/auth/token-refresh.d.ts +2 -22
  16. package/dist/auth/token-refresh.js +33 -36
  17. package/dist/cli.d.ts +1 -18
  18. package/dist/cli.js +30 -908
  19. package/dist/http-probe/capture.d.ts +51 -0
  20. package/dist/http-probe/capture.js +96 -0
  21. package/dist/http-probe/compare.d.ts +43 -0
  22. package/dist/http-probe/compare.js +117 -0
  23. package/dist/http-probe/index.d.ts +2 -0
  24. package/dist/http-probe/index.js +2 -0
  25. package/dist/index.d.ts +0 -6
  26. package/dist/index.js +0 -7
  27. package/dist/lib/inspect-cache.d.ts +10 -0
  28. package/dist/lib/inspect-cache.js +75 -0
  29. package/dist/lib/next-steps.d.ts +27 -0
  30. package/dist/lib/next-steps.js +21 -0
  31. package/dist/matcher/ast-eval.d.ts +8 -0
  32. package/dist/matcher/ast-eval.js +95 -0
  33. package/dist/matcher/finding.d.ts +55 -0
  34. package/dist/matcher/finding.js +1 -0
  35. package/dist/matcher/index.d.ts +8 -0
  36. package/dist/matcher/index.js +202 -0
  37. package/dist/matcher/inference-candidates.d.ts +26 -0
  38. package/dist/matcher/inference-candidates.js +81 -0
  39. package/dist/matcher/walker.d.ts +7 -0
  40. package/dist/matcher/walker.js +71 -0
  41. package/dist/pattern-pack/index.d.ts +125 -0
  42. package/dist/pattern-pack/index.js +189 -0
  43. package/dist/pattern-packs/zivis-public-0.2.0/capsules/agents/privilege-separation.yaml +224 -0
  44. package/dist/pattern-packs/zivis-public-0.2.0/capsules/prompting/self-consistency-no-isolation.yaml +237 -0
  45. package/dist/pattern-packs/zivis-public-0.2.0/capsules/retrieval/context-injection-no-validator.yaml +348 -0
  46. package/dist/pattern-packs/zivis-public-0.2.0/capsules/security/late-org-filter.yaml +266 -0
  47. package/dist/pattern-packs/zivis-public-0.2.0/controls/external_validator_on_facts.yaml +37 -0
  48. package/dist/pattern-packs/zivis-public-0.2.0/controls/fact_validator_present.yaml +68 -0
  49. package/dist/pattern-packs/zivis-public-0.2.0/controls/human_approval_gate.yaml +44 -0
  50. package/dist/pattern-packs/zivis-public-0.2.0/controls/langgraph_state_machine_with_per_node_tools.yaml +35 -0
  51. package/dist/pattern-packs/zivis-public-0.2.0/controls/per_sample_retrieval_diversification.yaml +38 -0
  52. package/dist/pattern-packs/zivis-public-0.2.0/controls/prisma_extension_or_middleware_attaching_org_filter.yaml +31 -0
  53. package/dist/pattern-packs/zivis-public-0.2.0/controls/row_level_security_policy.yaml +37 -0
  54. package/dist/pattern-packs/zivis-public-0.2.0/controls/source_attribution_present.yaml +58 -0
  55. package/dist/pattern-packs/zivis-public-0.2.0/manifest.json +167 -0
  56. package/dist/pattern-packs/zivis-public-0.2.0/prompts/agents/privilege-separation/identify.md +54 -0
  57. package/dist/pattern-packs/zivis-public-0.2.0/prompts/prompting/self-consistency-no-isolation/identify.md +60 -0
  58. package/dist/pattern-packs/zivis-public-0.2.0/prompts/retrieval/context-injection-no-validator/identify.md +109 -0
  59. package/dist/pattern-packs/zivis-public-0.2.0/prompts/security/late-org-filter/identify.md +78 -0
  60. package/dist/project-binding.d.ts +2 -19
  61. package/dist/project-binding.js +38 -21
  62. package/dist/prompts/audit-dependencies.d.ts +2 -0
  63. package/dist/prompts/audit-dependencies.js +47 -0
  64. package/dist/prompts/getting-started.d.ts +2 -0
  65. package/dist/prompts/getting-started.js +37 -0
  66. package/dist/prompts/index.d.ts +2 -0
  67. package/dist/prompts/index.js +6 -0
  68. package/dist/redact.d.ts +30 -0
  69. package/dist/redact.js +164 -0
  70. package/dist/resolve-application-id.d.ts +0 -4
  71. package/dist/resolve-application-id.js +0 -5
  72. package/dist/sanitize.d.ts +1 -21
  73. package/dist/sanitize.js +7 -41
  74. package/dist/scanners/index.d.ts +3 -0
  75. package/dist/scanners/index.js +2 -0
  76. package/dist/scanners/normalize.d.ts +6 -0
  77. package/dist/scanners/normalize.js +181 -0
  78. package/dist/scanners/run.d.ts +27 -0
  79. package/dist/scanners/run.js +142 -0
  80. package/dist/scanners/types.d.ts +40 -0
  81. package/dist/scanners/types.js +1 -0
  82. package/dist/server.d.ts +1 -13
  83. package/dist/server.js +142 -265
  84. package/dist/tools/artifacts.d.ts +76 -0
  85. package/dist/tools/artifacts.js +178 -0
  86. package/dist/tools/check-project.d.ts +5 -18
  87. package/dist/tools/check-project.js +122 -110
  88. package/dist/tools/check-repo-trust.d.ts +4 -19
  89. package/dist/tools/check-repo-trust.js +56 -47
  90. package/dist/tools/create-diagram.d.ts +0 -5
  91. package/dist/tools/create-diagram.js +0 -10
  92. package/dist/tools/create-document.d.ts +0 -5
  93. package/dist/tools/create-document.js +3 -9
  94. package/dist/tools/create-finding.d.ts +85 -0
  95. package/dist/tools/create-finding.js +136 -0
  96. package/dist/tools/delete-finding.d.ts +19 -0
  97. package/dist/tools/delete-finding.js +36 -0
  98. package/dist/tools/devx-run.d.ts +88 -0
  99. package/dist/tools/devx-run.js +175 -0
  100. package/dist/tools/discover-local-infra.d.ts +0 -10
  101. package/dist/tools/discover-local-infra.js +3 -73
  102. package/dist/tools/enterprise/get-org-zat.d.ts +0 -5
  103. package/dist/tools/enterprise/get-org-zat.js +0 -6
  104. package/dist/tools/explain-signal-for-diff.d.ts +34 -0
  105. package/dist/tools/explain-signal-for-diff.js +75 -0
  106. package/dist/tools/generate-diagram.d.ts +0 -6
  107. package/dist/tools/generate-diagram.js +21 -13
  108. package/dist/tools/get-application-overview.d.ts +0 -5
  109. package/dist/tools/get-application-overview.js +0 -6
  110. package/dist/tools/get-application.d.ts +0 -5
  111. package/dist/tools/get-application.js +0 -6
  112. package/dist/tools/get-diagram.d.ts +0 -5
  113. package/dist/tools/get-diagram.js +1 -11
  114. package/dist/tools/get-document.d.ts +0 -5
  115. package/dist/tools/get-document.js +0 -6
  116. package/dist/tools/get-oss-zat.d.ts +0 -5
  117. package/dist/tools/get-oss-zat.js +0 -7
  118. package/dist/tools/get-signal.d.ts +24 -0
  119. package/dist/tools/get-signal.js +75 -0
  120. package/dist/tools/get-started.d.ts +18 -0
  121. package/dist/tools/get-started.js +470 -0
  122. package/dist/tools/get-trust-keys.d.ts +0 -5
  123. package/dist/tools/get-trust-keys.js +0 -6
  124. package/dist/tools/import-openapi-endpoints.d.ts +0 -5
  125. package/dist/tools/import-openapi-endpoints.js +0 -6
  126. package/dist/tools/inspect-zat.d.ts +0 -5
  127. package/dist/tools/inspect-zat.js +0 -19
  128. package/dist/tools/inspect.d.ts +21 -0
  129. package/dist/tools/inspect.js +222 -0
  130. package/dist/tools/list-applications.d.ts +1 -6
  131. package/dist/tools/list-applications.js +0 -6
  132. package/dist/tools/list-diagrams.d.ts +0 -5
  133. package/dist/tools/list-diagrams.js +0 -6
  134. package/dist/tools/list-documents.d.ts +0 -5
  135. package/dist/tools/list-documents.js +0 -6
  136. package/dist/tools/list-endpoints.d.ts +1 -6
  137. package/dist/tools/list-endpoints.js +0 -6
  138. package/dist/tools/list-signals.d.ts +37 -0
  139. package/dist/tools/list-signals.js +83 -0
  140. package/dist/tools/manage-application.d.ts +64 -0
  141. package/dist/tools/manage-application.js +129 -0
  142. package/dist/tools/manage-diagram.d.ts +0 -5
  143. package/dist/tools/manage-diagram.js +0 -16
  144. package/dist/tools/manage-endpoint-lifecycle.d.ts +80 -0
  145. package/dist/tools/manage-endpoint-lifecycle.js +180 -0
  146. package/dist/tools/open-in-ide.d.ts +2 -14
  147. package/dist/tools/open-in-ide.js +0 -13
  148. package/dist/tools/review-change.d.ts +34 -0
  149. package/dist/tools/review-change.js +93 -0
  150. package/dist/tools/security-memory.d.ts +76 -0
  151. package/dist/tools/security-memory.js +202 -0
  152. package/dist/tools/security-review.d.ts +1 -21
  153. package/dist/tools/security-review.js +8 -108
  154. package/dist/tools/threat-get-capsule.d.ts +15 -0
  155. package/dist/tools/threat-get-capsule.js +53 -0
  156. package/dist/tools/threat-get-inference-prompt.d.ts +15 -0
  157. package/dist/tools/threat-get-inference-prompt.js +73 -0
  158. package/dist/tools/threat-list-relevant-capsules.d.ts +17 -0
  159. package/dist/tools/threat-list-relevant-capsules.js +158 -0
  160. package/dist/tools/threat-run-matcher.d.ts +17 -0
  161. package/dist/tools/threat-run-matcher.js +145 -0
  162. package/dist/tools/update-document.d.ts +0 -5
  163. package/dist/tools/update-document.js +3 -9
  164. package/dist/tools/update-endpoint.d.ts +1 -6
  165. package/dist/tools/update-endpoint.js +0 -7
  166. package/dist/tools/update-finding.d.ts +61 -0
  167. package/dist/tools/update-finding.js +80 -0
  168. package/dist/tools/update-mermaid-source.d.ts +0 -13
  169. package/dist/tools/update-mermaid-source.js +0 -14
  170. package/dist/tools/verify-trust-mark.d.ts +0 -5
  171. package/dist/tools/verify-trust-mark.js +0 -6
  172. package/dist/types.d.ts +14 -14
  173. package/dist/types.js +22 -28
  174. package/package.json +41 -15
  175. package/dist/api-client.js.map +0 -1
  176. package/dist/auth/index.js.map +0 -1
  177. package/dist/auth/jwt.js.map +0 -1
  178. package/dist/auth/keychain.js.map +0 -1
  179. package/dist/auth/oauth.js.map +0 -1
  180. package/dist/auth/sessions.js.map +0 -1
  181. package/dist/auth/token-refresh.js.map +0 -1
  182. package/dist/cli.js.map +0 -1
  183. package/dist/index.js.map +0 -1
  184. package/dist/project-binding.js.map +0 -1
  185. package/dist/resolve-application-id.js.map +0 -1
  186. package/dist/sanitize.js.map +0 -1
  187. package/dist/server.js.map +0 -1
  188. package/dist/tools/check-project.js.map +0 -1
  189. package/dist/tools/check-repo-trust.js.map +0 -1
  190. package/dist/tools/create-diagram.js.map +0 -1
  191. package/dist/tools/create-document.js.map +0 -1
  192. package/dist/tools/discover-local-infra.js.map +0 -1
  193. package/dist/tools/enterprise/capture-evidence.d.ts +0 -54
  194. package/dist/tools/enterprise/capture-evidence.js +0 -72
  195. package/dist/tools/enterprise/capture-evidence.js.map +0 -1
  196. package/dist/tools/enterprise/create-report-ticket.d.ts +0 -34
  197. package/dist/tools/enterprise/create-report-ticket.js +0 -44
  198. package/dist/tools/enterprise/create-report-ticket.js.map +0 -1
  199. package/dist/tools/enterprise/end-pentest-session.d.ts +0 -33
  200. package/dist/tools/enterprise/end-pentest-session.js +0 -42
  201. package/dist/tools/enterprise/end-pentest-session.js.map +0 -1
  202. package/dist/tools/enterprise/generate-report.d.ts +0 -55
  203. package/dist/tools/enterprise/generate-report.js +0 -111
  204. package/dist/tools/enterprise/generate-report.js.map +0 -1
  205. package/dist/tools/enterprise/get-org-zat.js.map +0 -1
  206. package/dist/tools/enterprise/get-report-status.d.ts +0 -27
  207. package/dist/tools/enterprise/get-report-status.js +0 -38
  208. package/dist/tools/enterprise/get-report-status.js.map +0 -1
  209. package/dist/tools/enterprise/get-threat-model.d.ts +0 -29
  210. package/dist/tools/enterprise/get-threat-model.js +0 -83
  211. package/dist/tools/enterprise/get-threat-model.js.map +0 -1
  212. package/dist/tools/enterprise/list-agents.d.ts +0 -42
  213. package/dist/tools/enterprise/list-agents.js +0 -95
  214. package/dist/tools/enterprise/list-agents.js.map +0 -1
  215. package/dist/tools/enterprise/list-report-issues.d.ts +0 -36
  216. package/dist/tools/enterprise/list-report-issues.js +0 -50
  217. package/dist/tools/enterprise/list-report-issues.js.map +0 -1
  218. package/dist/tools/enterprise/list-threat-models.d.ts +0 -36
  219. package/dist/tools/enterprise/list-threat-models.js +0 -82
  220. package/dist/tools/enterprise/list-threat-models.js.map +0 -1
  221. package/dist/tools/enterprise/manage-actor.d.ts +0 -58
  222. package/dist/tools/enterprise/manage-actor.js +0 -99
  223. package/dist/tools/enterprise/manage-actor.js.map +0 -1
  224. package/dist/tools/enterprise/manage-attack-scenario.d.ts +0 -70
  225. package/dist/tools/enterprise/manage-attack-scenario.js +0 -89
  226. package/dist/tools/enterprise/manage-attack-scenario.js.map +0 -1
  227. package/dist/tools/enterprise/manage-component.d.ts +0 -58
  228. package/dist/tools/enterprise/manage-component.js +0 -90
  229. package/dist/tools/enterprise/manage-component.js.map +0 -1
  230. package/dist/tools/enterprise/manage-data-asset.d.ts +0 -53
  231. package/dist/tools/enterprise/manage-data-asset.js +0 -90
  232. package/dist/tools/enterprise/manage-data-asset.js.map +0 -1
  233. package/dist/tools/enterprise/manage-data-flow.d.ts +0 -57
  234. package/dist/tools/enterprise/manage-data-flow.js +0 -98
  235. package/dist/tools/enterprise/manage-data-flow.js.map +0 -1
  236. package/dist/tools/enterprise/manage-finding.d.ts +0 -69
  237. package/dist/tools/enterprise/manage-finding.js +0 -106
  238. package/dist/tools/enterprise/manage-finding.js.map +0 -1
  239. package/dist/tools/enterprise/manage-security-control.d.ts +0 -59
  240. package/dist/tools/enterprise/manage-security-control.js +0 -96
  241. package/dist/tools/enterprise/manage-security-control.js.map +0 -1
  242. package/dist/tools/enterprise/manage-test-case.d.ts +0 -88
  243. package/dist/tools/enterprise/manage-test-case.js +0 -119
  244. package/dist/tools/enterprise/manage-test-case.js.map +0 -1
  245. package/dist/tools/enterprise/promote-finding-to-issue.d.ts +0 -36
  246. package/dist/tools/enterprise/promote-finding-to-issue.js +0 -65
  247. package/dist/tools/enterprise/promote-finding-to-issue.js.map +0 -1
  248. package/dist/tools/enterprise/publish-report-version.d.ts +0 -34
  249. package/dist/tools/enterprise/publish-report-version.js +0 -75
  250. package/dist/tools/enterprise/publish-report-version.js.map +0 -1
  251. package/dist/tools/enterprise/publish-test-to-library.d.ts +0 -31
  252. package/dist/tools/enterprise/publish-test-to-library.js +0 -40
  253. package/dist/tools/enterprise/publish-test-to-library.js.map +0 -1
  254. package/dist/tools/enterprise/record-test-result.d.ts +0 -67
  255. package/dist/tools/enterprise/record-test-result.js +0 -75
  256. package/dist/tools/enterprise/record-test-result.js.map +0 -1
  257. package/dist/tools/enterprise/start-pentest-session.d.ts +0 -35
  258. package/dist/tools/enterprise/start-pentest-session.js +0 -50
  259. package/dist/tools/enterprise/start-pentest-session.js.map +0 -1
  260. package/dist/tools/enterprise/sync-report-section.d.ts +0 -41
  261. package/dist/tools/enterprise/sync-report-section.js +0 -79
  262. package/dist/tools/enterprise/sync-report-section.js.map +0 -1
  263. package/dist/tools/enterprise/update-report-issue.d.ts +0 -55
  264. package/dist/tools/enterprise/update-report-issue.js +0 -69
  265. package/dist/tools/enterprise/update-report-issue.js.map +0 -1
  266. package/dist/tools/generate-diagram.js.map +0 -1
  267. package/dist/tools/get-agent-test-results.d.ts +0 -41
  268. package/dist/tools/get-agent-test-results.js +0 -86
  269. package/dist/tools/get-agent-test-results.js.map +0 -1
  270. package/dist/tools/get-application-overview.js.map +0 -1
  271. package/dist/tools/get-application.js.map +0 -1
  272. package/dist/tools/get-artifact-content.d.ts +0 -29
  273. package/dist/tools/get-artifact-content.js +0 -86
  274. package/dist/tools/get-artifact-content.js.map +0 -1
  275. package/dist/tools/get-diagram.js.map +0 -1
  276. package/dist/tools/get-document.js.map +0 -1
  277. package/dist/tools/get-finding-details.d.ts +0 -28
  278. package/dist/tools/get-finding-details.js +0 -43
  279. package/dist/tools/get-finding-details.js.map +0 -1
  280. package/dist/tools/get-findings.d.ts +0 -57
  281. package/dist/tools/get-findings.js +0 -103
  282. package/dist/tools/get-findings.js.map +0 -1
  283. package/dist/tools/get-oss-zat.js.map +0 -1
  284. package/dist/tools/get-recon-scan.d.ts +0 -27
  285. package/dist/tools/get-recon-scan.js +0 -46
  286. package/dist/tools/get-recon-scan.js.map +0 -1
  287. package/dist/tools/get-scan-output.d.ts +0 -27
  288. package/dist/tools/get-scan-output.js +0 -64
  289. package/dist/tools/get-scan-output.js.map +0 -1
  290. package/dist/tools/get-scenario-details.d.ts +0 -27
  291. package/dist/tools/get-scenario-details.js +0 -46
  292. package/dist/tools/get-scenario-details.js.map +0 -1
  293. package/dist/tools/get-test-case-results.d.ts +0 -37
  294. package/dist/tools/get-test-case-results.js +0 -66
  295. package/dist/tools/get-test-case-results.js.map +0 -1
  296. package/dist/tools/get-test-details.d.ts +0 -29
  297. package/dist/tools/get-test-details.js +0 -49
  298. package/dist/tools/get-test-details.js.map +0 -1
  299. package/dist/tools/get-trust-keys.js.map +0 -1
  300. package/dist/tools/import-openapi-endpoints.js.map +0 -1
  301. package/dist/tools/inspect-zat.js.map +0 -1
  302. package/dist/tools/list-agent-test-cases.d.ts +0 -41
  303. package/dist/tools/list-agent-test-cases.js +0 -73
  304. package/dist/tools/list-agent-test-cases.js.map +0 -1
  305. package/dist/tools/list-applications.js.map +0 -1
  306. package/dist/tools/list-diagrams.js.map +0 -1
  307. package/dist/tools/list-documents.js.map +0 -1
  308. package/dist/tools/list-endpoints.js.map +0 -1
  309. package/dist/tools/list-recon-scans.d.ts +0 -36
  310. package/dist/tools/list-recon-scans.js +0 -74
  311. package/dist/tools/list-recon-scans.js.map +0 -1
  312. package/dist/tools/list-scan-artifacts.d.ts +0 -41
  313. package/dist/tools/list-scan-artifacts.js +0 -63
  314. package/dist/tools/list-scan-artifacts.js.map +0 -1
  315. package/dist/tools/list-scans.d.ts +0 -44
  316. package/dist/tools/list-scans.js +0 -91
  317. package/dist/tools/list-scans.js.map +0 -1
  318. package/dist/tools/list-test-library.d.ts +0 -44
  319. package/dist/tools/list-test-library.js +0 -83
  320. package/dist/tools/list-test-library.js.map +0 -1
  321. package/dist/tools/list-test-scenarios.d.ts +0 -31
  322. package/dist/tools/list-test-scenarios.js +0 -66
  323. package/dist/tools/list-test-scenarios.js.map +0 -1
  324. package/dist/tools/local-scan.d.ts +0 -40
  325. package/dist/tools/local-scan.js +0 -261
  326. package/dist/tools/local-scan.js.map +0 -1
  327. package/dist/tools/manage-diagram.js.map +0 -1
  328. package/dist/tools/open-in-ide.js.map +0 -1
  329. package/dist/tools/run-test-scenario.d.ts +0 -37
  330. package/dist/tools/run-test-scenario.js +0 -70
  331. package/dist/tools/run-test-scenario.js.map +0 -1
  332. package/dist/tools/scan-pr.d.ts +0 -27
  333. package/dist/tools/scan-pr.js +0 -51
  334. package/dist/tools/scan-pr.js.map +0 -1
  335. package/dist/tools/security-review.js.map +0 -1
  336. package/dist/tools/setup-red-team-target.d.ts +0 -79
  337. package/dist/tools/setup-red-team-target.js +0 -430
  338. package/dist/tools/setup-red-team-target.js.map +0 -1
  339. package/dist/tools/triage-finding.d.ts +0 -47
  340. package/dist/tools/triage-finding.js +0 -116
  341. package/dist/tools/triage-finding.js.map +0 -1
  342. package/dist/tools/update-document.js.map +0 -1
  343. package/dist/tools/update-endpoint.js.map +0 -1
  344. package/dist/tools/update-mermaid-source.js.map +0 -1
  345. package/dist/tools/verify-trust-mark.js.map +0 -1
  346. package/dist/types.js.map +0 -1
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ import { requireApplicationId } from "../resolve-application-id.js";
3
+ import { sanitizeResponse } from "../sanitize.js";
4
+ export const EXPLAIN_SIGNAL_FOR_DIFF_NAME = "zivis_explain_signal_for_my_diff";
5
+ export const EXPLAIN_SIGNAL_FOR_DIFF_DESCRIPTION = `Check whether your proposed change would affect a specific SIGNAL.
6
+
7
+ You have a SIGNAL flagged in your application's threat model. You're about to make a code change that may or may not address it. Use this tool to see whether your diff touches the files that triggered the signal — and a heuristic verdict on impact.
8
+
9
+ Returns:
10
+ - all_evidence_files — every file the signal cites
11
+ - evidence_files_in_diff — the subset that your proposed change touches
12
+ - verdict: "may_resolve" | "may_persist" | "no_impact"
13
+
14
+ The verdict is a heuristic (file overlap), not a guarantee. Run zivis_review_change for the broader picture, or push and let the canonical extraction confirm.`;
15
+ export const EXPLAIN_SIGNAL_FOR_DIFF_SCHEMA = {
16
+ application_id: z
17
+ .string()
18
+ .optional()
19
+ .describe("Application UUID. If omitted, uses applicationId from .zivis/project.json."),
20
+ signal_id: z.string().describe("Signal logical id (from zivis_list_signals)"),
21
+ changes: z
22
+ .array(z.object({
23
+ file_path: z.string(),
24
+ after_content: z.string().optional(),
25
+ before_content: z.string().optional(),
26
+ }))
27
+ .min(1)
28
+ .describe("Proposed changes"),
29
+ };
30
+ export function createExplainSignalForDiffHandler(apiClient) {
31
+ return async (params) => {
32
+ const req = requireApplicationId(params.application_id);
33
+ if (!req.ok) {
34
+ return {
35
+ content: [{ type: "text", text: `Error: ${req.message}` }],
36
+ isError: true,
37
+ };
38
+ }
39
+ const application_id = req.id;
40
+ try {
41
+ const data = await apiClient.post(`/api/apps/${application_id}/signals/${params.signal_id}/explain-for-diff`, {
42
+ changes: params.changes.map((c) => ({
43
+ filePath: c.file_path,
44
+ beforeContent: c.before_content,
45
+ afterContent: c.after_content,
46
+ })),
47
+ });
48
+ const result = {
49
+ application_id: data.applicationId,
50
+ signal_id: data.signalLogicalId,
51
+ title: data.title,
52
+ severity: data.severity,
53
+ verdict: data.verdict,
54
+ evidence_files_in_diff: data.evidenceFilesInDiff,
55
+ all_evidence_files: data.allEvidenceFiles,
56
+ caveats: data.caveats,
57
+ };
58
+ return {
59
+ content: [
60
+ {
61
+ type: "text",
62
+ text: JSON.stringify(sanitizeResponse(result), null, 2),
63
+ },
64
+ ],
65
+ };
66
+ }
67
+ catch (err) {
68
+ const message = err instanceof Error ? err.message : "Failed to explain signal for diff";
69
+ return {
70
+ content: [{ type: "text", text: `Error: ${message}` }],
71
+ isError: true,
72
+ };
73
+ }
74
+ };
75
+ }
@@ -1,9 +1,3 @@
1
- /**
2
- * MCP Tool: Generate Diagram from Infrastructure Source
3
- *
4
- * Reads a local docker-compose file and sends it to the ZIVIS API
5
- * for server-side parsing and canvas diagram generation.
6
- */
7
1
  import { z } from "zod";
8
2
  import type { ApiClient } from "../api-client.js";
9
3
  export declare const GENERATE_DIAGRAM_NAME = "zivis_generate_diagram";
@@ -1,13 +1,15 @@
1
- /**
2
- * MCP Tool: Generate Diagram from Infrastructure Source
3
- *
4
- * Reads a local docker-compose file and sends it to the ZIVIS API
5
- * for server-side parsing and canvas diagram generation.
6
- */
7
1
  import { z } from "zod";
8
2
  import { readFile } from "fs/promises";
9
- import { join } from "path";
3
+ import { join, relative, resolve } from "path";
10
4
  import { sanitizeResponse } from "../sanitize.js";
5
+ function resolveWithinProjectDir(projectDir, candidate) {
6
+ const base = resolve(projectDir);
7
+ const target = resolve(base, candidate);
8
+ const rel = relative(base, target);
9
+ if (rel.startsWith(".."))
10
+ return null;
11
+ return target;
12
+ }
11
13
  export const GENERATE_DIAGRAM_NAME = "zivis_generate_diagram";
12
14
  export const GENERATE_DIAGRAM_DESCRIPTION = `Generate a visual architecture diagram from a Docker Compose file.
13
15
 
@@ -52,13 +54,21 @@ export function createGenerateDiagramHandler(apiClient) {
52
54
  return async (params) => {
53
55
  const projectDir = params.project_dir || process.cwd();
54
56
  const sourceFormat = params.source_format || "docker-compose";
55
- // Find and read the compose file
56
57
  let filePath = params.file_path;
57
58
  let content = null;
58
59
  if (filePath) {
59
- const resolved = filePath.startsWith("/")
60
- ? filePath
61
- : join(projectDir, filePath);
60
+ const resolved = resolveWithinProjectDir(projectDir, filePath);
61
+ if (!resolved) {
62
+ return {
63
+ content: [
64
+ {
65
+ type: "text",
66
+ text: `Error: file_path must resolve inside project_dir (got: ${filePath})`,
67
+ },
68
+ ],
69
+ isError: true,
70
+ };
71
+ }
62
72
  try {
63
73
  content = await readFile(resolved, "utf-8");
64
74
  }
@@ -82,7 +92,6 @@ export function createGenerateDiagramHandler(apiClient) {
82
92
  break;
83
93
  }
84
94
  catch {
85
- /* continue */
86
95
  }
87
96
  }
88
97
  if (!content) {
@@ -150,4 +159,3 @@ export function createGenerateDiagramHandler(apiClient) {
150
159
  }
151
160
  };
152
161
  }
153
- //# sourceMappingURL=generate-diagram.js.map
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_application_overview — Rich application context with endpoints & threat model
3
- *
4
- * Maps to: GET /api/rt/applications/:id/overview
5
- */
6
1
  import { z } from "zod";
7
2
  import type { ApiClient } from "../api-client.js";
8
3
  export declare const GET_APPLICATION_OVERVIEW_NAME = "zivis_get_application_overview";
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_application_overview — Rich application context with endpoints & threat model
3
- *
4
- * Maps to: GET /api/rt/applications/:id/overview
5
- */
6
1
  import { z } from "zod";
7
2
  import { requireApplicationId } from "../resolve-application-id.js";
8
3
  import { sanitizeResponse } from "../sanitize.js";
@@ -140,4 +135,3 @@ export function createGetApplicationOverviewHandler(apiClient) {
140
135
  }
141
136
  };
142
137
  }
143
- //# sourceMappingURL=get-application-overview.js.map
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_application — Get details of a specific application
3
- *
4
- * Maps to: GET /api/rt/applications/:id
5
- */
6
1
  import { z } from "zod";
7
2
  import type { ApiClient } from "../api-client.js";
8
3
  export declare const GET_APPLICATION_NAME = "zivis_get_application";
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_application — Get details of a specific application
3
- *
4
- * Maps to: GET /api/rt/applications/:id
5
- */
6
1
  import { z } from "zod";
7
2
  import { requireApplicationId } from "../resolve-application-id.js";
8
3
  import { sanitizeResponse } from "../sanitize.js";
@@ -80,4 +75,3 @@ export function createGetApplicationHandler(apiClient) {
80
75
  }
81
76
  };
82
77
  }
83
- //# sourceMappingURL=get-application.js.map
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_diagram — Get full diagram content
3
- *
4
- * Maps to: GET /api/diagrams/:id
5
- */
6
1
  import { z } from "zod";
7
2
  import type { ApiClient } from "../api-client.js";
8
3
  export declare const GET_DIAGRAM_NAME = "zivis_get_diagram";
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_diagram — Get full diagram content
3
- *
4
- * Maps to: GET /api/diagrams/:id
5
- */
6
1
  import { z } from "zod";
7
2
  import { sanitizeResponse } from "../sanitize.js";
8
3
  export const GET_DIAGRAM_NAME = "zivis_get_diagram";
@@ -23,7 +18,6 @@ export function createGetDiagramHandler(apiClient) {
23
18
  try {
24
19
  const data = await apiClient.get(`/api/diagrams/${params.diagram_id}`);
25
20
  const sanitized = sanitizeResponse(data);
26
- // Format nodes with clear structure
27
21
  const nodes = Array.isArray(sanitized.nodes)
28
22
  ? sanitized.nodes.map((n) => ({
29
23
  node_id: n.id,
@@ -43,7 +37,6 @@ export function createGetDiagramHandler(apiClient) {
43
37
  linked_evidence_ids: n.linkedEvidenceIds || [],
44
38
  }))
45
39
  : [];
46
- // Format connections
47
40
  const connections = Array.isArray(sanitized.connections)
48
41
  ? sanitized.connections.map((c) => ({
49
42
  connection_id: c.id,
@@ -56,7 +49,6 @@ export function createGetDiagramHandler(apiClient) {
56
49
  metadata: c.metadata || null,
57
50
  }))
58
51
  : [];
59
- // Format boundaries
60
52
  const boundaries = Array.isArray(sanitized.boundaries)
61
53
  ? sanitized.boundaries.map((b) => ({
62
54
  boundary_id: b.id,
@@ -69,7 +61,6 @@ export function createGetDiagramHandler(apiClient) {
69
61
  height: b.height,
70
62
  }))
71
63
  : [];
72
- // Extract linked entity IDs
73
64
  const linkedThreatModelIds = Array.isArray(sanitized.threatModelLinks)
74
65
  ? sanitized.threatModelLinks.map((l) => l.threatModelId)
75
66
  : [];
@@ -79,7 +70,7 @@ export function createGetDiagramHandler(apiClient) {
79
70
  description: sanitized.description || null,
80
71
  diagram_type: sanitized.diagramType,
81
72
  content_type: sanitized.contentType,
82
- content: sanitized.content || null, // Mermaid source; null for canvas-type diagrams
73
+ content: sanitized.content || null,
83
74
  source_type: sanitized.sourceType,
84
75
  created_at: sanitized.createdAt,
85
76
  updated_at: sanitized.updatedAt,
@@ -106,4 +97,3 @@ export function createGetDiagramHandler(apiClient) {
106
97
  }
107
98
  };
108
99
  }
109
- //# sourceMappingURL=get-diagram.js.map
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_document — Fetch a document by ID, including its full markdown content.
3
- *
4
- * Maps to: GET /api/documents/:id
5
- */
6
1
  import { z } from "zod";
7
2
  import type { ApiClient } from "../api-client.js";
8
3
  export declare const GET_DOCUMENT_NAME = "zivis_get_document";
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_document — Fetch a document by ID, including its full markdown content.
3
- *
4
- * Maps to: GET /api/documents/:id
5
- */
6
1
  import { z } from "zod";
7
2
  import { sanitizeResponse } from "../sanitize.js";
8
3
  export const GET_DOCUMENT_NAME = "zivis_get_document";
@@ -40,4 +35,3 @@ export function createGetDocumentHandler(apiClient) {
40
35
  }
41
36
  };
42
37
  }
43
- //# sourceMappingURL=get-document.js.map
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_oss_zat — Get the signed attestation token (ZAT) for a GitHub repo
3
- *
4
- * Maps to: GET /api/oss-trust/repos/:owner/:repo/zat (public, no auth required)
5
- */
6
1
  import { z } from "zod";
7
2
  import type { ZivisConfig } from "../types.js";
8
3
  export declare const GET_OSS_ZAT_NAME = "zivis_get_oss_zat";
@@ -1,8 +1,3 @@
1
- /**
2
- * zivis_get_oss_zat — Get the signed attestation token (ZAT) for a GitHub repo
3
- *
4
- * Maps to: GET /api/oss-trust/repos/:owner/:repo/zat (public, no auth required)
5
- */
6
1
  import { z } from "zod";
7
2
  export const GET_OSS_ZAT_NAME = "zivis_get_oss_zat";
8
3
  export const GET_OSS_ZAT_DESCRIPTION = `Get the ZIVIS Attestation Token (ZAT) for a GitHub repository — a cryptographically signed, machine-verifiable supply chain credential.
@@ -32,7 +27,6 @@ export const GET_OSS_ZAT_SCHEMA = {
32
27
  .string()
33
28
  .describe("GitHub repo URL (https://github.com/owner/repo) or owner/repo string"),
34
29
  };
35
- /** Parse GitHub URL or owner/repo into components */
36
30
  function parseRepo(input) {
37
31
  const trimmed = input.trim();
38
32
  const urlMatch = trimmed.match(/^https?:\/\/(?:www\.)?github\.com\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)/);
@@ -102,4 +96,3 @@ export function createGetOssZatHandler(config) {
102
96
  }
103
97
  };
104
98
  }
105
- //# sourceMappingURL=get-oss-zat.js.map
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ import type { ApiClient } from "../api-client.js";
3
+ export declare const GET_SIGNAL_NAME = "zivis_get_signal";
4
+ export declare const GET_SIGNAL_DESCRIPTION = "Get full detail on a single Signal by its id.\n\nReturns the qualified narrative \u2014 description, mitigation, attack-chain context, taxonomy (STRIDE / ATPS layer / MITRE / OWASP / compliance mappings), detected safeguards and what breaks them, and the polymorphic source-artifact reference for drilling into the native subsystem.\n\nPass `signal_id` from a `zivis_list_signals` response.\n\nSECURITY: Display-shaped output only. No raw graph data.";
5
+ export declare const GET_SIGNAL_SCHEMA: {
6
+ application_id: z.ZodOptional<z.ZodString>;
7
+ signal_id: z.ZodString;
8
+ };
9
+ export declare function createGetSignalHandler(apiClient: ApiClient): (params: {
10
+ application_id?: string;
11
+ signal_id: string;
12
+ }) => Promise<{
13
+ content: {
14
+ type: "text";
15
+ text: string;
16
+ }[];
17
+ isError: boolean;
18
+ } | {
19
+ content: {
20
+ type: "text";
21
+ text: string;
22
+ }[];
23
+ isError?: undefined;
24
+ }>;
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ import { requireApplicationId } from "../resolve-application-id.js";
3
+ import { sanitizeResponse } from "../sanitize.js";
4
+ export const GET_SIGNAL_NAME = "zivis_get_signal";
5
+ export const GET_SIGNAL_DESCRIPTION = `Get full detail on a single Signal by its id.
6
+
7
+ Returns the qualified narrative — description, mitigation, attack-chain context, taxonomy (STRIDE / ATPS layer / MITRE / OWASP / compliance mappings), detected safeguards and what breaks them, and the polymorphic source-artifact reference for drilling into the native subsystem.
8
+
9
+ Pass \`signal_id\` from a \`zivis_list_signals\` response.
10
+
11
+ SECURITY: Display-shaped output only. No raw graph data.`;
12
+ export const GET_SIGNAL_SCHEMA = {
13
+ application_id: z
14
+ .string()
15
+ .optional()
16
+ .describe("Application UUID. If omitted, uses applicationId from .zivis/project.json."),
17
+ signal_id: z
18
+ .string()
19
+ .describe("Opaque signal id (from zivis_list_signals)."),
20
+ };
21
+ export function createGetSignalHandler(apiClient) {
22
+ return async (params) => {
23
+ const req = requireApplicationId(params.application_id);
24
+ if (!req.ok) {
25
+ return {
26
+ content: [{ type: "text", text: `Error: ${req.message}` }],
27
+ isError: true,
28
+ };
29
+ }
30
+ if (!params.signal_id) {
31
+ return {
32
+ content: [{ type: "text", text: "Error: signal_id is required" }],
33
+ isError: true,
34
+ };
35
+ }
36
+ const path = `/api/apps/${req.id}/signals/${encodeURIComponent(params.signal_id)}`;
37
+ try {
38
+ const s = await apiClient.get(path);
39
+ const result = {
40
+ id: s.id,
41
+ source: s.source,
42
+ severity: s.severity,
43
+ status: s.status,
44
+ confidence: s.confidence,
45
+ title: s.title,
46
+ description: s.description,
47
+ category: s.category,
48
+ attack_chain: s.attackChain
49
+ ? {
50
+ name: s.attackChain.chainName,
51
+ step: `${s.attackChain.stepIndex}/${s.attackChain.totalSteps}`,
52
+ }
53
+ : null,
54
+ taxonomy: s.taxonomy ?? null,
55
+ components: s.components?.map((c) => c.name) ?? [],
56
+ refs: s.refs,
57
+ recommended_action: s.recommendedAction,
58
+ safeguards: s.safeguards ?? null,
59
+ fingerprint: s.fingerprint,
60
+ };
61
+ return {
62
+ content: [
63
+ { type: "text", text: JSON.stringify(sanitizeResponse(result), null, 2) },
64
+ ],
65
+ };
66
+ }
67
+ catch (err) {
68
+ const message = err instanceof Error ? err.message : "Failed to load signal";
69
+ return {
70
+ content: [{ type: "text", text: `Error: ${message}` }],
71
+ isError: true,
72
+ };
73
+ }
74
+ };
75
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import type { ApiClient } from "../api-client.js";
3
+ import type { ZivisConfig } from "../types.js";
4
+ export declare const GET_STARTED_NAME = "zivis_get_started";
5
+ export declare const GET_STARTED_DESCRIPTION = "Call this FIRST on any turn where the user asks about security, vulnerabilities, code review, deployment readiness, threat modeling, dependencies, or \"what should I do next.\" Idempotent and safe to call repeatedly \u2014 detects prior inspect runs and never re-inspects unnecessarily. Prefer this over calling zivis_inspect directly.\n\nUse this when the user says any of:\n- \"what should I do for security on this app\"\n- \"uhh, where do I start\"\n- \"is my app safe\" / \"is my chatbot safe\"\n- \"I need to do security stuff before launch\"\n- \"I have an audit / pen test / customer asking about security\"\n- \"check my dependencies / libraries / repos\"\n- \"how do I use ZIVIS\"\n- \"what can ZIVIS do for me\"\n\nThis tool inspects the current project state \u2014 binding, application, scans, findings \u2014\nAND if a recent 'zivis inspect' artifact exists for this repo, evaluates the local\nthreat library against it to surface architectural patterns ZIVIS thinks may apply\n(self-consistency without context isolation, late org filter, privilege separation, etc.).\nThe 'relevant_threats' field in the response is what makes this tool different from a\ngeneric security menu: ZIVIS is reading the user's actual codebase via the graph\nartifact and naming threats by their architectural shape.\n\nAlways speak to the user in threat-model language: components, flows, trust boundaries,\nattack scenarios. Even when they don't yet know those terms \u2014 that's how they learn.\n\nOutput is a structured JSON object. Present recommended_next_steps as a numbered list\nto the user, in order, and ask them to pick one. If relevant_threats is non-empty, lead\nwith that \u2014 it's the most concrete thing ZIVIS knows about their repo. Use the label\nand why fields verbatim; do not invent new steps. If the user is unsure which to pick,\nrecommend the item flagged in if_user_unsure.";
6
+ export declare const GET_STARTED_SCHEMA: {
7
+ concern: z.ZodOptional<z.ZodString>;
8
+ cwd: z.ZodOptional<z.ZodString>;
9
+ };
10
+ export declare function createGetStartedHandler(apiClient: ApiClient, _config: ZivisConfig): (params: {
11
+ concern?: string;
12
+ cwd?: string;
13
+ }) => Promise<{
14
+ content: {
15
+ type: "text";
16
+ text: string;
17
+ }[];
18
+ }>;