Cover image
Try Now
2025-03-22

使用自然语言查询Azure Log Analytics的MCP服务器

3 years

Works with Finder

1

Github Watches

0

Github Forks

1

Github Stars

Azure Log Analytics MCP Server

An MCP (Model Context Protocol) server for querying Azure Log Analytics using natural language. This server allows large language models to convert natural language queries into KQL (Kusto Query Language) and execute them against Azure Log Analytics.

Features

  • Convert natural language queries to KQL using Claude AI
  • Execute KQL queries against Azure Log Analytics
  • Format results for easy consumption by LLMs
  • CLI mode for direct interactions and MCP server mode for LLM integrations

Prerequisites

  • Node.js 18.x or higher
  • An Azure subscription with Log Analytics workspace
  • An Anthropic API key for Claude AI
  • 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

The server requires the following environment variables:

  • ANTHROPIC_API_KEY: Your Anthropic API key for Claude AI

Azure credentials are obtained through Azure CLI credentials. Ensure you're logged in with az login before running the server.

You'll need to configure the following in the azure-service.ts file:

  • subscriptionId: Your Azure subscription ID
  • resourceGroup: The resource group containing your App 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

Once connected, 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

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

    Reviews

    5 (1)
    Avatar
    user_qgjvNzO3
    2025-04-16

    As a dedicated user of azure-log-analytics-mcp, I am genuinely impressed with its capabilities. This tool by MananShahTR has significantly enhanced my log analytics experience on Azure. Its integration is seamless, and the documentation is straightforward, making it easy to get started. The GitHub repository provides all the necessary resources, ensuring a smooth setup. Overall, it's a robust solution for managing and analyzing logs effectively. Highly recommended!