A yara based MCP Server
What is ThreatFlux YaraFlux
YaraFlux MCP Server
*
*
*
*
*
*
*
*
*
A Model Context Protocol (MCP) server for YARA scanning, providing LLMs with capabilities to analyze files with YARA rules.
๐ Overview
YaraFlux MCP Server enables AI assistants to perform YARA rule-based threat analysis through the standardized Model Context Protocol interface. The server integrates YARA scanning with modern AI assistants, supporting comprehensive rule management, secure scanning, and detailed result analysis through a modular architecture.
๐งฉ Architecture Overview
+------------------------------------------+
| AI Assistant |
+--------------------+---------------------+
|
| Model Context Protocol
|
+--------------------v---------------------+
| YaraFlux MCP Server |
| |
| +----------------+ +---------------+ |
| | MCP Server | | Tool Registry | |
| +-------+--------+ +-------+-------+ |
| | | |
| +-------v--------+ +-------v-------+ |
| | YARA Service | | Storage Layer | |
| +----------------+ +---------------+ |
| |
+------------------------------------------+
| |
+-----------------+ +---------------+
| YARA Engine | | Storage |
| - Rule Compiling| | - Local FS |
| - File Scanning | | - MinIO/S3 |
+-----------------+ +---------------+
YaraFlux follows a modular architecture that separates concerns between:
- MCP Integration Layer: Handles communication with AI assistants
- Tool Implementation Layer: Implements YARA scanning and management functionality
- Storage Abstraction Layer: Provides flexible storage options
- YARA Engine Integration: Leverages YARA for scanning and rule management
For detailed architecture diagrams, see the Architecture Documentation.
โจ Features
-
๐ Modular Architecture
- Clean separation of MCP integration, tool implementation, and storage
- Standardized parameter parsing and error handling
- Flexible storage backend with local and S3/MinIO options
-
๐ค MCP Integration
- 19 integrated MCP tools for comprehensive functionality
- Optimized for Claude Desktop integration
- Direct file analysis from within conversations
- Compatible with latest MCP protocol specification
-
๐ YARA Scanning
- URL and file content scanning
- Detailed match information with context
- Scan result storage and retrieval
- Performance-optimized scanning engine
-
๐ Rule Management
- Create, read, update, delete YARA rules
- Rule validation with detailed error reporting
- Import rules from ThreatFlux repository
- Categorization by source (custom vs. community)
-
๐ File Analysis
- Hexadecimal view for binary analysis
- String extraction with configurable parameters
- File metadata and hash information
- Secure file upload and storage
-
๐ Security Features
- JWT authentication for API access
- Non-root container execution
- Secure storage isolation
- Configurable access controls
๐ Quick Start
Using Docker Image
# Pull the latest Docker image
docker pull threatflux/yaraflux-mcp-server:latest
# Run the container
docker run -p 8000:8000 \
-e JWT_SECRET_KEY=your-secret-key \
-e ADMIN_PASSWORD=your-admin-password \
-e DEBUG=true \
threatflux/yaraflux-mcp-server:latest
### Using Docker building from source
```bash
# Clone the repository
git clone https://github.com/ThreatFlux/YaraFlux.git
cd YaraFlux/
# Build the Docker image
docker build -t yaraflux-mcp-server:latest .
# Run the container
docker run -p 8000:8000 \
-e JWT_SECRET_KEY=your-secret-key \
-e ADMIN_PASSWORD=your-admin-password \
-e DEBUG=true \
yaraflux-mcp-server:latest
Installation from Source
# Clone the repository
git clone https://github.com/ThreatFlux/YaraFlux.git
cd YaraFlux/
# Install dependencies (requires Python 3.13+)
make install
# Run the server
make run
๐งฉ Claude Desktop Integration
YaraFlux is designed for seamless integration with Claude Desktop through the Model Context Protocol.
- Build the Docker image:
docker build -t yaraflux-mcp-server:latest .
- Add to Claude Desktop config (
~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"yaraflux-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--env",
"JWT_SECRET_KEY=your-secret-key",
"--env",
"ADMIN_PASSWORD=your-admin-password",
"--env",
"DEBUG=true",
"--env",
"PYTHONUNBUFFERED=1",
"threatflux/yaraflux-mcp-server:latest"
],
"disabled": false,
"autoApprove": [
"scan_url",
"scan_data",
"list_yara_rules",
"get_yara_rule"
]
}
}
}
- Restart Claude Desktop to activate the server.
๐ ๏ธ Available MCP Tools
YaraFlux exposes 19 integrated MCP tools:
Rule Management Tools
- list_yara_rules: List available YARA rules with filtering options
- get_yara_rule: Get a specific YARA rule's content and metadata
- validate_yara_rule: Validate YARA rule syntax with detailed error reporting
- add_yara_rule: Create a new YARA rule
- update_yara_rule: Update an existing YARA rule
- delete_yara_rule: Delete a YARA rule
- import_threatflux_rules: Import rules from ThreatFlux GitHub repository
Scanning Tools
- scan_url: Scan content from a URL with specified YARA rules
- scan_data: Scan provided data (base64 encoded) with specified rules
- get_scan_result: Retrieve detailed results from a previous scan
File Management Tools
- upload_file: Upload a file for analysis or scanning
- get_file_info: Get metadata about an uploaded file
- list_files: List uploaded files with pagination and sorting
- delete_file: Delete an uploaded file
- extract_strings: Extract ASCII/Unicode strings from a file
- get_hex_view: Get hexadecimal view of file content
- download_file: Download an uploaded file
Storage Management Tools
- get_storage_info: Get storage usage statistics
- clean_storage: Remove old files to free up storage space
๐ Documentation
Comprehensive documentation is available in the docs/ directory:
- Architecture Diagrams - Visual representation of system architecture
- Code Analysis - Detailed code structure and recommendations
- Installation Guide - Detailed setup instructions
- CLI Usage Guide - Command-line interface documentation
- API Reference - REST API endpoints and usage
- YARA Rules Guide - Creating and managing YARA rules
- MCP Integration - Model Context Protocol integration details
- File Management - File handling capabilities
- Examples - Real-world usage examples
๐๏ธ Project Structure
yaraflux_mcp_server/
โโโ src/
โ โโโ yaraflux_mcp_server/
โ โโโ app.py # FastAPI application
โ โโโ auth.py # JWT authentication and user management
โ โโโ config.py # Configuration settings loader
โ โโโ models.py # Pydantic models for requests/responses
โ โโโ mcp_server.py # **MCP server** implementation
โ โโโ utils/ # Utility functions package
โ โ โโโ __init__.py # Package initialization
โ โ โโโ error_handling.py # Standardized error handling
โ โ โโโ param_parsing.py # Parameter parsing utilities
โ โ โโโ wrapper_generator.py # Tool wrapper generation
โ โโโ mcp_tools/ # Modular MCP tools package
โ โ โโโ __init__.py # Package initialization
โ โ โโโ base.py # Base tool registration utilities
โ โ โโโ file_tools.py # File management tools
โ โ โโโ rule_tools.py # YARA rule management tools
โ โ โโโ scan_tools.py # Scanning tools
โ โ โโโ storage_tools.py # Storage management tools
โ โโโ storage/ # Storage implementation package
โ โ โโโ __init__.py # Package initialization
โ โ โโโ base.py # Base storage interface
โ โ โโโ factory.py # Storage client factory
โ โ โโโ local.py # Local file[system](/mcp/category/system) storage
โ โ โโโ minio.py # MinIO/S3 storage
โ โโโ routers/ # API route definitions
โ โ โโโ __init__.py # Package initialization
โ โ โโโ auth.py # Authentication API routes
โ โ โโโ files.py # File management API routes
โ โ โโโ rules.py # YARA rule management API routes
โ โ โโโ scan.py # YARA scanning API routes
โ โโโ yara_service.py # YARA rule management and scanning
โ โโโ __init__.py # Package initialization
โ โโโ __main__.py # CLI entry point
โโโ docs/ # Documentation
โโโ tests/ # Test suite
โโโ Dockerfile # Docker configuration
โโโ entrypoint.sh # Container entrypoint script
โโโ Makefile # Build [automation](/mcp/category/automation)
โโโ pyproject.toml # Project metadata and dependencies
โโโ requirements.txt # Core dependencies
โโโ requirements-dev.txt # Development dependencies
๐งช Development
Local Development
# Set up development environment
make dev-setup
# Run tests
make test
# Code quality checks
make lint
make format
make security-check
# Generate test coverage report
make coverage
# Run development server
make run
CI/CD Workflows
This project uses GitHub Actions for continuous integration and deployment:
-
CI Tests: Runs on every push and pull request to main and develop branches
- Runs tests, formatting, linting, and type checking
- Builds and tests Docker images
- Uploads test coverage reports to Codecov
-
Version Auto-increment: Automatically increments version on pushes to main branch
- Updates version in pyproject.toml, setup.py, and Dockerfile
- Creates git tag for new version
-
Publish Release: Triggered after successful version auto-increment
- Builds Docker images for multiple stages
- Generates release notes from git commits
- Creates GitHub release with artifacts
- Publishes Docker images to Docker Hub
These workflows ensure code quality and automate the release process.
Status Checks
The following status checks run on pull requests:
- โ Format Verification: Ensures code follows Black and isort formatting standards
- โ Lint Verification: Validates code quality and compliance with coding standards
- โ Test Execution: Runs the full test suite to verify functionality
- โ Coverage Report: Ensures sufficient test coverage of the codebase
๐ API Documentation
Interactive API documentation available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
For detailed API documentation, see API Reference.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Donate or Ask for Features
- Patreon
- PayPal
Leave a Comment
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
chrisdoc hevy mcp
sylphlab pdf reader mcp
An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.
aashari mcp server atlassian bitbucket
Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.
aashari mcp server atlassian confluence
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.
prisma prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Zzzccs123 mcp sentry
mcp sentry for typescript sdk
zhuzhoulin dify mcp server
zhongmingyuan mcp my mac
zhixiaoqiang desktop image manager mcp
MCP ๆๅกๅจ๏ผ็จไบ็ฎก็ๆก้ขๅพ็ใๆฅ็่ฏฆๆ ใๅ็ผฉใ็งปๅจ็ญ๏ผๅฎๅ จ่ฎฉTraeๅฎ็ฐ๏ผ
zhixiaoqiang antd components mcp
An MCP service for Ant Design components query | ไธไธชๅๅฐ Ant Design ็ปไปถไปฃ็ ็ๆๅนป่ง็ MCP ๆๅก๏ผๅ ๅซ็ณป็ปๆ็คบ่ฏใ็ปไปถๆๆกฃใAPI ๆๆกฃใไปฃ็ ็คบไพๅๆดๆฐๆฅๅฟๆฅ่ฏข
Submit Your MCP Server
Share your MCP server with the community
Submit Now