Skip to content
Back to search

threat-modeling-mcp-server

A Model Context Protocol (MCP) server for comprehensive threat modeling with guided code validation.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/awslabs/threat-modeling-mcp-server with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/awslabs/threat-modeling-mcp-server'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/awslabs--threat-modeling-mcp-server/badge.svg)](/listings/awslabs--threat-modeling-mcp-server)

HTML

<a href="/listings/awslabs--threat-modeling-mcp-server"><img src="/api/listings/awslabs--threat-modeling-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

> **Note:** Before using these prompts, you must first complete the [Installation](#installation) process to set up the MCP server.

Start a threat model

"Threat model this project using the threat modeling MCP Server"

Being specific in the prompt to use the threat modeling MCP Server will make sure the client (Cline/Kiro/etc) will follow the exact phases and methodology rather than taking short cut path and introduce hallucination in results.

Threat model a subproject or reduce the scope to a sub folder

"Threat model this subfolder using the threat modeling MCP Server"

Running it on a subfolder limits the intended analysis scope. To save exports there, request an output path inside that subfolder; the export location is not inferred automatically from the analysis scope.

Save the result of threat model

"Save the threat model report"

Validate the completeness of the threat modeling process

"Please complete all the phases in the threat model plan and then generate the final report."

Feed an architecture diagram image as input

"Threat model this project using the threat model MCP server and consider this architecture_image.png attached for this review"

Attempt remediating the threats

"Can you see if you can implement mitigation controls in the code based on the threats reported in the threat model"

Regenerate threat model based on code fixes

"Can you updated the threat model based on the code fixes which mitigated the reported threats"

More examples

# Set up context
"Set business context for an e-commerce payment system"

# Add architecture
"Add a web server component using AWS EC2"
"Add a database component using AWS RDS"

# Identify threats
"Add a threat where an attacker with network access performs SQL injection"

# Add mitigations
"Add a mitigation for input validation"

# Export results
"Export the threat model to my_model.tc.json"

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 406 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # Threat Modeling MCP Server
  2. A Model Context Protocol (MCP) server for comprehensive threat modeling with guided code validation.
  3. ## Table of Contents
  4. - [Overview](#overview)
  5. - [Quick Start Prompts](#quick-start-prompts-and-examples-on-how-to-threat-model-with-this-mcp-server)
  6. - [Key Features](#key-features)
  7. - [Prerequisites](#prerequisites)
  8. - [Installation](#installation)
  9. - [Running with Kiro CLI](#running-with-kiro-cli)
  10. - [Output File Management](#output-file-management)
  11. - [Quick Reference](#quick-reference)
  12. - [Tools Overview](#tools-overview)
  13. - [Threat Modeling Methodology](#threat-modeling-methodology)
  14. - [Assumptions in Threat Modeling](#assumptions-in-threat-modeling)
  15. - [Development](#development)
  16. ## Overview
  17. This server provides tools for threat modeling, including business context analysis, architecture analysis, threat actor analysis, trust boundary analysis, asset flow analysis, code security validation and comprehensive report generation.
  18. ### Architecture and Approach
  19. This MCP Server calls the existing agent's LLM instead of making an external API or network call to a different service. It relies on existing client's LLM which could be Amazon-Q, Kiro or Cline.
  20. This Threat Modeling MCP Server has three main functionalities:
  21. 1. Threat modeling phase or state management and prompt controlling.
  22. 2. Prompts steering, which controls the agent to go through a methodic approach to threat modeling using built in definitions of business risks, exposures, threat actors and use STRIDE in sequential order.
  23. 3. Structured input validation and phase-completion checks that support an actionable threat model report.
  24. It also has tools to generate a final report in both Markdown and JSON exportable formats.
  25. ### Key Advantages of this approach
  26. - This threat model follows the standard STRIDE approach to threat modeling in phases rather than quick conclusion of assets, boundaries and threats which can lead to hallucination or low quality output.
  27. - There is an effort by LLM to understand the business context of the project and make valid assumptions which can be controlled by the user.
  28. - This local server relies on the MCP client's configured LLM (Cline, Amazon Q, Kiro) rather than calling a separate model API. Data exposure depends on the client and any other MCP servers the client invokes.
  29. - The server keeps the working threat model in memory for the current process. Export tools can write JSON and Markdown snapshots to a `.threatmodel` directory, but those snapshots are not automatically loaded in a later session.
  30. - The code-validation tool records evidence supplied by the client after it inspects the implementation, applies status transitions atomically, and fails the phase closed until every current threat and mitigation is covered.
  31. ## Quick Start Prompts and Examples on how to threat model with this MCP server
  32. > **Note:** Before using these prompts, you must first complete the [Installation](#installation) process to set up the MCP server.
  33. ### Start a threat model
  34. ```
  35. "Threat model this project using the threat modeling MCP Server"
  36. ```
  37. Being specific in the prompt to use the threat modeling MCP Server will make sure the client (Cline/Kiro/etc) will follow the exact phases and methodology rather than taking short cut path and introduce hallucination in results.
  38. ### Threat model a subproject or reduce the scope to a sub folder
  39. ```
  40. "Threat model this subfolder using the threat modeling MCP Server"
  41. ```
  42. Running it on a subfolder limits the intended analysis scope. To save exports there, request an output path inside that subfolder; the export location is not inferred automatically from the analysis scope.
  43. ### Save the result of threat model
  44. ```
  45. "Save the threat model report"
  46. ```
  47. ### Validate the completeness of the threat modeling process
  48. ```
  49. "Please complete all the phases in the threat model plan and then generate the final report."
  50. ```
  51. ### Feed an architecture diagram image as input
  52. ```
  53. "Threat model this project using the threat model MCP server and consider this architecture_image.png attached for this review"
  54. ```
  55. ### Attempt remediating the threats
  56. ```
  57. "Can you see if you can implement mitigation controls in the code based on the threats reported in the threat model"
  58. ```
  59. ### Regenerate threat model based on code fixes
  60. ```
  61. "Can you updated the threat model based on the code fixes which mitigated the reported threats"
  62. ```
  63. ### More examples
  64. ```bash
  65. # Set up context
  66. "Set business context for an e-commerce payment system"
  67. # Add architecture
  68. "Add a web server component using AWS EC2"
  69. "Add a database component using AWS RDS"
  70. # Identify threats
  71. "Add a threat where an attacker with network access performs SQL injection"
  72. # Add mitigations
  73. "Add a mitigation for input validation"
  74. # Export results
  75. "Export the threat model to my_model.tc.json"
  76. ```
  77. ## Key Features
  78. - **Comprehensive Threat Modeling**: Structured approach to identifying, evaluating, and addressing security risks
  79. - **Evidence-Based Code Validation**: Records implementation evidence, updates statuses, and produces a deterministic report
  80. - **Business Context Analysis**: Understand the business value and criticality of the system
  81. - **Architecture Analysis**: Document the system's technical architecture and data flows
  82. - **Threat Actor Analysis**: Identify potential adversaries and assess their capabilities
  83. - **Trust Boundary Analysis**: Identify trust zones and validate security controls at boundaries
  84. - **Asset Flow Analysis**: Track critical assets through the system
  85. - **Threat Identification**: Systematically identify potential threats using STRIDE methodology
  86. - **Mitigation Planning**: Develop strategies to address identified threats
  87. - **Compact Domain Managers**: Action-based tools for assumptions, architecture, actors, boundaries, assets, threats, and mitigations
  88. - **Threat Model Guide**: Step-by-step guidance through the threat modeling process
  89. - **Data Model Inspection**: One tool for listing enum models and inspecting accepted values
  90. ## Prerequisites
  91. Before installing the Threat Modeling MCP Server, ensure you have the following requirements:
  92. ### Installation Requirements
  93. 1. Install `uvx` from [Astral](https://docs.astral.sh/uv/getting-started/installation/) or the [GitHub README](https://github.com/astral-sh/uv#installation)
  94. - uvx is part of the uv package manager
  95. - Verify installation: `uvx --version`
  96. ## Installation
  97. Once you have uvx installed and verified to be working, add the below configuation to your mcp.json config file. Depending on the what type of client your are using (kiro/cline/amazon-q) the location of this mcp.json will be different. Once you add the config and restart your IDE, the Threat Modeling MCP Server will be automatically be installed directly from this GitHub repository using `uvx`.
  98. > **Note:** The tools used by this mcp server for threat modeling are already added to the `autoApprove` for ease of user experience which enables seamless operation without manual approval prompts for each tool call. All tools are internal to the server and do not make external API calls. If you want to review each of the tools and approve it per invocation, then you need to replace the autoApprove array with this: ```"autoApprove": []```
  99. ### Configuration
  100. Add the following to your MCP client configuration:
  101. **For Amazon Q** (`~/.aws/amazonq/mcp.json`):
  102. ```json
  103. {
  104. "mcpServers": {
  105. "threat-modeling-mcp-server": {
  106. "command": "uvx",
  107. "args": [
  108. "--from",
  109. "git+https://github.com/awslabs/threat-modeling-mcp-server.git",
  110. "threat-modeling-mcp-server"
  111. ],
  112. "env": {
  113. "FASTMCP_LOG_LEVEL": "ERROR"
  114. },
  115. "disabled": false,
  116. "autoApprove": ["manage_workflow","export_threat_model","manage_system_context","manage_assumptions","manage_architecture","manage_threat_actors","manage_trust_boundaries","manage_asset_flows","manage_threats","inspect_data_models","manage_code_validation"]
  117. }
  118. }
  119. }
  120. ```
  121. **For VSCode Cline**:
  122. ```json
  123. {
  124. "mcpServers": {
  125. "threat-modeling-mcp-server": {
  126. "command": "uvx",
  127. "args": [
  128. "--from",
  129. "git+https://github.com/awslabs/threat-modeling-mcp-server.git",
  130. "threat-modeling-mcp-server"
  131. ],
  132. "env": {
  133. "FASTMCP_LOG_LEVEL": "ERROR"
  134. },
  135. "disabled": false,
  136. "autoApprove": ["manage_workflow","export_threat_model","manage_system_context","manage_assumptions","manage_architecture","manage_threat_actors","manage_trust_boundaries","manage_asset_flows","manage_threats","inspect_data_models","manage_code_validation"],
  137. "timeout": 60,
  138. "type": "stdio"
  139. }
  140. }
  141. }
  142. ```
  143. **For Kiro** (`~/.kiro/settings/mcp.json`):
  144. ```json
  145. {
  146. "mcpServers": {
  147. "threat-modeling-mcp-server": {
  148. "command": "uvx",
  149. "args": [
  150. "--from",
  151. "git+https://github.com/awslabs/threat-modeling-mcp-server.git",
  152. "threat-modeling-mcp-server"
  153. ],
  154. "env": {
  155. "FASTMCP_LOG_LEVEL": "ERROR"
  156. },
  157. "disabled": false,
  158. "autoApprove": ["manage_workflow","export_threat_model","manage_system_context","manage_assumptions","manage_architecture","manage_threat_actors","manage_trust_boundaries","manage_asset_flows","manage_threats","inspect_data_models","manage_code_validation"]
  159. }
  160. }
  161. }
  162. ```
  163. ### Running with Kiro CLI
  164. To run the MCP server via `kiro-cli` with all tools auto-approved:
  165. ```bash
  166. kiro-cli chat --trust-tools="@threat-modeling-mcp-server/*"
  167. ```
  168. This trusts all tools from the `threat-modeling-mcp-server` MCP server, so you won't be prompted to approve each tool call individually.
  169. ### Running with the Custom Kiro CLI Agent
  170. This repository includes a pre-configured Kiro CLI agent that covers nine numbered phases plus the optional Phase 7.5 code-validation step. The agent configuration is in `.kiro/agents/threat-modeler.json`.
  171. **Global install** (available from any directory):
  172. ```bash
  173. ./install-kiro-agent.sh
  174. ```
  175. To uninstall: `./install-kiro-agent.sh --remove`
  176. **Local install** (project-specific):
  177. ```bash
  178. cp -r /path/to/threat-modeling-mcp-server/.kiro /path/to/your-project/.kiro
  179. ```
  180. **Usage**:
  181. ```bash
  182. # Non-interactive: run full threat model and exit
  183. kiro-cli chat --agent threat-modeler --no-interactive "Threat model this project"
  184. # Interactive: start a session with the agent
  185. kiro-cli chat --agent threat-modeler
  186. ```
  187. **What the agent includes**:
  188. - **System prompt** (`.kiro/prompts/threat-modeler.md`): Detailed instructions for the phased STRIDE methodology
  189. - **Skills** (`.kiro/skills/`): Per-phase reference materials, including optional Phase 7.5
  190. - **Auto-approved MCP tools**: All threat modeling tools run without manual approval prompts
  191. ## Output File Management
  192. Before exporting, select the directory being threat modeled with
  193. `manage_workflow(action="set_project", directory=...)`. The export tool always
  194. creates `<selected-project>/.threatmodel/` and writes these artifacts there:
  195. - `<base>.tc.json`: strict AWS Threat Composer JSON. This is the only file to
  196. import into Threat Composer. It holds only the standard schema keys, uses
  197. deterministic UUID ids, and applies Threat Composer's field length limits.
  198. - `<base>.md`: the human-readable Markdown report with full text.
  199. - `<base>.extended.json`: a separate server-state snapshot (architecture,
  200. taxonomy profiles, residual risk, phase progress) with internal ids and full
  201. text. It is not importable into Threat Composer. Pass
  202. `include_extended_data=False` to skip it.
  203. The stored model keeps full text. When a field exceeds a Threat Composer limit,
  204. only the `.tc.json` copy is shortened, and the tool response lists each
  205. shortened field (by entity, field, and length) under "Export Warnings".
  206. Omitting `output_path` uses a timestamped base filename. Supplying
  207. `output_path` selects only the base filename; absolute paths, parent
  208. traversal, and other directory components cannot redirect any artifact outside
  209. the selected project's `.threatmodel` directory.
  210. Validation and analysis tools generally return text through MCP rather than
  211. writing report files. The exported files are snapshots; the server does not
  212. automatically reload them when a new process starts.
  213. ## Quick Reference
  214. ### Essential Tools for Getting Started
  215. | Tool | Purpose | Example |
  216. |------|---------|---------|
  217. | `manage_workflow(action="plan")` | Get comprehensive plan | Start here for overview |
  218. | **`manage_workflow(action="guidance", phase="1")`** | **Get focused Phase 1 guidance** | **Recommended starting point** |
  219. | `manage_workflow(action="status")` | Check progress | Track completion status |
  220. | `manage_system_context(action, section, ...)` | Define business context and taxonomy profiles | `action="set", section="all"` |
  221. | `manage_assumptions(action, ...)` | Document and maintain assumptions | Start with `action="describe"` |
  222. | `manage_architecture(action, section, ...)` | Manage components, data-store nodes, and connections | Start with `action="describe"` |
  223. | `manage_threat_actors(action, ...)` | Assess and analyze threat actors | Use `action="update"` for relevance and priority |
  224. | `manage_trust_boundaries(action, section, ...)` | Manage zones, crossings, and boundaries | Use `action="detection_plan"` for guidance |
  225. | `manage_asset_flows(action, section, ...)` | Manage assets and flows | Sections are `assets` and `flows` |
  226. | `manage_threats(action, section, ...)` | Manage threats, mitigations, links, and residual-risk decisions | Use `action="assess"` in Phase 8 |
  227. | `manage_code_validation(action, values)` | Record and report code-validation evidence | Start with `action="describe"` |
  228. | **`export_threat_model()`** | **Execute Phase 9 export** | **Generates JSON and Markdown snapshots** |
  229. ### 🚀 Step-by-Step Guidance
  230. **Recommended Approach**: Use the consolidated guidance tool for one phase at a time:
  231. | Phase | Tool | Purpose |
  232. |-------|------|---------|
  233. | 1 | `manage_workflow(action="guidance", phase="1")` | Business Context Analysis |
  234. | 2 | `manage_workflow(action="guidance", phase="2")` | Architecture Analysis |
  235. | 3 | `manage_workflow(action="guidance", phase="3")` | Threat Actor Analysis |
  236. | 4 | `manage_workflow(action="guidance", phase="4")` | Trust Boundary Analysis |
  237. | 5 | `manage_workflow(action="guidance", phase="5")` | Asset Flow Analysis |
  238. | 6 | `manage_workflow(action="guidance", phase="6")` | Threat Identification |
  239. | 7 | `manage_workflow(action="guidance", phase="7")` | Mitigation Planning |
  240. | 7.5 | `manage_workflow(action="guidance", phase="7.5")` | Guided Code Validation (Optional) |
  241. | 8 | `manage_workflow(action="guidance", phase="8")` | Residual Risk Analysis |
  242. | 9 | `manage_workflow(action="guidance", phase="9")` | Output Generation and Documentation |
  243. ## Tools Overview
  244. The Threat Modeling MCP Server provides **11 tools** organized into the following categories:
  245. | Category | Tools | Description |
  246. |----------|-------|-------------|
  247. | **Workflow** | 2 tools | Plan and guide the workflow, track or advance phases, and export the result |
  248. | **System Context** | 1 tool | Manage business context plus software, data, user, and NFR taxonomy profiles |
  249. | **Domain Managers** | 6 tools | Manage assumptions, architecture, actors, boundaries, asset flows, threats, and mitigations |
  250. | **Data Model Types** | 1 tool | Explore available enum models and accepted values |
  251. | **Code Validation** | 1 tool | Record evidence, apply statuses, validate coverage, and render reports |
  252. ## Threat Modeling Methodology
  253. ### STRIDE Framework
  254. The server uses the STRIDE methodology for systematic threat identification:
  255. | Category | Description | Example Threats |
  256. |----------|-------------|-----------------|
  257. | **Spoofing** | Impersonating someone or something else | Authentication bypass, identity theft |
  258. | **Tampering** | Modifying data or code | Data corruption, code injection |
  259. | **Repudiation** | Claiming to have not performed an action | Log tampering, non-repudiation failures |
  260. | **Information Disclosure** | Exposing information to unauthorized users | Data leaks, privacy breaches |
  261. | **Denial of Service** | Denying or degrading service | Resource exhaustion, availability attacks |
  262. | **Elevation of Privilege** | Gaining capabilities without authorization | Privilege escalation, unauthorized access |
  263. ### Threat Modeling Process
  264. The comprehensive threat modeling process includes these phases:
  265. - **Phase 1 - Business Context Analysis**: Understanding the business value and criticality of the system
  266. - **Phase 2 - Architecture Analysis**: Connecting every component and data-store node
  267. - **Phase 3 - Threat Actor Analysis**: Identifying potential adversaries and their capabilities
  268. - **Phase 4 - Trust Boundary Analysis**: Assigning every node to a zone and mapping inter-zone connections
  269. - **Phase 5 - Asset Flow Analysis**: Tracking every critical asset through at least one flow
  270. - **Phase 6 - Threat Identification**: Systematically identifying potential threats using STRIDE
  271. - **Phase 7 - Mitigation Planning**: Linking at least one mitigation to every threat
  272. - **Phase 7.5 - Code Validation Analysis (optional)**: Recording implementation evidence for every threat and mitigation
  273. - **Phase 8 - Residual Risk Analysis**: Recording a current decision, residual ratings, and rationale for every threat
  274. - **Phase 9 - Output Generation and Documentation**: Exporting current JSON and Markdown snapshots
  275. Each phase includes specific objectives, activities, and outputs to guide the threat modeling process.
  276. ### Threat Severity Levels
  277. - **Critical**: Immediate action required, system compromise likely
  278. - **High**: Significant risk, should be addressed quickly
  279. - **Medium**: Moderate risk, address in normal development cycle
  280. - **Low**: Minor risk, address when convenient
  281. ### Threat Likelihood Levels
  282. - **Very Likely**: Expected to occur
  283. - **Likely**: More likely than not
  284. - **Possible**: Plausible given the right conditions
  285. - **Unlikely**: Would require unusual circumstances
  286. ### Mitigation Types
  287. - **Preventive**: Controls that prevent threats from occurring
  288. - **Detective**: Controls that detect when threats occur
  289. - **Corrective**: Controls that respond to and correct threats
  290. - **Deterrent**: Controls that discourage an attacker from attempting the threat
  291. ## Assumptions in Threat Modeling
  292. Assumptions are statements that we accept as true without requiring further validation. They help scope the threat model by establishing boundaries and constraints. Common examples include:
  293. - "All network connections in the VPC are encrypted in transit"
  294. - "AWS KMS keys cannot be discovered by brute force"
  295. - "Nation-state threat actors are not a concern for this system"
  296. By documenting assumptions, we can:
  297. - Prevent generating pointless threats
  298. - Avoid recommending unnecessary mitigations
  299. - Focus on relevant security concerns
  300. - Clearly document the scope and limitations of the threat model
  301. ## Development
  302. ### Contributing
  303. To contribute to this project:
  304. 1. Clone the repository
  305. 2. Create a virtual environment with `uv venv`
  306. 3. Activate it with `source .venv/bin/activate` (Windows PowerShell: `.venv\Scripts\Activate.ps1`)
  307. 4. Install the package and test dependencies with `uv pip install -e '.[test]'`
  308. 5. Run the server locally with `python run_server.py`
  309. 6. Run tests with `python -m pytest`
  310. ## Security
  311. See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
  312. ## License
  313. This project is licensed under the Apache-2.0 License. See the [LICENSE](LICENSE) file for details.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.