Skip to main content
Glama
VrilLabs

AlienSec MCP Server

by VrilLabs

AlienSec MCP Server

OpenSSF Scorecard

Production-Ready AlienVault OTX Endpoint Security Scanning MCP Server with VirusTotal Integration

License: MIT Node.js TypeScript MCP


Overview

The AlienSec MCP Server is a production-grade Model Context Protocol (MCP) server that provides comprehensive endpoint security scanning capabilities using AlienVault OTX with optional VirusTotal integration.

This server enables AI agents and applications to perform security scans on various endpoint types (macOS PKG, Windows PowerShell, Debian APT, Redhat RPM) and retrieve threat intelligence from AlienVault OTX and VirusTotal APIs.


Related MCP server: Velociraptor MCP Server

Features

Core Capabilities

  • Multi-Platform Endpoint Scanning

    • Scan macOS systems using PKG installer flavor

    • Scan Windows endpoints via PowerShell

    • Scan Debian/Ubuntu systems using APT

    • Scan Redhat/CentOS systems using RPM

  • VirusTotal Integration

    • Scan files and URLs using VirusTotal API

    • Retrieve existing analysis results

    • Automatic rate limiting and circuit breaker protection

    • Multiple API key support (respects VirusTotal ToS)

  • Threat Intelligence

    • Search AlienVault OTX pulses

    • Retrieve pulse details and events

    • Access indicators of compromise (IoCs)

  • Data Persistence

    • SQLite database with optional encryption

    • Scan result storage with timestamps

    • API request logging

    • Circuit breaker event tracking

  • Production-Ready Features

    • Comprehensive error handling

    • Structured logging with Pino

    • Environment variable validation with Zod

    • Type-safe API schemas

    • Graceful shutdown handling


Prerequisites

System Requirements

  • Node.js: >= 18.0.0

  • npm: >= 8.0.0

  • Operating System: macOS, Linux, or Windows

  • Disk Space: Minimum 100MB for dependencies

API Keys Required

  1. AlienVault OTX API Key (Required)

  2. VirusTotal API Key (Optional, for enhanced functionality)

    • Sign up at https://www.virustotal.com

    • Navigate to API Console

    • Generate API key(s)

    • Note: Free tier allows 500 requests/day, 4 requests/minute


Installation

1. Clone the Repository

git clone https://github.com/aliensec/aliensec-mcp-server.git
cd aliensec-mcp-server

2. Install Dependencies

npm install

This will install all production and development dependencies.

3. Configure Environment Variables

Copy the example environment file and update with your API keys:

cp .env.example .env

Edit .env with your API keys:

# Server Configuration
NAME=aliensec-mcp-server
VERSION=1.0.0
DEBUG=false
LOG_LEVEL=info

# AlienVault OTX Configuration (Required)
ALIENVAULT_API_KEY=your_alienvault_api_key_here
ALIENVAULT_BASE_URL=https://api.agent.otxb.io
ALIENVAULT_DEFAULT_REGION=us-east-1

# VirusTotal Configuration (Optional)
VIRUSTOTAL_API_KEYS=key1,key2,key3
VIRUSTOTAL_BASE_URL=https://www.virustotal.com/api/v3
VIRUSTOTAL_RATE_LIMIT_PER_MINUTE=4
VIRUSTOTAL_DAILY_LIMIT=500
VIRUSTOTAL_CIRCUIT_BREAKER_TIMEOUT=300

# Database Configuration
DATABASE_PATH=./data/aliensec.db
DATABASE_ENCRYPTION_KEY=your_encryption_key_here
DATABASE_TIMEOUT=5000

Note: VirusTotal ToS prohibits using multiple API keys to bypass rate limits. This implementation respects those limits and uses multiple keys for redundancy only.

4. (Optional) Install SQLite Encryption Dependencies

For encrypted database support on Linux/macOS:

# Ubuntu/Debian
sudo apt-get install build-essential

# macOS
xcode-select --install

Usage

Development Mode

Run the server in development mode with automatic reloading:

npm run dev

Production Mode

Build and run the server:

npm run build
npm start

Using with MCP Clients

The server communicates via stdio (standard input/output). To use it with an MCP client:

# Direct execution
node dist/index.js

# Or using the npm script
npm start

Example MCP Client Integration

import { McpClient } from '@modelcontextprotocol/client';

const client = new McpClient({
  command: 'node',
  args: ['dist/index.js'],
});

// Call a scan tool
const result = await client.invokeTool('scan_macos_pkg', {
  target: '192.168.1.100',
  useVirusTotal: true,
});

console.log(result);

Available Tools

Scan Tools (5)

Tool

Description

Parameters

scan_endpoint

Generic endpoint scanner

flavor, target, useVirusTotal, apiKeyIndex

scan_macos_pkg

Scan macOS PKG installer

target, useVirusTotal

scan_windows

Scan Windows endpoint

target, useVirusTotal

scan_debian_apt

Scan Debian/APT endpoint

target, useVirusTotal

scan_redhat_rpm

Scan Redhat/RPM endpoint

target, useVirusTotal

VirusTotal Tools (2)

Tool

Description

Parameters

