
TheHive
STDIOMCP server connecting AI assistants to TheHive incident response platform for security operations.
MCP server connecting AI assistants to TheHive incident response platform for security operations.
An MCP (Model Context Protocol) server that provides AI models and automation tools with access to TheHive incident response platform.
This server acts as a bridge between MCP clients (like AI assistants) and TheHive, allowing them to:
get_thehive_alerts - Retrieve a list of alerts from TheHive
limit
parameter (default: 100)get_thehive_alert_by_id - Get detailed information about a specific alert
alert_id
parameterget_thehive_cases - Retrieve a list of cases from TheHive
limit
parameter (default: 100)get_thehive_case_by_id - Get detailed information about a specific case
case_id
parameterpromote_alert_to_case - Promote an alert to a case
alert_id
parametercreate_thehive_case - Create a new case in TheHive
title
and description
parametersseverity
, tags
, tlp
, pap
, status
, assignee
, case_template
, start_date
You can download pre-compiled binaries for various operating systems from the GitHub Releases page. Download the appropriate binary for your system, make it executable, and place it in your desired location.
git clone <repository-url> cd mcp-server-thehive cargo build --release
The server requires the following environment variables:
THEHIVE_URL
- TheHive API base URL (default: http://localhost:9000/api
)THEHIVE_API_TOKEN
- TheHive API token (required)VERIFY_SSL
- Whether to verify SSL certificates (default: false
)RUST_LOG
- Logging level (optional, e.g., debug
, info
)Create a .env
file in the project root:
THEHIVE_URL=https://your-thehive-instance.com/api THEHIVE_API_TOKEN=your-api-token-here VERIFY_SSL=true RUST_LOG=info
THEHIVE_API_TOKEN
# Using cargo cargo run # Using the built binary ./target/release/mcp-server-thehive
The server communicates over stdio using the MCP protocol. Configure your MCP client to use this server:
{ "mcpServers": { "thehive": { "command": "/path/to/mcp-server-thehive", "env": { "THEHIVE_URL": "https://your-thehive-instance.com:9000/api", "THEHIVE_API_TOKEN": "your-api-token-here" } } } }
{ "method": "tools/call", "params": { "name": "get_thehive_alerts", "arguments": { "limit": 10 } } }
{ "method": "tools/call", "params": { "name": "get_thehive_alert_by_id", "arguments": { "alert_id": "~123456" } } }
{ "method": "tools/call", "params": { "name": "promote_alert_to_case", "arguments": { "alert_id": "~123456" } } }
{ "method": "tools/call", "params": { "name": "create_thehive_case", "arguments": { "title": "Potential Malware Outbreak", "description": "Multiple endpoints reporting suspicious process activity.", "severity": 3, "tags": ["malware", "endpoint", "epp"], "tlp": 2, "assignee": "soc_level2" } } }
mcp-server-thehive/
├── src/
│ ├── main.rs # Main server implementation
│ ├── lib.rs # Library exports
│ └── thehive/
│ ├── mod.rs # Module declarations
│ ├── client.rs # TheHive API client
│ └── error.rs # Error types
├── tests/
│ ├── bin/
│ │ └── mock_thehive_server.rs # Mock TheHive API server for testing
│ ├── integration_test.rs # Integration tests
│ └── mcp_stdio_test.rs # Stdio interface tests
├── Cargo.toml # Dependencies and metadata
└── README.md # This file
The project includes a comprehensive suite of integration tests that leverage a mock TheHive server. This mock server simulates the TheHive API, allowing for isolated and repeatable testing of the MCP server's functionality without requiring a live TheHive instance.
Running Tests:
# Run all tests (including integration tests that use the mock server) cargo test # Run tests with verbose logging (includes MCP server and mock server logs) RUST_LOG=debug MCP_SERVER_THEHIVE_VERBOSE_TEST_LOGS=true cargo test
Connection Refused
THEHIVE_URL
is correctAuthentication Failed
THEHIVE_API_TOKEN
is correct and not expiredSSL Certificate Errors
VERIFY_SSL=false
for testing (not recommended for production)Enable debug logging for troubleshooting:
RUST_LOG=debug cargo run
This project is licensed under the MIT License - see the LICENSE file for details.