mananshahtr_azure_log_analytics_mcp

mananshahtr_azure_log_analytics_mcp

by MananShahTR
An MCP server that converts natural language queries into KQL for Azure Log Analytics using Claude AI.

Azure Log Analytics Query MCP Server

Overview

The Azure Log Analytics MCP Server is a specialized implementation of the Model Context Protocol (MCP) designed to facilitate natural language queries against Azure Log Analytics. This server leverages Claude AI to convert natural language queries into Kusto Query Language (KQL) and executes them against Azure Log Analytics, making it easier for users to interact with their logs without needing to write complex queries.

Features

  • Natural Language to KQL Conversion: Utilizes Claude AI to translate natural language queries into KQL.
  • Azure Log Analytics Integration: Executes KQL queries directly against Azure Log Analytics.
  • Formatted Results: Returns query results in a format optimized for consumption by large language models (LLMs).
  • Dual Modes: Supports both CLI mode for direct interactions and MCP server mode for integration with LLMs.

Prerequisites

  • Node.js 18.x or higher
  • Azure Subscription: Access to an Azure Log Analytics workspace.
  • Anthropic API Key: Required for Claude AI integration.
  • Azure CLI: Configured with appropriate credentials.

Installation

# Clone the repository
git clone https://github.com/MananShahTR/azure-log-analytics-mcp.git
cd azure-log-analytics-mcp

# Install dependencies
npm install

# Build the project
npm run build

Configuration

Environment Variables

  • ANTHROPIC_API_KEY: Your Anthropic API key for Claude AI.

Azure Configuration

Ensure you are logged in using Azure CLI (az login). Configure the following in azure-service.ts:
- subscriptionId: Your Azure subscription ID.
- resourceGroup: The resource group containing your Application Insights resource.
- appInsightsId: The name of your Application Insights resource.

Usage

CLI Tool

# Run as a CLI tool
ANTHROPIC_API_KEY=your_key_here node build/index.js

MCP Server

# Run as an MCP server
ANTHROPIC_API_KEY=your_key_here node build/mcp-server.js

MCP Settings Configuration

Add the following to your MCP settings configuration file:

{
  "mcpServers": {
    "azure-log-analytics": {
      "command": "node",
      "args": ["path/to/azure-log-analytics-mcp/build/mcp-server.js"],
      "env": {
        "ANTHROPIC_API_KEY": "your_key_here"
      }
    }
  }
}

Tool Usage

The MCP server provides the following tool:
- query_logs: Query Azure Log Analytics using natural language.
- Parameters:
- query: Natural language query about trace logs (required).
- timeRange: Optional time range (e.g., "last 24 hours", "past week").
- limit: Maximum number of results to return.

Examples

// Example MCP tool use
use_mcp_tool({
  server_name: "azure-log-analytics",
  tool_name: "query_logs",
  arguments: {
    query: "Show me all errors in the authentication service from the last hour",
    timeRange: "last hour",
    limit: 10
  }
});

License

MIT

About

This project is designed to simplify querying Azure Log Analytics by enabling natural language interactions through the MCP protocol. It integrates Claude AI for query translation and provides both CLI and server modes for flexibility.

Resources

Stars

1 star

Watchers

1 watching

Forks

0 forks

Languages

  • JavaScript 57.6%
  • TypeScript 42.4%

Features & Capabilities

Categories
mcp_server model_context_protocol azure_log_analytics claude_ai kql natural_language_processing nodejs typescript api_integration search

Implementation Details

Stats

0 Views
0 Favorites
1 GitHub Stars

Repository Info

MananShahTR Organization

Similar Servers

continuedev_continue by continuedev
0
0
0