MCP Server for TheHive

MCP Server for TheHive

Connect AI-powered automation tools to TheHive incident response platform via MCP.

11
Stars
3
Forks
11
Watchers
1
Issues
MCP Server for TheHive enables AI models and automation clients to interact with TheHive incident response platform using the Model Context Protocol. It provides tools to retrieve and analyze security alerts, manage cases, and automate incident response operations. The server facilitates seamless integration by exposing these functionalities over the standardized MCP protocol through stdio communication. It offers both pre-compiled binaries and a source build option with flexible configuration for connecting to TheHive instances.

Key Features

Retrieve security alerts from TheHive
Access detailed alert and case information
Promote alerts to cases
Create new incident cases with custom parameters
Integration via Model Context Protocol (MCP) over stdio
Configurable with environment variables and .env files
Supports API token-based authentication for TheHive
Pre-compiled binaries and source build available
Logging control with RUST_LOG
JSON-based tool call interface

Use Cases

Automating security alert triage and response
Providing AI assistants with access to TheHive incidents
Integrating TheHive with external automation platforms
Retrieving and analyzing recent security alerts programmatically
Promoting actionable alerts to full cases automatically
Generating new incident cases from automated investigations
Streamlining context extraction for model-driven workflows
Centralizing incident management for cybersecurity teams
Facilitating SOC operations through standardized protocol communication
Enabling seamless security workflow integration across tools

README

MCP Server for TheHive

An MCP (Model Context Protocol) server that provides AI models and automation tools with access to TheHive incident response platform.

Overview

This server acts as a bridge between MCP clients (like AI assistants) and TheHive, allowing them to:

  • Retrieve and analyze security alerts
  • Access case information
  • Promote alerts to cases
  • Perform incident response operations

Features

Available Tools

  1. get_thehive_alerts - Retrieve a list of alerts from TheHive

    • Optional limit parameter (default: 100)
    • Returns formatted alert information including ID, title, severity, and status
  2. get_thehive_alert_by_id - Get detailed information about a specific alert

    • Required alert_id parameter
    • Returns comprehensive alert details
  3. get_thehive_cases - Retrieve a list of cases from TheHive

    • Optional limit parameter (default: 100)
    • Returns formatted case information
  4. get_thehive_case_by_id - Get detailed information about a specific case

    • Required case_id parameter
    • Returns comprehensive case details
  5. promote_alert_to_case - Promote an alert to a case

    • Required alert_id parameter
    • Returns information about the newly created case
  6. create_thehive_case - Create a new case in TheHive

    • Required title and description parameters
    • Optional parameters: severity, tags, tlp, pap, status, assignee, case_template, start_date
    • Returns information about the newly created case

Installation

Prerequisites

  • Access to a TheHive 5 instance
  • Valid TheHive API token

Downloading Pre-compiled Binaries

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.

Building from Source

bash
git clone <repository-url>
cd mcp-server-thehive
cargo build --release

Configuration

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)

Environment File

Create a .env file in the project root:

env
THEHIVE_URL=https://your-thehive-instance.com/api
THEHIVE_API_TOKEN=your-api-token-here
VERIFY_SSL=true
RUST_LOG=info

Getting a TheHive API Token

  1. Log into your TheHive instance
  2. Go to User SettingsAPI Keys
  3. Click Create API Key
  4. Copy the generated token and use it as THEHIVE_API_TOKEN

Usage

Running the Server

bash
# Using cargo
cargo run

# Using the built binary
./target/release/mcp-server-thehive

Integration with MCP Clients

The server communicates over stdio using the MCP protocol. Configure your MCP client to use this server:

json
{
  "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"
      }
    }
  }
}

Examples

Retrieving Recent Alerts

json
{
  "method": "tools/call",
  "params": {
    "name": "get_thehive_alerts",
    "arguments": {
      "limit": 10
    }
  }
}

Getting Alert Details

json
{
  "method": "tools/call",
  "params": {
    "name": "get_thehive_alert_by_id",
    "arguments": {
      "alert_id": "~123456"
    }
  }
}

Promoting an Alert to Case

json
{
  "method": "tools/call",
  "params": {
    "name": "promote_alert_to_case",
    "arguments": {
      "alert_id": "~123456"
    }
  }
}

Creating a New Case

json
{
  "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"
    }
  }
}

Development

Project Structure

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

Dependencies

  • rmcp - MCP protocol implementation
  • thehive-client - TheHive API client library
  • tokio - Async runtime
  • reqwest - HTTP client
  • serde - Serialization framework
  • tracing - Logging and instrumentation

Testing

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:

bash
# 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