use_virustotal

Scan resource with VirusTotal

resource, apiKeyIndex, wait

get_virustotal_analysis

Get existing VirusTotal analysis

hash, apiKeyIndex

AlienVault OTX Tools (4)

Tool

Description

Parameters

get_bootstrap_command

Get bootstrap command for flavor

flavor, target

get_bootstrap_urls

Get all bootstrap URLs

-

search_pulses

Search AlienVault OTX pulses

query, limit, offset

validate_api_key

Validate AlienVault API key

-

Database Tools (4)

Tool

Description

Parameters

get_scan_stats

Get scan statistics

-

get_recent_scans

Get recent scans

limit

get_circuit_breaker_stats

Get circuit breaker stats

-

get_api_stats

Get API statistics

-

System Tools (1)

Tool

Description

Parameters

get_health

Get server health status

-


Bootstrap Commands

The server provides pre-configured bootstrap commands for each endpoint flavor:

macOS PKG Installer

API_KEY=${env:ALIENVAULT_API_KEY} bash -c "$(curl -s https://api.agent.otxb.io/osquery-api-otx/bootstrap?flavor=pkg)"

Windows PowerShell

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; ${env:ALIENVAULT_API_KEY} (new-object Net.WebClient).DownloadString("https://api.agent.otxb.io/osquery-api-otx/bootstrap?flavor=powershell") | iex; install_agent -apikey ${env:ALIENVAULT_API_KEY}

Debian APT

API_KEY=${env:ALIENVAULT_API_KEY} bash -c "$(curl -s https://api.agent.otxb.io/osquery-api-otx/bootstrap?flavor=apt)"

Redhat RPM

API_KEY=${env:ALIENVAULT_API_KEY} bash -c "$(curl -s https://api.agent.otxb.io/osquery-api-otx/bootstrap?flavor=rpm)"

Project Structure

aliensec-mcp-server/
├── src/
│   ├── config/
│   │   └── index.ts           # Environment configuration & validation
│   ├── core/
│   │   ├── alienVault.ts      # AlienVault OTX API client
│   │   └── virusTotal.ts      # VirusTotal API client
│   ├── database/
│   │   └── index.ts           # SQLite database with repositories
│   ├── types/
│   │   └── index.ts           # TypeScript type definitions
│   └── index.ts               # Main MCP server entry point
├── package.json
├── tsconfig.json
├── .env.example
├── .gitignore
├── .eslintrc.json
├── .prettierrc
└── README.md

Architecture

Layered Design

┌─────────────────────────────────────┐
│           MCP Server Layer           │  ← src/index.ts
├─────────────────────────────────────┤
│         Core Service Layer           │  ← src/core/
├─────────────────────────────────────┤
│         Data Access Layer            │  ← src/database/
├─────────────────────────────────────┤
│        Configuration Layer           │  ← src/config/
├─────────────────────────────────────┤
│           Type Definitions           │  ← src/types/
└─────────────────────────────────────┘

Key Design Patterns

  1. Singleton Pattern: Database, AlienVault client, VirusTotal client

  2. Repository Pattern: ScanRepository, CircuitBreakerRepository, APILogRepository

  3. Circuit Breaker Pattern: Automatic API key rotation on failures

  4. Token Bucket Rate Limiter: Rate limiting for VirusTotal API

  5. Factory Pattern: MCP server creation with dependency injection

  6. Strategy Pattern: Different scan flavors with common interface


Database Schema

The server uses SQLite with the following tables:

scan_records

Stores all scan results with findings, VirusTotal data, and timestamps.

circuit_breaker_events

Tracks circuit breaker state changes for API keys.

api_logs

Logs all API requests with response times, status codes, and errors.

schema_version

Tracks database schema version for migrations.


Error Handling

Custom Error Classes

  • AlienSecError: Base error class with code and statusCode

  • AlienVaultAPIError: AlienVault-specific errors

  • VirusTotalAPIError: VirusTotal-specific errors with rate limit detection

  • DatabaseError: Database-related errors

  • ConfigurationError: Configuration validation errors

Error Response Format

All errors return structured responses:

{
  "isError": true,
  "error": {
    "message": "Error description",
    "code": "ERROR_CODE",
    "context": { ... }
  }
}

Logging

The server uses Pino for structured logging with the following levels:

  • error: Critical failures

  • warn: Warnings and potential issues

  • info: Normal operations and status updates

  • debug: Detailed debugging information

  • trace: Very verbose logging for development

Logs are automatically redacted to prevent sensitive data (API keys) from being logged.


Rate Limiting & Circuit Breaker

VirusTotal Rate Limiting

  • Token Bucket Algorithm: Smooth rate limiting

  • Configurable Limits: Set via environment variables

  • Automatic Wait: Option to wait when rate limited

  • Circuit Breaker: Automatically blocks API keys that fail repeatedly

Circuit Breaker Configuration

  • Failure Threshold: 5 consecutive failures

  • Reset Timeout: 300 seconds (5 minutes)

  • Half-Open State: Test with 1 request before fully reopening

ToS Compliance

