Описание
Trivy — Model Context Protocol server
README
A Model Context Protocol (MCP) server that provides security vulnerability scanning capabilities using Trivy, a comprehensive security scanner. This allows you to scan for vulnerabilities and automatically fix them directly from Claude Desktop, Cursor, or any MCP-compatible client.
Features
- 🔍 Project Scanning: Scan directories for security vulnerabilities in dependencies
- 🔧 Automatic Fixing: Automatically update packages to secure versions
- 📦 Multi-Language Support: Supports Python (pip), Node.js (npm), Go, Rust, PHP, and Ruby
- 📊 Detailed Reporting: Get comprehensive vulnerability reports with severity levels
- 🤖 AI Integration: Works seamlessly with Claude Desktop and Cursor
Prerequisites
1. Install Trivy
macOS:
brew install trivy
Linux:
sudo apt-get install wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy
Windows: Download from Trivy Releases
2. Python 3.8+
Make sure you have Python 3.8 or later installed.
Installation
Clone this repository:
git clone https://github.com/your-username/trivy-mcp-server.git cd trivy-mcp-serverInstall dependencies:
pip install -r requirements.txtTest the installation:
python server.py --help
Configuration
🖥️ Claude Desktop Setup
Locate your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
~/AppData/Roaming/Claude/claude_desktop_config.json
- macOS:
Add the Trivy MCP server to your config:
{ "mcpServers": { "trivy-security-scanner": { "command": "python", "args": [ "/full/path/to/trivy-mcp-server/server.py", "--transport", "stdio" ], "env": {} } } }Replace
/full/path/to/with the actual path to your cloned repositoryRestart Claude Desktop
Verify it's working: In Claude Desktop, you should now be able to ask:
"Scan my project for security vulnerabilities"
🎯 Cursor Setup
Open Cursor Settings (
Cmd/Ctrl + ,)Search for "MCP" in settings
Add the Trivy MCP server configuration:
{ "mcp.servers": { "trivy-security-scanner": { "command": "python", "args": [ "/full/path/to/trivy-mcp-server/server.py", "--transport", "stdio" ] } } }Replace
/full/path/to/with the actual path to your repositoryRestart Cursor
Test the integration: You can now use Trivy commands directly in Cursor's AI chat.
Usage
Once configured with Claude Desktop or Cursor, you can use natural language commands:
🔍 Scanning for Vulnerabilities
"Scan my current project for security vulnerabilities"
"Check for critical and high severity vulnerabilities only"
"Scan the /path/to/my/project directory for security issues"
🔧 Fixing Vulnerabilities
"Fix the lodash vulnerability in my project"
"Update the vulnerable packages to secure versions"
"Do a dry run to see what packages would be updated"
📚 Research Vulnerabilities
"Get details about CVE-2021-44228"
"Tell me more about this vulnerability: CVE-2021-23337"
Available Tools
The MCP server provides three main tools:
1. scan_project
- Purpose: Scan a directory for security vulnerabilities
- Parameters:
workspace(required): Directory path to scanseverity_filter(optional): Filter by severity (e.g., "HIGH,CRITICAL")include_fixed(optional): Include already fixed vulnerabilities
2. fix_vulnerability
- Purpose: Automatically update packages to secure versions
- Parameters:
workspace(required): Directory containing the projectpkg_name(required): Name of the package to updatetarget_version(required): Version to update todry_run(optional): Simulate the fix without making changes
3. get_vulnerability_details
- Purpose: Get detailed information about specific vulnerabilities
- Parameters:
vulnerability_id(required): CVE ID (e.g., "CVE-2021-44228")
Example Workflows
Daily Security Review
- Morning scan: "Scan all my projects for new vulnerabilities"
- Review findings: Check the severity and impact of discovered issues
- Apply fixes: "Fix the critical vulnerabilities found"
- Verify: Re-scan to confirm fixes were applied
Pull Request Security Check
- Before merging: "Scan this branch for any new security vulnerabilities"
- Block if issues found: Don't merge if critical vulnerabilities are introduced
- Auto-fix when possible: "Update the vulnerable dependencies to secure versions"
Vulnerability Research
- Deep dive: "Get details about CVE-2021-44228 and check if any of my projects are affected"
- Impact assessment: Understand the scope and severity
- Remediation planning: Plan updates and fixes
Supported Package Managers
- ✅ Python:
requirements.txt,pyproject.toml - ✅ Node.js:
package.json - ✅ Go:
go.mod - 🔄 Rust:
Cargo.toml(detection only) - 🔄 PHP:
composer.json(detection only) - 🔄 Ruby:
Gemfile(detection only)
Note: Automatic fixing is currently supported for Python, Node.js, and Go. Other languages have detection support with manual fixing guidance.
Troubleshooting
Common Issues
1. "Trivy not found" error
- Make sure Trivy is installed and in your PATH
- Test with:
trivy --version
2. "Permission denied" error
- Ensure the server.py file has execute permissions
- Try:
chmod +x server.py
3. "Module not found" error
- Install dependencies:
pip install -r requirements.txt - Check Python version:
python --version(should be 3.8+)
4. Claude Desktop not recognizing the server
- Check the file path in your config is correct (use absolute paths)
- Restart Claude Desktop after config changes
- Check the Claude Desktop logs for error messages
Getting Help
- Check Trivy installation:
trivy --version - Test the server:
python server.py --help - Verify MCP connection: Look for server logs in Claude Desktop/Cursor
- Check file paths: Ensure all paths in config files are absolute and correct
Development
Running Standalone
# Start with default settings (SSE transport on port 54321)
python server.py
# Start with custom settings
python server.py --port 8080 --transport sse
# Start for Claude Desktop (stdio transport)
python server.py --transport stdio
Adding New Package Managers
To add support for additional package managers:
- Update
detect_package_manager()function - Add fixing logic in
fix_vulnerability()function - Test with sample projects
Security Considerations
- The server executes system commands (Trivy, package managers)
- Always review changes before applying fixes in production
- Consider running with limited privileges in production environments
- Validate workspace paths to prevent directory traversal attacks
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is open source. See individual dependencies for their respective licenses.
🔒 Keep your code secure with automated vulnerability scanning!
Установка Trivy
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/Mr-Neutr0n/trivy-mcp-serverFAQ
Trivy MCP бесплатный?
Да, Trivy MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Trivy?
Нет, Trivy работает без API-ключей и переменных окружения.
Trivy — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Trivy в Claude Desktop, Claude Code или Cursor?
Открой Trivy на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
GitHub
PRs, issues, code search, CI status
автор: GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
автор: mcpdotdirectAmap Maps Mcp Server
MCP server for using the AMap Maps API
автор: duxiaohuiSupabase
Database, auth and storage
автор: SupabaseEverything
Reference / test server with prompts, resources, and tools.
Git
Tools to read, search, and manipulate Git repositories.
Sequential Thinking
Dynamic and reflective problem-solving through thought sequences.
Time
Time and timezone conversion capabilities.
Compare Trivy with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development
