Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-kql-server

MCP.Pizza Chef: 4R9UN

The MCP KQL Server is a Model Context Protocol server that enables execution of Kusto Query Language (KQL) queries against Azure Data Explorer clusters. It integrates smoothly with AI platforms like Claude Desktop and Visual Studio Code, allowing users to run KQL queries directly within AI prompts using the `kql_execute` tool. Authentication is simplified via Azure CLI, eliminating complex credential setups, and it supports optional query visualizations for enhanced data insights.

Use This MCP server To

Run KQL queries directly from AI prompts in Claude Desktop or VS Code Authenticate and query Azure Data Explorer using Azure CLI seamlessly Visualize query results within AI-enhanced workflows Integrate KQL querying into AI copilots and agents Simplify data exploration in Azure Data Explorer clusters Automate data retrieval and analysis with natural language prompts

README

πŸš€ MCP KQL Server

A Model Context Protocol (MCP) server for executing Kusto Query Language (KQL) queries against Azure Data Explorer clusters. Seamlessly integrates with Claude Desktop and Visual Studio Code (VS Code). Supports Azure CLI authentication and provides a convenient kql_execute tool for execute KQL queries directly within your AI prompts, complete with optional visualizations.

MCP KQL server

✨ Features

  • πŸ” Execute KQL Queries: Run KQL queries directly within your AI prompts using the kql_execute MCP tool.
  • ⚑ Plug-and-Play Simplicity: No manual tenant ID configuration or complex credential management. Simply authenticate via Azure CLI (az login) and start querying immediately.
  • πŸ€– Seamless Claude Integration: Execute KQL queries within Claude Desktop without switching interfaces or dashboards.
  • πŸ”’ Secure and Efficient: Leverages Azure CLI’s robust authentication, ensuring secure credential handling and optimized query performance.
  • πŸ“Š Visualization Ready: Optional Markdown table outputs make data analysis intuitive and engaging.
  • πŸ”‘ Azure CLI Authentication: Built-in Azure CLI authentication with retry and caching logic.
  • πŸ“‘ Protocol Compatibility: Fully compatible with MCP protocol version 2024-11-05.
  • πŸ› οΈ Reliable Implementation: Uses fastmcp for a robust and reliable MCP server implementation.

πŸ“Œ Comparison with Other Tools

Feature MCP KQL Server Azure Data Explorer MCP Standalone Scripts
Claude Integration βœ… ❌ ❌
Plug-and-Play Authentication βœ… (Azure CLI) ❌ (Manual setup) ❌ (Custom code)
No Tenant ID Required βœ… ❌ ❌
Data Visualization βœ… βœ… ❌
Open-Source βœ… βœ… Varies

πŸ“‹ Requirements

  • Python 3.10 or higher
  • Azure Data Explorer cluster access
  • Azure CLI installed and authenticated (az login)
  • Node.js (optional, for Claude Desktop filesystem server)
  • VS Code with Claude extension or MCP client (for VS Code integration)

πŸ“‚ Project Structure

mcp-kql-server/
β”œβ”€β”€ mcp_kql_server/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ mcp_server.py
β”‚   β”œβ”€β”€ kql_auth.py
β”‚   └── execute_kql.py
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ README.md

πŸ—οΈ Setup Instructions

1️⃣ Clone the Repository

git clone https://github.com/4R9UN/mcp-kql-server.git
cd mcp-kql-server

2️⃣ Install Python 3.10+

  • Windows:
    winget install Python.Python.3.10
  • macOS:
    brew install python@3.10
  • Linux:
    sudo apt-get install python3.10

Verify installation:

python --version

3️⃣ Install Azure CLI

  • Follow official instructions: Install Azure CLI
  • Log in to Azure:
    az config set core.login_experience_v2=off
    az login

4️⃣ Create and Activate Virtual Environment

python -m venv .venv

Activate environment:

  • Windows:
    .venv\Scripts\activate
  • macOS/Linux:
    source .venv/bin/activate

5️⃣ Install Dependencies

pip install .

πŸ–₯️ Setup for Claude Desktop

  • Copy claude_desktop_config.json to Claude's configuration directory:

    • Windows: C:\Users\YourUser\AppData\Roaming\Claude\
    • macOS: /Users/YourUser/Library/Application Support/Claude/
    • Linux: Currently not supported by Claude Desktop.
  • Update the configuration file with your Python path and project directory:

{
  "mcpServers": {
    "mcp-kql-server": {
      "command": "C:\\Users\\YourUser\\mcp-kql-server\\.venv\\Scripts\\python.exe",
      "args": [
        "-m",
        "mcp_kql_server.mcp_server"
      ]
    }
  }
}
  • Optional: Install Node.js for filesystem server support (Node.js).
  • Restart Claude Desktop.

πŸ–±οΈ Setup for VS Code

  • Install VS Code.
  • Install the Copilot MCP client extension.
  • Modify the MCP settings.json with the following configuration:
{
  "mcpServers": {
    "mcp-kql-server": {
      "command": "C:\\Users\\YourUser\\mcp-kql-server\\.venv\\Scripts\\python.exe",
      "args": [
        "-m",
        "mcp_kql_server.mcp_server"
      ],
      "env": {
        "PYTHONPATH": "C:\\Users\\YourUser\\Downloads\\mcp-kql-server",
        "PYTHONUNBUFFERED": "1",
        "AZURE_CORE_ONLY_SHOW_ERRORS": "true"
      }
    }
  }
}
  • Run the MCP: List Servers command in VS Code’s Command Palette to verify setup.
  • Enable autodiscovery if using Claude Desktop’s configuration.

βœ… Test the Server

  • Claude Desktop:
    • Open Claude Desktop and provide the following prompt:
      Use a tool to execute the attached KQL query, visualize the results, and provide high-level insights from the query output.
      
      KQL query: "cluster('mycluster').database('mydb').MyTable | take 10"
      

🀝 Contributing

  • Fork the repository.
  • Create a feature branch:
    git checkout -b feature/YourFeature
  • Commit your changes:
    git commit -m "Add YourFeature"
  • Push to your branch:
    git push origin feature/YourFeature
  • Open a Pull Request.

πŸ“¬ Contact

For issues or questions, please open a ticket on GitHub or contact the maintainer at arjuntrivedi42@yahoo.com.

πŸŽ‰ Happy Querying!

mcp-kql-server FAQ

How do I authenticate the MCP KQL Server to access Azure Data Explorer?
Authentication is handled via Azure CLI using the `az login` command, simplifying secure access without manual credential management.
Can I use the MCP KQL Server with multiple AI platforms?
Yes, it integrates with Claude Desktop and Visual Studio Code, and can be extended to other MCP-compatible hosts.
Does the MCP KQL Server support query result visualizations?
Yes, it provides optional visualizations to help interpret query results directly within AI workflows.
Is it necessary to configure tenant IDs or credentials manually?
No, the server leverages Azure CLI authentication, so no manual tenant ID or credential configuration is required.
What is the `kql_execute` tool?
It is an MCP tool provided by the server that allows executing KQL queries directly within AI prompts.
How secure is the MCP KQL Server?
It uses Azure CLI’s robust authentication mechanisms, ensuring secure and efficient access to Azure Data Explorer.
Can I run complex KQL queries through this server?
Yes, the server supports full KQL syntax, enabling complex queries against Azure Data Explorer clusters.
How does the MCP KQL Server improve developer workflows?
It streamlines querying by embedding KQL execution into AI prompts, reducing context switching and manual query execution.