Security Considerations

  • Store API tokens securely (use environment variables or secure credential stores)
  • Never commit API tokens to version control
  • Enable SSL verification in production environments
  • Limit network access to TheHive instance
  • Use least-privilege API tokens for TheHive access
  • Monitor and log all API interactions
  • Rotate API tokens regularly

Troubleshooting

Common Issues

  1. Connection Refused

    • Verify THEHIVE_URL is correct
    • Check network connectivity to TheHive instance
    • Ensure TheHive is running and accessible
  2. Authentication Failed

    • Verify THEHIVE_API_TOKEN is correct and not expired
    • Check if the API token has necessary permissions
    • Ensure the token is properly formatted
  3. SSL Certificate Errors

    • Set VERIFY_SSL=false for testing (not recommended for production)
    • Install proper SSL certificates
    • Use valid certificate authority

Logging

Enable debug logging for troubleshooting:

bash
RUST_LOG=debug cargo run

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

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

Related Projects

Star History

Star History Chart

Repository Owner

gbrigandi
gbrigandi

User

Repository Details

Language Rust
Default Branch main
Size 29 KB
Contributors 1
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Rust
98.83%
Dockerfile
1.17%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • Make MCP Server (legacy)

    Make MCP Server (legacy)

    Enable AI assistants to utilize Make automation workflows as callable tools.

    Make MCP Server (legacy) provides a Model Context Protocol (MCP) server that connects AI assistants with Make scenarios configured for on-demand execution. It parses and exposes scenario parameters, allowing AI systems to invoke automation workflows and receive structured JSON outputs. The server supports secure integration through API keys and facilitates seamless communication between AI and Make's automation platform.

    • 142
    • MCP
    • integromat/make-mcp-server
  • Teamwork MCP Server

    Teamwork MCP Server

    Seamless Teamwork.com integration for Large Language Models via the Model Context Protocol

    Teamwork MCP Server is an implementation of the Model Context Protocol (MCP) that enables Large Language Models to interact securely and programmatically with Teamwork.com. It offers standardized interfaces, including HTTP and STDIO, allowing AI agents to perform various project management operations. The server supports multiple authentication methods, an extensible toolset architecture, and is designed for production deployments. It provides read-only capability for safe integrations and robust observability features.

    • 11
    • MCP
    • Teamwork/mcp
  • GitHub MCP Server

    GitHub MCP Server

    Connect AI tools directly to GitHub for repository, issue, and workflow management via natural language.

    GitHub MCP Server enables AI tools such as agents, assistants, and chatbots to interact natively with the GitHub platform. It allows these tools to access repositories, analyze code, manage issues and pull requests, and automate workflows using the Model Context Protocol (MCP). The server supports integration with multiple hosts, including VS Code and other popular IDEs, and can operate both remotely and locally. Built for developers seeking to enhance AI-powered development workflows through seamless GitHub context access.

    • 24,418
    • MCP
    • github/github-mcp-server
  • Wazuh MCP Server

    Wazuh MCP Server

    Bridge Wazuh SIEM data to AI assistants with Model Context Protocol compatibility.

    Wazuh MCP Server is a Rust-based service that interfaces with Wazuh SIEM systems and transforms their complex data into Model Context Protocol (MCP) compatible formats. It enables AI assistants, including Claude Desktop Integration, to access security alerts, vulnerability assessments, agent health, and other SIEM insights through natural language queries. This solution facilitates compliance teams and security operations by providing actionable data for monitoring, forensics, compliance validation, and incident response.

    • 137
    • MCP
    • gbrigandi/mcp-server-wazuh
  • Intruder MCP

    Intruder MCP

    Enable AI agents to control Intruder.io via the Model Context Protocol.

    Intruder MCP allows AI model clients such as Claude and Cursor to interactively control the Intruder vulnerability scanner through the Model Context Protocol. It can be deployed using smithery, locally with Python, or in a Docker container, requiring only an Intruder API key for secure access. The tool provides integration instructions tailored for MCP-compatible clients, streamlining vulnerability management automation for AI-driven workflows.

    • 21
    • MCP
    • intruder-io/intruder-mcp
  • mcp-server-home-assistant

    mcp-server-home-assistant

    A Model Context Protocol Server integration for Home Assistant.

    Provides an MCP server interface for Home Assistant, enabling context sharing between Home Assistant and AI models through the Model Context Protocol. Allows users to connect Claude Desktop and similar tools to Home Assistant via a WebSocket API and secure API token. Facilitates seamless integration by leveraging a custom Home Assistant component that is migrating into Home Assistant Core. Enables access and manipulation of smart home context data in standardized ways.

    • 64
    • MCP
    • allenporter/mcp-server-home-assistant
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results