
cursor mcp trivy
A Model Context Protocol (MCP) server that provides Trivy security scanning capabilities through a standardized interface.
Repository Info
About This Server
A Model Context Protocol (MCP) server that provides Trivy security scanning capabilities through a standardized interface.
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Trivy Security Scanner MCP Server
A Model Context Protocol (MCP) server that provides Trivy security scanning capabilities through a standardized interface.
⚠️ Note: This is a proof of concept project to demonstrate the integration capabilities between MCP, Cursor IDE, and Trivy. It's intended for experimentation and learning purposes only and is not production-ready. Use at your own risk.
Features
- 🔍 Project Scanning: Automatically scan your project directory for security vulnerabilities using Trivy
- 🛠️ Automated Fixes: Automatically update vulnerable dependencies to secure versions
- 📦 Multi-Package Support: Handles multiple package managers (Python, Node.js, Ruby, Go)
Demo
!Demo
Architecture
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Cursor IDE │ --> │ MCP Server │ --> │ Trivy │
│ (Composer) │ │ │ │ │
└─────────────┘ └──────────────┘ └─────────────┘
Prerequisites
- Python 3.12 or higher
- Trivy installed on your system:
# macOS brew install trivy
Installation
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
Usage
Start the server using SSE transport:
# Using SSE transport (default)
python server.py --transport sse --port 54321
The server exposes two tools:
-
scan_project: Scans a directory for security vulnerabilities- Required argument:
workspace- The directory path to scan
- Required argument:
-
fix_vulnerability: Updates a vulnerable package to a secure version- Required arguments:
workspace- The directory to modifypkg_name- Name of the package to updatetarget_version- Version to update to
- Required arguments:
Using with Cursor IDE
-
Start the server with SSE transport:
python server.py --transport sse --port 54321 -
Configure in Cursor:
- Open Settings
- Go to Features > MCP Servers
- Add:
http://127.0.0.1:54321/sse
-
Add the following to your .cursorrules file, create it if you don't have one yet:
After making changes in any of the package dependency/manifest files, scan the project for security vulnerabilities. Fixes should only be according to the desired version reported by the scanner. If the scanner reports a fix unrelated to our change, ignore it. After performing the fix, scan the project for security vulnerabilities again.This configuration will:
- Automatically trigger a security scan when any dependency file is modified
- Help identify vulnerabilities as soon as new dependencies are added
- Ensure your project stays secure throughout development
if you want to use the tool manually, you can use prompt the agent to use the tool with the following prompt through the composer interface:
Please scan my project for security vulnerabilities
Why MCP?
MCP (Model Context Protocol) exists to solve a fundamental problem in working with large language models (LLMs): how to efficiently and consistently connect these models to external data sources and tools.
Learn more at modelcontextprotocol.io.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Acknowledgments
- Model Context Protocol
- Trivy
- Cursor IDE
Quick Start
Clone the repository
git clone https://github.com/norbinsh/cursor-mcp-trivyInstall dependencies
cd cursor-mcp-trivy
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.