Kibana MCP Server

Kibana MCP Server

MCP Server for Kibana SecOps

ggilligan12

Developer Tools
Visit Server

README

Kibana MCP Server

Kibana MCP Demo

This project provides a Model Context Protocol (MCP) server implementation that allows AI assistants to interact with Kibana Security alerts.

Features

This server exposes the following tools to MCP clients:

Tools

  • tag_alert: Adds one or more tags to a specific Kibana security alert signal.
    • alert_id (string, required): The ID of the Kibana alert signal to tag.
    • tags (array of strings, required): A list of tags to add to the alert signal.
  • adjust_alert_status: Changes the status of a specific Kibana security alert signal.
    • alert_id (string, required): The ID of the Kibana alert signal.
    • new_status (string, required): The new status. Must be one of: "open", "acknowledged", "closed".
  • get_alerts: Fetches recent Kibana security alert signals, optionally filtering by text and limiting quantity.
    • limit (integer, optional, default: 20): Maximum number of alerts to return.
    • search_text (string, optional): Text to search for in alert signal fields.

Configuration

To connect to your Kibana instance, the server requires the following environment variables to be set:

  • KIBANA_URL: The base URL of your Kibana instance (e.g., https://your-kibana.example.com:5601).

And one of the following authentication methods:

  • API Key (Recommended):
    • KIBANA_API_KEY: A Base64 encoded Kibana API key. Generate this in Kibana under Stack Management -> API Keys. Ensure the key has permissions to read and update security alerts/signals (e.g., appropriate privileges for the Security Solution feature).
    • Example format: VzR1dU5COXdPUTRhQVZHRWw2bkk6LXFSZGRIVGNRVlN6TDA0bER4Z1JxUQ== (This is just an example, use your actual key).
  • Username/Password (Less Secure):
    • KIBANA_USERNAME: Your Kibana username.
    • KIBANA_PASSWORD: Your Kibana password.

The server prioritizes KIBANA_API_KEY if it is set. If it's not set, it will attempt to use KIBANA_USERNAME and KIBANA_PASSWORD.

Quickstart: Running the Server

  1. Set the required environment variables (KIBANA_URL and authentication variables).

    • Using API Key:
      export KIBANA_URL="<your_kibana_url>"
      export KIBANA_API_KEY="<your_base64_encoded_api_key>"
      
    • Using Username/Password:
      export KIBANA_URL="<your_kibana_url>"
      export KIBANA_USERNAME="<your_kibana_username>"
      export KIBANA_PASSWORD="<your_kibana_password>"
      
  2. Navigate to the project directory (kibana-mcp).

  3. Run the server using uv (which uses the entry point defined in pyproject.toml):

    uv run kibana-mcp
    

The server will start and listen for MCP connections via standard input/output.

Connecting an MCP Client (e.g., Cursor, Claude Desktop)

You can configure MCP clients like Cursor or Claude Desktop to use this server.

Configuration File Locations:

  • Cursor: ~/.cursor/mcp.json
  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%/Claude/claude_desktop_config.json (Windows)

Add the following server configuration under the mcpServers key, replacing /path/to/kibana-mcp with the actual absolute path to your project root. Choose one authentication method (KIBANA_API_KEY or KIBANA_USERNAME/KIBANA_PASSWORD) within the command arguments.

Recommended Configuration (using /usr/bin/env):

Some client applications may not reliably pass environment variables defined in their configuration's env block. Using /usr/bin/env directly ensures the variables are set for the server process.

{
  "mcpServers": {
    "kibana-mcp": { // You can choose any name for the client to display
      "command": "/usr/bin/env", // Use env command for reliability
      "args": [
        // Set required environment variables here
        "KIBANA_URL=<your_kibana_url>",

        // Option 1: API Key (Recommended)
        "KIBANA_API_KEY=<your_base64_encoded_api_key>",

        // Option 2: Username/Password (Mutually exclusive with API Key)
        // "KIBANA_USERNAME=<your_kibana_username>",
        // "KIBANA_PASSWORD=<your_kibana_password>",

        // Command to run the server (using absolute paths)
        "/path/to/your/virtualenv/bin/python", // e.g., /Users/me/kibana-mcp/.venv/bin/python
        "/path/to/kibana-mcp/src/kibana_mcp/server.py" // Absolute path to server script
      ],
      "options": {
          "cwd": "/path/to/kibana-mcp" // Set correct working directory
          // No "env" block needed here when using /usr/bin/env in command/args
      }
    }
    // Add other servers here if needed
  }
}

(Note: Replace placeholders like <your_kibana_url>, <your_base64_encoded_api_key>, and the python/script paths with your actual values. Storing secrets directly in the config file is generally discouraged for production use. Consider more secure ways to manage environment variables if needed.)

Alternative Configuration (Standard env block - might not work reliably):

(This is the standard documented approach but proved unreliable in some environments)

{
  "mcpServers": {
    "kibana-mcp-alt": { 
      "command": "/path/to/your/virtualenv/bin/python", 
      "args": [
        "/path/to/kibana-mcp/src/kibana_mcp/server.py"
      ],
      "options": {
          "cwd": "/path/to/kibana-mcp",
          // Choose one auth method:
          "KIBANA_API_KEY": "<your_base64_encoded_api_key>"
          // OR
          // "KIBANA_USERNAME": "<your_kibana_username>",
          // "KIBANA_PASSWORD": "<your_kibana_password>"
      }
    }
  }
}

Development

Installing Dependencies

Sync dependencies using uv:

uv sync

Building and Publishing

To prepare the package for distribution:

  1. Build package distributions:

    uv build
    

    This will create source and wheel distributions in the dist/ directory.

  2. Publish to PyPI:

    uv publish
    

    Note: You'll need to configure PyPI credentials.

Local Development & Testing Environment

The testing/ directory contains scripts and configuration to spin up local Elasticsearch and Kibana instances using Docker Compose and automatically seed them with a sample detection rule.

Prerequisites:

Quickstart:

  1. Install development dependencies:
    pip install -r requirements-dev.txt
    
  2. Run the quickstart script from the project root directory:
    ./testing/quickstart-test-env.sh
    
  3. The script (testing/main.py) will perform checks, start the containers, wait for services, create a sample detection rule, write sample auth data, verify signal generation, and print the access URLs/credentials.
  4. Access Kibana at http://localhost:5601 (User: elastic, Pass: elastic). The internal user Kibana connects with is kibana_system_user.

Manual Steps (Overview):

The testing/quickstart-test-env.sh script executes python -m testing.main. This Python script performs the following:

  1. Checks for Docker & Docker Compose.
  2. Parses testing/docker-compose.yml for configuration.
  3. Runs docker compose up -d.
  4. Waits for Elasticsearch and Kibana APIs.
  5. Creates a custom user (kibana_system_user) and role for Kibana's internal use.
  6. Creates an index template (mcp_auth_logs_template).
  7. Reads testing/sample_rule.json (a detection rule).
  8. Sends a POST request to http://localhost:5601/api/detection_engine/rules to create the rule.
  9. Writes sample data from testing/auth_events.ndjson to mcp-auth-logs-default index.
  10. Checks for detection signals using http://localhost:5601/api/detection_engine/signals/search.
  11. Prints status, URLs, credentials, and shutdown commands.

Stopping the Test Environment:

  • Run the shutdown command printed by the script (e.g., docker compose -f testing/docker-compose.yml down). Use the -v flag (down -v) to remove data volumes if needed.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python