AI-powered threat modeling tools including a CLI for automated threat model generation and an MCP server for AI assistant integration.
For user documentation, installation guides, and usage examples, see docs/AI-CLI-MCP.md
This package provides:
- CLI Tool (
threat-composer-ai-cli) - Automated threat modeling from source code analysis - MCP Server (
threat-composer-ai-mcp) - Model Context Protocol server for AI assistants
# Install with uv
uv tool install --from "git+https://github.com/awslabs/threat-composer.git#subdirectory=packages/threat-composer-ai" threat-composer-ai
# Use the tools
threat-composer-ai-cli /path/to/codebase
threat-composer-ai-mcp- Python 3.10 or higher
- UV package manager
- AWS credentials (for Bedrock access)
- Graphviz (for diagram generation)
Graphviz is required for generating Architecture and Data Flow Diagrams. Install it using your system's package manager:
# macOS (Homebrew)
brew install graphviz
# Ubuntu/Debian
sudo apt-get install graphviz
# Fedora/RHEL
sudo dnf install graphvizAfter installation, verify Graphviz is available by running:
dot -VFor more information, see: https://graphviz.org/download/
# Navigate to package directory
cd packages/threat-composer-ai
# Install dependencies
uv sync
# Run tools locally
uv run threat-composer-ai-cli /path/to/codebase
uv run threat-composer-ai-mcpsrc/threat_composer_ai/
├── __init__.py # Package initialization
├── __main__.py # CLI entry point
├── mcp_server.py # MCP server entry point
├── agents/ # Specialized threat modeling agents
│ ├── application_info.py
│ ├── architecture.py
│ ├── dataflow.py
│ ├── threats.py
│ ├── mitigations.py
│ └── threat_model.py
├── mcp/ # MCP server implementation
│ ├── server.py
│ └── tools.py
├── models/ # Pydantic models
│ └── threat_composer_v1.py
├── tools/ # Agent tools
├── workflows/ # Workflow orchestration
└── utils/ # Utilities
# Run tests
cd packages/threat-composer-ai
uv run pytest
# Run with coverage
uv run pytest --cov=threat_composer_ai
# Test MCP server
uv run python test_mcp_server.py# Format code
uv run ruff format .
# Lint code
uv run ruff check .
# Type checking
uv run mypy src/
# Run CLI with verbose logging
uv run threat-composer-ai-cli /path/to/code --verbose
# Run MCP server with debug logging
PYTHONPATH=src uv run python -m threat_composer_ai.mcp_serverWhen contributing to this package:
- Follow the established agent patterns
- Maintain Threat Composer schema compatibility
- Add comprehensive logging
- Include proper error handling
- Update documentation in docs/AI-CLI-MCP.md
- Test with various codebase types
- User Guide: docs/AI-CLI-MCP.md
- Main README: README.md
- Development Guide: docs/DEVELOPMENT.md
Licensed under Apache-2.0. See LICENSE for details.