AlienSec MCP Server
AlienSec MCP 服务器
生产就绪的 AlienVault OTX 端点安全扫描 MCP 服务器,集成 VirusTotal
// 为安全社区精心打造 — 资金支持维持其持续维护
概述
AlienSec MCP 服务器 是一个生产级模型上下文协议(MCP)服务器,使用 AlienVault OTX 提供全面的端点安全扫描能力,并可选集成 VirusTotal。
该服务器使 AI 代理和应用程序能够对各种端点类型(macOS PKG、Windows PowerShell、Debian APT、Redhat RPM)执行安全扫描,并从 AlienVault OTX 和 VirusTotal API 获取威胁情报。
Related MCP server: Velociraptor MCP Server
功能特性
核心能力
多平台端点扫描
使用 PKG 安装程序风格扫描 macOS 系统
通过 PowerShell 扫描 Windows 端点
使用 APT 扫描 Debian/Ubuntu 系统
使用 RPM 扫描 Redhat/CentOS 系统
VirusTotal 集成
使用 VirusTotal API 扫描文件和 URL
获取现有分析结果
自动限流和熔断器保护
多 API 密钥支持(遵守 VirusTotal 服务条款)
威胁情报
搜索 AlienVault OTX pulses
获取 pulse 详情和事件
访问失陷指标(IoCs)
数据持久化
SQLite 数据库,支持可选加密
带时间戳的扫描结果存储
API 请求日志记录
熔断器事件跟踪
生产就绪特性
全面的错误处理
使用 Pino 的结构化日志
使用 Zod 的环境变量验证
类型安全的 API 模式
优雅关闭处理
前置要求
系统要求
Node.js:>= 22.0.0
npm:>= 8.0.0
操作系统:macOS、Linux 或 Windows
磁盘空间:依赖项至少需要 100MB
所需 API 密钥
AlienVault OTX API 密钥(必需)
导航至 设置 > API 密钥
生成新的 API 密钥
VirusTotal API 密钥(可选,用于增强功能)
导航至 API 控制台
生成 API 密钥
注意:免费版允许每天 500 次请求,每分钟 4 次请求
安装
1. 克隆仓库
git clone https://github.com/VRIL-LABS/aliensec-mcp-server.git
cd aliensec-mcp-server2. 安装依赖
npm install这将安装所有生产和开发依赖。
3. 配置环境变量
复制示例环境文件并使用你的 API 密钥进行更新:
cp .env.example .env使用你的 API 密钥编辑 .env:
# 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注意:VirusTotal 服务条款禁止使用多个 API 密钥绕过速率限制。本实现遵守这些限制,仅将多个密钥用于冗余目的。
4.(可选)安装 SQLite 加密依赖
在 Linux/macOS 上启用加密数据库支持:
# Ubuntu/Debian
sudo apt-get install build-essential
# macOS
xcode-select --install使用方法
开发模式
在开发模式下运行服务器,支持自动重载:
npm run dev生产模式
构建并运行服务器:
npm run build
npm start与 MCP 客户端配合使用
服务器通过 stdio(标准输入/输出)进行通信。要将其与 MCP 客户端配合使用:
# Direct execution
node dist/index.js
# Or using the npm script
npm startMCP 客户端集成示例
import { Client } from '@modelcontextprotocol/client';
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
const client = new Client({ name: 'my-client', version: '1.0.0' });
const transport = new StdioClientTransport({
command: 'node',
args: ['dist/index.js'],
});
await client.connect(transport);
// Call a scan tool
const result = await client.callTool({
name: 'scan_macos_pkg',
arguments: {
target: '192.168.1.100',
useVirusTotal: true,
},
});
console.log(result.content);可用工具
扫描工具(5 个)
工具 | 描述 | 参数 |
| 通用端点扫描器 |
|
| 扫描 macOS PKG 安装程序 |
|
| 扫描 Windows 端点 |
|
| 扫描 Debian/APT 端点 |
|
| 扫描 Redhat/RPM 端点 |
|
VirusTotal 工具(2 个)
工具 | 描述 | 参数 |
| 使用 VirusTotal 扫描资源 |
|
| 获取现有 VirusTotal 分析结果 |
|
AlienVault OTX 工具(3 个)
工具 | 描述 | 参数 |
| 获取指定风格的引导命令 |
|
| 获取所有引导 URL | - |
| 搜索 AlienVault OTX pulses |
|
数据库工具(4 个)
工具 | 描述 | 参数 |
| 获取扫描统计信息 | - |
| 获取最近的扫描记录 |
|
| 获取熔断器统计信息 | - |
| 获取 API 统计信息 | - |
系统工具(1 个)
工具 | 描述 | 参数 |
| 获取服务器健康状态 | - |
引导命令
服务器为每种端点风格提供预配置的引导命令。下面的 <api-key> 是你解析后的 ALIENVAULT_API_KEY 值,TARGET=<target> 仅在提供了 target 时包含。
macOS PKG 安装程序
API_KEY=<api-key> [TARGET=<target>] 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; API_KEY=<api-key> (new-object Net.WebClient).DownloadString("https://api.agent.otxb.io/osquery-api-otx/bootstrap?flavor=powershell") | iex; install_agent -apikey <api-key> [-target <target>]Debian APT
API_KEY=<api-key> [TARGET=<target>] bash -c "$(curl -s https://api.agent.otxb.io/osquery-api-otx/bootstrap?flavor=apt)"Redhat RPM
API_KEY=<api-key> [TARGET=<target>] bash -c "$(curl -s https://api.agent.otxb.io/osquery-api-otx/bootstrap?flavor=rpm)"项目结构
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
├── eslint.config.js
├── .prettierrc
└── README.md架构
分层设计
┌─────────────────────────────────────┐
│ MCP Server Layer │ ← src/index.ts
├─────────────────────────────────────┤
│ Core Service Layer │ ← src/core/
├─────────────────────────────────────┤
│ Data Access Layer │ ← src/database/
├─────────────────────────────────────┤
│ Configuration Layer │ ← src/config/
├─────────────────────────────────────┤
│ Type Definitions │ ← src/types/
└─────────────────────────────────────┘关键设计模式
单例模式:数据库、AlienVault 客户端、VirusTotal 客户端
仓储模式:ScanRepository、CircuitBreakerRepository、APILogRepository
熔断器模式:失败时自动轮换 API 密钥
令牌桶限流器:VirusTotal API 的速率限制
工厂模式:通过依赖注入创建 MCP 服务器
策略模式:不同扫描风格使用公共接口
数据库模式
服务器使用 SQLite,包含以下表:
scan_records
存储所有扫描结果,包括发现项、VirusTotal 数据和时间戳。
circuit_breaker_events
跟踪 API 密钥的熔断器状态变化。
api_logs
记录所有 API 请求,包括响应时间、状态码和错误。
schema_version
跟踪数据库模式版本以进行迁移。
错误处理
自定义错误类
AlienSecError:带代码和 statusCode 的基础错误类
AlienVaultAPIError:AlienVault 特定错误
VirusTotalAPIError:VirusTotal 特定错误,带速率限制检测
DatabaseError:数据库相关错误
ConfigurationError:配置验证错误
错误响应格式
工具错误返回标准 MCP 结果形状,其中 isError: true。人类可读的消息是第一个内容块;error 携带触发失败的 JSON 字符串化上下文数据(扫描 ID、flavor、target 等):
{
"content": [
{ "type": "text", "text": "Scan failed: <error message>" }
],
"isError": true,
"error": "{\n \"scanId\": \"...\",\n \"flavor\": \"pkg\",\n \"target\": \"...\",\n \"error\": \"<error message>\"\n}"
}日志记录
服务器使用 Pino 进行结构化日志记录,包含以下级别:
error:严重故障
warn:警告和潜在问题
info:正常操作和状态更新
debug:详细的调试信息
trace:用于开发的高度详细日志
日志会自动进行脱敏处理,防止敏感数据(API 密钥)被记录。
速率限制与熔断器
VirusTotal 速率限制
令牌桶算法:平滑速率限制
可配置限制:通过环境变量设置
自动等待:遇到速率限制时可选择等待
熔断器:自动阻止反复失败的 API 密钥
熔断器配置
失败阈值:连续 5 次失败
重置超时:300 秒(5 分钟)
半开状态:完全重新打开前用 1 个请求进行测试
服务条款合规性
本实现遵守 VirusTotal 的服务条款:
多个 API 密钥用于冗余,而非绕过限制
每个 API 密钥遵守各自的速率限制
熔断器防止失败时快速重试
每日请求计数防止配额耗尽
开发
运行测试
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run with coverage
npx vitest run --coverage代码检查与格式化
# Run linting
npm run lint
# Auto-fix linting issues
npm run lint:fix
# Format code
npm run format类型检查
npm run typecheck构建验证
# Clean build
npm run clean
npm run build
# Check build output
ls -la dist/环境变量
变量 | 必需 | 默认值 | 描述 |
| 是 | - | AlienVault OTX API 密钥 |
| 否 |
| AlienVault API 基础 URL |
| 否 |
| 代理的默认区域 |
| 否 | `` | 逗号分隔的 VirusTotal API 密钥 |
| 否 |
| VirusTotal API 基础 URL |
| 否 |
| 每分钟速率限制 |
| 否 |
| 每日请求限制 |
| 否 |
| 熔断器超时时间(秒) |
| 否 |
| SQLite 数据库路径 |
| 否 | - | 数据库加密密钥 |
| 否 |
| 数据库连接超时时间 |
| 否 |
| 服务器名称 |
| 否 |
| 服务器版本 |
| 否 |
| 启用调试模式 |
| 否 |
| 日志级别(error、warn、info、debug、trace) |
安全注意事项
数据保护
数据库加密:使用
DATABASE_ENCRYPTION_KEY对静态敏感数据进行加密API 密钥安全:API 密钥绝不会被记录到日志中;请使用环境变量或安全保管库
内存安全:敏感字符串在存储到熔断器和 API 日志表之前,会使用 PBKDF2(120,000 次迭代)进行哈希处理
网络安全
仅限 HTTPS:所有 API 通信均使用 HTTPS
证书验证:默认启用 TLS 证书验证
User-Agent:自定义用户代理标识服务器版本
速率限制
客户端速率限制:防止压垮外部 API
熔断器:防止级联故障
背压:速率受限时自动等待
性能
优化
连接池:数据库连接被复用
懒加载:仓库按需创建
索引查询:数据库表具有适当的索引
缓存:API 密钥哈希被缓存以供熔断器检查使用
异步/等待:非阻塞 I/O 操作
基准测试
扫描请求:约 100-500 毫秒(模拟)
VirusTotal 请求:约 200-1000 毫秒(取决于网络)
数据库操作:<10 毫秒(本地 SQLite)
故障排除
常见问题
数据库连接失败
Error: Failed to connect to database解决方案:确保数据目录存在并具有写入权限:
mkdir -p data
chmod 755 data缺少 ALIENVAULT_API_KEY
Missing required environment variables:
- ALIENVAULT_API_KEY解决方案:设置环境变量:
export ALIENVAULT_API_KEY=your_api_key_here
# or add to .env file超出 VirusTotal 速率限制
Error: Rate limit exceeded for API key 0解决方案:
等待速率限制重置(默认:4 次请求/分钟)
添加更多 API 密钥(在 VIRUSTOTAL_API_KEYS 中以逗号分隔)
使用
wait: true参数自动等待
熔断器打开
Error: API key 0 is blocked by circuit breaker解决方案:等待熔断器超时到期(默认:5 分钟)。超时后熔断器将自动重新闭合。
调试模式
启用调试日志以进行详细排查:
DEBUG=true LOG_LEVEL=debug npm run dev贡献指南
拉取请求
Fork 仓库
创建功能分支(
git checkout -b feature/amazing-feature)提交更改(
git commit -m 'Add amazing feature')推送到分支(
git push origin feature/amazing-feature)打开拉取请求
提交信息规范
使用 Conventional Commits 格式
使用类型前缀:
feat:、fix:、docs:、style:、refactor:、test:、chore:主题行保持在 72 个字符以内
如有需要,在正文中提供详细描述
代码审查
所有 PR 需要至少一位维护者的批准
CI/CD 流水线必须通过(lint、类型检查、测试)
代码必须遵循现有模式和风格
许可证
本项目采用 MIT 许可证 授权 - 详情请参阅 LICENSE 文件。
致谢
Model Context Protocol:https://modelcontextprotocol.io
AlienVault OTX:https://otx.alienvault.com
VirusTotal:https://www.virustotal.com
TypeScript:https://www.typescriptlang.org
better-sqlite3-multiple-ciphers:https://github.com/m4heshd/better-sqlite3-multiple-ciphers
参考资料
为安全社区倾心打造 ❤️
This server cannot be installed
Maintenance
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
- AlicenseAqualityCmaintenanceProvides 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.3768144MIT
- AlicenseNot gradedqualityDmaintenanceEnables 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.1MIT
- AlicenseAqualityAmaintenanceEnables AI agents to scan code for security vulnerabilities using multiple static analysis tools, with support for filtering, deduplication, and CI/CD integration.272MIT
- AlicenseAqualityBmaintenanceEnables assistants to analyze files and URLs for malware by integrating with security services like VirusTotal and ANY.RUN, returning threat reports.20MIT
Related MCP Connectors
Real-time threat intel for AI agents: 890K+ IOCs incl. prompt-injection & AI-skill threats
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/VRIL-LABS/aliensec-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server