Security Onion MCP Server
OfficialThis server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Security Onion MCP Server
This project contains the backend server for the Security Onion Model Context Protocol (MCP).
Prerequisites
Python 3.12+
Access to set environment variables
Related MCP server: Amazon Security Lake MCP Server
Environment Variables
The server uses the following environment variables:
SO_CLIENT_ID: Your Security Onion client IDSO_CLIENT_SECRET: Your Security Onion client secretSO_API_ENDPOINT: The URL of your Security Onion manager (e.g., https://yourmanager)SO_API_VERIFY_SSL: Set to "false" to disable SSL verification (useful for self-signed certificates).SO_CA_CERT: Optional path to a custom CA certificate file for TLS verification. If you are using a self-signed certificate on your Security Onion manager, provide the path to the CA certificate here.SO_ENABLE_FILE_LOGGING: Set to "true" to enable file logging to securityonion-mcp.log (disabled by default)
Setup and Running
Linux / macOS
Install Modules: Navigate to the project directory in your terminal and execute:
python -m venv venv source venv/bin/activate pip install -r requirements.txtThis will install the needed python modules
Windows
Install Modules: Navigate to the project directory in your command prompt and execute:
python -m venv venv venv\Scripts\activate pip install -r requirements.txtThis will install the needed python modules
Setup for Roo Code
Linux / macOS Configuration
{
"mcpServers": {
"securityonion": {
"command": "venv/bin/python",
"args": [
"security_onion_server.py"
],
"cwd": "/home/user/securityonion-mcp",
"env": {
"SO_CLIENT_ID": "YOURCLIENT",
"SO_CLIENT_SECRET": "YOURSECRET",
"SO_API_ENDPOINT": "https://yourmanager",
"SO_API_VERIFY_SSL": "true",
"SO_CA_CERT": "/path/to/your/ca.crt",
"SO_ENABLE_FILE_LOGGING": "false"
},
"syncTimeout": 10000,
"type": "stdio",
"alwaysAllow": [
"ping",
"query_events"
],
"disabled": false
}
}
}Windows Configuration
{
"mcpServers": {
"securityonion": {
"command": "venv\\Scripts\\python.exe",
"args": [
"security_onion_server.py"
],
"cwd": "C:\\Users\\user\\securityonion-mcp",
"env": {
"SO_CLIENT_ID": "YOURCLIENT",
"SO_CLIENT_SECRET": "YOURSECRET",
"SO_API_ENDPOINT": "https://yourmanager",
"SO_API_VERIFY_SSL": "true",
"SO_CA_CERT": "C:\\path\\to\\your\\ca.crt",
"SO_ENABLE_FILE_LOGGING": "false"
},
"syncTimeout": 10000,
"type": "stdio",
"alwaysAllow": [
"ping",
"query_events"
],
"disabled": true
}
}
}Integration with Claude Desktop
macOS Configuration
{
"mcpServers": {
"securityonion": {
"command": "/Users/user/Projects/securityonion-mcp/venv/bin/python",
"args": ["/Users/user/Projects/securityonion-mcp/security_onion_server.py"],
"env": {
"SO_CLIENT_ID": "YOURCLIENT",
"SO_CLIENT_SECRET": "YOURSECRET",
"SO_API_ENDPOINT": "https://yourmanager",
"SO_API_VERIFY_SSL": "true",
"SO_CA_CERT": "/path/to/your/ca.crt",
"SO_ENABLE_FILE_LOGGING": "false"
}
}
}
}Windows Configuration
{
"mcpServers": {
"securityonion": {
"command": "C:\\Users\\user\\Projects\\securityonion-mcp\\venv\\Scripts\\python.exe",
"args": ["C:\\Users\\user\\Projects\\securityonion-mcp\\security_onion_server.py"],
"env": {
"SO_CLIENT_ID": "YOURCLIENT",
"SO_CLIENT_SECRET": "YOURSECRET",
"SO_API_ENDPOINT": "https://yourmanager",
"SO_API_VERIFY_SSL": "true",
"SO_CA_CERT": "C:\\path\\to\\your\\ca.crt",
"SO_ENABLE_FILE_LOGGING": "false"
}
}
}
}This server communicates using the Model Context Protocol (MCP) over standard input/output (stdio), not via a network port. To use it with clients like Claude Desktop or Cline/Roo:
Ensure Prerequisites: Make sure Python 3.8+ is installed and accessible in the system's PATH, and that any required environment variables for
security_onion_server.pyare set appropriately for the environment where the client will launch the script.Configure Client: Configure your Claude Desktop or Cline/Roo instance to launch this server as a command-line process.
Use the appropriate configuration above for your operating system and access method
Ensure paths in the configuration match your actual installation directory
LLM Rules Integration
The project includes an LLMRULES.md file that contains a condensed reference for Onion Query Language (OQL). This file helps LLMs (Large Language Models) understand how to properly formulate OQL queries when interacting with the Security Onion MCP Server.
Integration with VSCode
To use these rules with Roo in VSCode:
Copy the rules to a special file:
cp LLMRULES.md .roorulesor
cp LLMRULES.md .clinerulesVerify the rules are loaded: When you start a conversation with Roo in VSCode, it will automatically load the rules from these files.
Integration with Claude Desktop
To use these rules with Claude Desktop:
Create a dedicated Security Onion query project: It's recommended to create a specific project in Claude Desktop dedicated to querying Security Onion:
Open Claude Desktop
Click the "+" button in the top-right corner
Select "Use a project"
Click "Create new project"
Name it "Security Onion Queries" or similar
Click "Create project"
Add the LLMRULES.md file to your project knowledge:
In your new project, click on the "Project" tab in the sidebar
Click on "Project knowledge"
Click "Add files" or drag and drop the LLMRULES.md file
This permanently adds the file to your project knowledge, making it available in all conversations within this project
Use the project for all Security Onion queries: Return to this project whenever you need to query Security Onion. The LLMRULES.md file will always be available in the project knowledge, so you don't need to upload it for each new conversation.
Playbook Feature
The Security Onion MCP Server includes a playbook feature that helps guide investigation of security alerts. When you have an alert:
The server retrieves playbooks associated with that alert type
Each playbook contains investigation questions designed to help analyze the incident
The questions include context, suggested sources, and time ranges for investigation
To use the playbook feature with the MCP tools:
Use
get_playbook_questionswith an alert ID to retrieve investigation questionsOptionally specify a playbook index to get questions from just one playbook
The LLM can then use the questions to build appropriate OQL queries based on the specific alert data
Event Payload Filtering
The Security Onion MCP Server filters event payloads to reduce context size when returning query results. This is important for:
Reducing Token Usage: By filtering out unnecessary fields, the server reduces the amount of data sent to LLM models, which helps optimize token usage and costs.
Focusing on Relevant Data: The filtering ensures that only the most relevant security event fields are included in responses, making it easier for models to analyze and respond to security events.
Default Fields
The server includes a predefined set of default fields in so_modules/config.py. These fields are used to filter event payloads to include only the most relevant security information.
To see the current list of default fields, please refer to the DEFAULT_FIELDS set in the so_modules/config.py file.
Customizing Fields
To add additional fields to the filtering:
Open
so_modules/config.pyLocate the
DEFAULT_FIELDSsetAdd your desired fields to the set
Restart the server for changes to take effect
For example, to add a new field:
DEFAULT_FIELDS = {
# Existing fields are already defined in the set
"your.new.field" # Add your custom field here
}Note that some fields like user.name and process.name are already included in the default set. Always check the current contents of DEFAULT_FIELDS in so_modules/config.py before adding new fields to avoid duplication.
Testing
The Security Onion MCP project maintains 100% test coverage to ensure code quality and reliability. This section provides comprehensive information about running tests for the project.
Test Environment Setup
Before running tests, you need to set up the test environment:
Create and Activate Virtual Environment:
# Linux/macOS python -m venv venv source venv/bin/activate # Windows python -m venv venv venv\Scripts\activateInstall Test Dependencies:
pip install -r requirements.txtThis installs all required dependencies, including pytest, pytest-mock, pytest-asyncio, pytest-cov, and pytest-env.
Running Tests
Basic Test Execution
To run all tests without coverage reporting:
python -m pytestRunning Tests with Coverage
To run tests with coverage reporting:
# Run tests with coverage for the entire project
source venv/bin/activate && python -m pytest --cov=. --cov-report=term-missingThis command:
Activates the virtual environment
Runs all tests
Generates coverage for the entire project (excluding venv, site-packages, and tests)
Displays a terminal report showing which lines are missing coverage
Coverage Report Options
The project supports various coverage report formats:
Terminal Report:
python -m pytest --cov=. --cov-report=termTerminal Report with Missing Lines:
python -m pytest --cov=. --cov-report=term-missingHTML Coverage Report:
python -m pytest --cov=. --cov-report=htmlThis generates an HTML report in the
htmlcovdirectory. Openhtmlcov/index.htmlin a browser to view the detailed coverage report.XML Coverage Report:
python -m pytest --cov=. --cov-report=xmlThis generates an XML report in
coverage.xml, which can be used with CI/CD tools.
Current Coverage Status
The project currently maintains 100% test coverage across all modules. This complete coverage ensures that all code paths are tested and verified to work as expected.
Test Structure and Organization
The tests are organized in the tests directory with the following structure:
Module-specific tests: Files named
test_<module_name>.pycontain tests for specific modules (e.g.,test_api.py,test_config.py)Coverage-specific tests: Files named
test_<module_name>_coverage.pycontain additional tests to ensure complete coverageIntegration tests: Tests that verify the integration between different components
Fixtures and configuration:
conftest.pycontains pytest fixtures and shared test utilities
The test configuration is defined in pytest.ini, which specifies:
Test discovery patterns
Coverage configuration
Exclusion patterns for coverage reporting
Prerequisites for Testing
To run the tests, you need:
Python 3.8 or higher
All dependencies listed in requirements.txt
A clean environment (tests are designed to run in isolation without external dependencies)
The test suite is designed to be self-contained and does not require an active connection to a Security Onion instance.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
SOAR security playbooks for AI agents: fetch, full-text search, and count. Metered via Stripe.
Ingest and search LogsLoom logs from coding agents.
List datasets, schemas, run APL queries, and use prompts for exploration, anomalies, and monitoring.
LLM Orchestration Observability Agent
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables LLMs to query and analyze logs from SEQ structured logging server with capabilities for searching events, retrieving event details, analyzing log patterns, and accessing saved searches.5MIT
- FlicenseNot gradedqualityNot gradedmaintenanceProvides structured access to OCSF-normalized security data stored in Amazon Security Lake, enabling AI assistants to search for IP addresses, GuardDuty findings, and explore available data sources.2-
- AlicenseNot gradedqualityDmaintenanceIntegrates SOAR (Security Orchestration, Automation and Response) capabilities into AI clients, enabling security playbook execution, event management, and threat intelligence queries. Provides a complete security incident response platform through natural language interactions.MIT
- AlicenseNot gradedqualityCmaintenanceEnables natural language threat hunting and incident response by connecting LLMs to enterprise security data sources like Elasticsearch, EVTX logs, PCAP files, and Velociraptor.30 PyPI204GPL 3.0