coralogix-mcp-server

checkmatez/coralogix-mcp-server

3.2

If you are the rightful owner of coralogix-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Coralogix MCP Server is a Model Context Protocol server designed for seamless integration with Coralogix, offering robust tools for log querying and management.

Tools
  1. log_query

    Execute synchronous Dataprime queries against Coralogix logs.

  2. log_background_query

    Submit asynchronous background queries for long-running operations.

  3. log_background_query_status

    Check the status of a background query.

  4. log_background_query_data

    Retrieve results from completed background queries.

  5. log_background_query_cancel

    Cancel a running background query.

Coralogix MCP Server

A Model Context Protocol (MCP) server for Coralogix integration, currently providing tools for log querying.

Features

  • Log Queries: Execute synchronous and asynchronous Dataprime queries
  • Background Query Support: Submit long-running queries and retrieve results later
  • Query Management: Check status, retrieve data, and cancel running queries
  • CLI Interface: Full-featured command-line interface with Cobra
  • Configuration Management: Flexible configuration with Viper
  • Production Ready: Comprehensive error handling, logging, and testing

Quick Start

Prerequisites

  • Go 1.23 or higher
  • Git
  • Coralogix API key

Installation

# Clone the repository
git clone https://github.com/checkmatez/coralogix-mcp-server.git
cd coralogix-mcp

# Install dependencies
make install

# Build the server
make build

Configuration

Set your Coralogix API credentials:

# Environment variables
export CORALOGIX_API_KEY="your-api-key"
export CORALOGIX_API_URL="https://api.coralogix.com"  # Optional, defaults to US region

# Or use command line flags
./bin/coralogix-mcp-server stdio --api-key="your-api-key" --api-url="https://api.coralogix.com"

Usage

Run the server in stdio mode:

# Run from source (development)
make dev

# Run built binary
./bin/coralogix-mcp-server stdio

# With specific configuration
./bin/coralogix-mcp-server stdio \
  --api-key="your-key" \
  --enabled-toolsets="logs" \
  --read-only=true

Available Tools

Log Query Tools
  • log_query - Execute synchronous Dataprime queries against Coralogix logs
  • log_background_query - Submit asynchronous background queries for long-running operations
  • log_background_query_status - Check the status of a background query
  • log_background_query_data - Retrieve results from completed background queries
  • log_background_query_cancel - Cancel a running background query

Example Usage

Synchronous Query
{
  "tool": "log_query",
  "arguments": {
    "query": "source logs | filter severity == 'error' | limit 100",
    "startDate": "2024-01-01T00:00:00Z",
    "endDate": "2024-01-02T00:00:00Z",
    "tier": "TIER_FREQUENT_SEARCH"
  }
}
Background Query (for long-running queries)
// 1. Submit the query
{
  "tool": "log_background_query",
  "arguments": {
    "query": "source logs | stats count() by severity",
    "startDate": "2024-01-01T00:00:00Z",
    "endDate": "2024-01-31T00:00:00Z"
  }
}
// Returns: { "queryId": "abc123..." }

// 2. Check status
{
  "tool": "log_background_query_status",
  "arguments": {
    "queryId": "abc123..."
  }
}

// 3. Retrieve results when complete
{
  "tool": "log_background_query_data",
  "arguments": {
    "queryId": "abc123..."
  }
}

Development

Available Commands

make build       # Build binary for current platform
make test        # Run tests with coverage
make dev         # Run development server
make run         # Run built binary
make lint        # Run linters
make check       # Run all checks (fmt, vet, lint, test)
make clean       # Clean build artifacts
make help        # Show all available commands

Project Structure

coralogix-mcp/
ā”œā”€ā”€ cmd/
│   └── coralogix-mcp-server/   # Main server application
│       └── main.go             # CLI entry point
ā”œā”€ā”€ internal/
│   └── server/                 # Core server implementation
│       └── server.go           # MCP server logic
ā”œā”€ā”€ integration/                # Integration tests
│   └── integration_test.go     # Integration tests
ā”œā”€ā”€ .golangci.yml              # Linting configuration
ā”œā”€ā”€ Makefile                   # Build automation
ā”œā”€ā”€ go.mod                     # Go module file
ā”œā”€ā”€ go.sum                     # Go module checksums
└── README.md                  # This file

Running Tests

# Unit tests
make test

# Integration tests
go test ./integration/...

# With coverage
make test && open coverage.html

Environment Variables

VariableDescriptionDefault
CORALOGIX_API_KEYCoralogix API keyRequired
CORALOGIX_API_URLCoralogix API URLhttps://api.coralogix.com
LOG_LEVELLog levelinfo

CLI Flags

FlagDescriptionDefault
--api-keyCoralogix API key
--api-urlCoralogix API URLhttps://api.coralogix.com
--enabled-toolsetsComma-separated list of enabled toolsetslogs
--read-onlyEnable read-only modefalse
--log-levelLog level (debug, info, warn, error)info

Production Deployment

Docker

# Build Docker image
docker build -t coralogix-mcp .

# Run container
docker run -e CORALOGIX_API_KEY="your-key" coralogix-mcp

Read-Only Mode

For production deployments, consider using read-only mode to prevent accidental modifications:

./bin/coralogix-mcp-server stdio --read-only=true

License

MIT