The implementation respects VirusTotal's Terms of Service:

  • Multiple API keys are for redundancy, not for bypassing limits

  • Each API key respects individual rate limits

  • Circuit breaker prevents rapid retries on failures

  • Daily request counting prevents quota exhaustion


Development

Running Tests

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run with coverage
npx vitest run --coverage

Linting & Formatting

# Run linting
npm run lint

# Auto-fix linting issues
npm run lint:fix

# Format code
npm run format

Type Checking

npm run typecheck

Build Verification

# Clean build
npm run clean
npm run build

# Check build output
ls -la dist/

Environment Variables

Variable

Required

Default

Description

ALIENVAULT_API_KEY

Yes

-

AlienVault OTX API key

ALIENVAULT_BASE_URL

No

https://api.agent.otxb.io

AlienVault API base URL

ALIENVAULT_DEFAULT_REGION

No

us-east-1

Default region for agents

VIRUSTOTAL_API_KEYS

No

``

Comma-separated VirusTotal API keys

VIRUSTOTAL_BASE_URL

No

https://www.virustotal.com/api/v3

VirusTotal API base URL

VIRUSTOTAL_RATE_LIMIT_PER_MINUTE

No

4

Rate limit per minute

VIRUSTOTAL_DAILY_LIMIT

No

500

Daily request limit

VIRUSTOTAL_CIRCUIT_BREAKER_TIMEOUT

No

300

Circuit breaker timeout (seconds)

DATABASE_PATH

No

./data/aliensec.db

SQLite database path

DATABASE_ENCRYPTION_KEY

No

-

Database encryption key

DATABASE_TIMEOUT

No

5000

Database connection timeout

NAME

No

aliensec-mcp-server

Server name

VERSION

No

1.0.0

Server version

DEBUG

No

false

Enable debug mode

LOG_LEVEL

No

info

Log level (error, warn, info, debug, trace)


Security Considerations

Data Protection

  1. Database Encryption: Use DATABASE_ENCRYPTION_KEY for encrypting sensitive data at rest

  2. API Key Security: API keys are never logged; use environment variables or secure vaults

  3. Memory Safety: Sensitive strings are hashed (SHA-256) before storage in circuit breaker and API log tables

Network Security

  1. HTTPS Only: All API communication uses HTTPS

  2. Certificate Validation: TLS certificate validation is enabled by default

  3. User-Agent: Custom user agent identifies the server version

Rate Limiting

  1. Client-Side Rate Limiting: Prevents overwhelming external APIs

  2. Circuit Breaker: Prevents cascading failures

  3. Backpressure: Automatic waiting when rate limited


Performance

Optimizations

  • Connection Pooling: Database connections are reused

  • Lazy Loading: Repositories are created on-demand

  • Indexed Queries: Database tables have appropriate indexes

  • Caching: API key hashes are cached for circuit breaker checks

  • Async/Await: Non-blocking I/O operations

Benchmarks

  • Scan Request: ~100-500ms (simulated)

  • VirusTotal Request: ~200-1000ms (network dependent)

  • Database Operations: <10ms (local SQLite)


Troubleshooting

Common Issues

Database Connection Failed

Error: Failed to connect to database

Solution: Ensure the data directory exists and has write permissions:

mkdir -p data
chmod 755 data

Missing ALIENVAULT_API_KEY

Missing required environment variables:
  - ALIENVAULT_API_KEY

Solution: Set the environment variable:

export ALIENVAULT_API_KEY=your_api_key_here
# or add to .env file

VirusTotal Rate Limit Exceeded

Error: Rate limit exceeded for API key 0

Solution:

  • Wait for the rate limit to reset (default: 4 requests/minute)

  • Add more API keys (comma-separated in VIRUSTOTAL_API_KEYS)

  • Use wait: true parameter to automatically wait

Circuit Breaker Open

Error: API key 0 is blocked by circuit breaker

Solution: Wait for the circuit breaker timeout to expire (default: 5 minutes). The circuit will automatically reopen after the timeout.

Debug Mode

Enable debug logging for detailed troubleshooting:

DEBUG=true LOG_LEVEL=debug npm run dev

Contributing

Pull Requests

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

Commit Message Guidelines

  • Use Conventional Commits format

  • Prefix with type: feat:, fix:, docs:, style:, refactor:, test:, chore:

  • Keep subject line under 72 characters

  • Provide detailed description in body if needed

Code Review

  • All PRs require approval from at least one maintainer

  • CI/CD pipeline must pass (lint, typecheck, tests)

  • Code must follow existing patterns and style


License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments


References


Built with ❤️ for the security community

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Provides AI agents with 37 OSINT tools and 12 data sources to perform unified reconnaissance, domain analysis, and attack surface mapping. It enables agents to query, correlate, and reason across platforms like Shodan, VirusTotal, and Censys in parallel.
    37
    803
    41
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Enables AI agents to interface with Velociraptor for digital forensics and incident response tasks, including file/memory scans, remediation actions, and artifact collection across multiple operating systems.
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Enables AI agents to scan code for security vulnerabilities using multiple static analysis tools, with support for filtering, deduplication, and CI/CD integration.
    27
    2
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/VrilLabs/aliensec-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server