Logo de KQL (Azure Data Explorer)

KQL (Azure Data Explorer)

Communauté
4R9UN

Kusto and Log Analytics MCP server help you execute a KQL (Kusto Query Language) query within an AI prompt, analyze, and visualize the data.

Éditeur4R9UN
Dépôtmcp-kql-server
LanguePython
Forks
5
Étoiles
23
Outils disponibles
0
Type de transportstdio
Catégories
LicenceMIT
Liens
  • Connectez des outils à vos workflows IA

    KQL (Azure Data Explorer) propose des fonctionnalités MCP utilisables par les clients et agents IA compatibles.

  • 0 outils disponibles

    Parcourez les actions invocables ci-dessous, avec leurs noms et descriptions lorsque le serveur les fournit.

  • Configuration prête à copier

    Utilisez les exemples de configuration pour configurer ce serveur dans votre client MCP préféré.

  • Indicateurs de popularité open source

    23 étoiles et 5 forks sur le dépôt associé.

MCP KQL Server

mcp-name: io.github.4R9UN/mcp-kql-server

MseeP.ai Security Assessment Badge

AI-Powered KQL Query Execution with Natural Language to KQL (NL2KQL) Conversion and Execution

A Model Context Protocol (MCP) server that transforms natural language questions into optimized KQL queries with intelligent schema discovery, AI-powered caching, and seamless Azure Data Explorer integration. Simply ask questions in plain English and get instant, accurate KQL queries with context-aware results.

Latest Version: v2.1.5 - Policy compliant Azure CLI login and migration to the official MCP Python SDK.

Verified on MseeP MCP Registry PyPI version Python

CI/CD Pipeline codecov Security Rating Code Quality

MCP Python SDK Azure Data Explorer Maintenance MCP Badge

🎬 Demo

Watch a quick demo of the MCP KQL Server in action:

MCP KQL Server Demo

🚀 Features

  • execute_kql_query:

    • Natural Language to KQL: Generate KQL queries from natural language descriptions.
    • Direct KQL Execution: Execute raw KQL queries.
    • Multiple Output Formats: Supports JSON, CSV, and table formats.
    • Strict Schema Validation: Uses discovered schema memory and validation before execution.
    • Schema-Grounded Repair: Repairs invalid columns only when a valid table schema can prove the replacement.
  • kql_schema_memory:

    • Schema Discovery: Discover and cache schemas for tables.
    • Database Exploration: List all tables within a database.
    • AI Context: Get ranked CAG context for tables, with optional table-scoped strict schema output.
    • Analysis Reports: Generate reports with visualizations.
    • Cache Management: Clear or refresh the schema cache.
    • Memory Statistics: Get statistics about the memory usage.

📊 MCP Tools Execution Flow

Schema Memory Discovery Flow

The schema memory flow is integrated into query execution, but it now reuses existing cached schema before attempting live discovery. If a table schema is already available in CAG/schema memory, the server will use that cached schema instead of re-indexing it.

📋 Prerequisites

  • Python 3.10 or higher
  • Azure CLI installed. Server startup checks the current token and runs plain interactive az login only when needed.
  • Access to Azure Data Explorer cluster(s)

🚀 One-Command Installation

Quick Install (Recommended)

From Source

bash
git clone https://github.com/4R9UN/mcp-kql-server.git && cd mcp-kql-server && pip install -e .

Alternative Installation Methods

bash
pip install mcp-kql-server

That's it! The server automatically:

  • ✅ Sets up memory directories in %APPDATA%\KQL_MCP (Windows) or ~/.local/share/KQL_MCP (Linux/Mac)
  • ✅ Configures optimal defaults for production use
  • ✅ Suppresses verbose Azure SDK logs
  • ✅ No environment variables required

📱 MCP Client Configuration

One-time install (any platform):

bash
pip install --upgrade mcp-kql-server

After install, configure your MCP client to launch the server via the Python module entry point: python -m mcp_kql_server. This works on every platform where Python is on PATH and does not depend on the location of the mcp-kql-server console script. (The console script is still installed by pip and remains supported for backward compatibility — see the alternative snippets below.)

Claude Desktop

Add to your Claude Desktop MCP settings file (mcp_settings.json):

Location:

  • Windows: %APPDATA%\Claude\mcp_settings.json
  • macOS: ~/Library/Application Support/Claude/mcp_settings.json
  • Linux: ~/.config/Claude/mcp_settings.json
json
{
  "mcpServers": {
    "mcpKqlServer": {
      "type": "stdio",
      "command": "python",
      "args": ["-m", "mcp_kql_server"]
    }
  }
}

Windows (the py launcher is commonly available as py; use Get-Command py if you need its full path):

json
{
  "mcpServers": {
    "mcpKqlServer": {
      "type": "stdio",
      "command": "py",
      "args": ["-3", "-m", "mcp_kql_server"]
    }
  }
}

On macOS / Linux replace "py" with "python3" and drop the "-3" arg.

VSCode (with MCP Extension)

Add to your VSCode MCP configuration:

Settings.json location:

  • Windows: %APPDATA%\Code\User\mcp.json
  • macOS: ~/Library/Application Support/Code/User/mcp.json
  • Linux: ~/.config/Code/User/mcp.json
json
{
  "servers": {
    "mcpKqlServer": {
      "type": "stdio",
      "command": "py",
      "args": ["-3", "-m", "mcp_kql_server", "--transport", "stdio"],
      "timeout": 300000,
      "env": {
        "FASTMCP_TRANSPORT": "stdio",
        "MCP_KQL_AUTH_ON_STARTUP": "true",
        "MCP_KQL_CHECK_FOR_UPDATES": "false",
        "MCP_KQL_SKIP_STARTUP_VERSION_CHECK": "1",
        "MCP_KQL_AUTH_CHECK_TIMEOUT_SECONDS": "10",
        "MCP_KQL_AUTH_LOGIN_TIMEOUT_SECONDS": "120",
        "MCP_KQL_SQLITE_BUSY_TIMEOUT_MS": "30000"
      }
    }
  }
}

If VS Code logs spawn ...PythonNNN/python.exe ENOENT, the Python extension is substituting a cached interpreter path for "python". Switch to "py" (Windows) / "python3" (macOS/Linux), or to the "mcp-kql-server" console script that pip install drops on PATH. See docs/troubleshooting.md for full details.

Windows tip: use py -3 -m mcp_kql_server so VS Code does not need a user-specific Python path. If you must use a full path locally, keep it in your private mcp.json, not in shared documentation.

If the server starts but VS Code still shows no tools, run MCP: Reset Cached Tools, then MCP: Reset Trust, and restart the server from MCP: List Servers. VS Code stores trust and cached tools separately from mcp.json, so a previous failed launch can keep the old empty state until you reset it.

Shared HTTP Mode for Multiple MCP Clients

Use shared HTTP when VS Code, GitHub Copilot CLI, agents, or other MCP clients should connect to one persistent MCP KQL server process.

HTTP binds are restricted to loopback by default because tool calls execute with the operator's Azure CLI identity. Put authentication and TLS in a trusted reverse proxy before remote exposure. Non-loopback binding requires the explicit MCP_KQL_ALLOW_UNAUTHENTICATED_REMOTE_HTTP=true acknowledgement.

Start the server:

bash
python -m mcp_kql_server --transport http --host 127.0.0.1 --port 8000 --http-path /mcp --stateless-http

Client configuration:

json
{
  "servers": {
    "mcpKqlServer": {
      "type": "http",
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

Runtime Settings

Option or environment variablePurposeDefault
--transport, FASTMCP_TRANSPORTstdio, http, streamable-http, or ssestdio
--host, FASTMCP_HOSTHTTP bind host127.0.0.1
--port, FASTMCP_PORTHTTP bind port8000
--http-path, FASTMCP_STREAMABLE_HTTP_PATHStreamable HTTP endpoint path/mcp
--stateless-http, FASTMCP_STATELESS_HTTPStateless HTTP mode for shared deploymentsfalse
--auth-on-startup / --no-auth-on-startup, MCP_KQL_AUTH_ON_STARTUPInitialize authentication when the server startstrue
--check-updates, MCP_KQL_CHECK_FOR_UPDATESCheck PyPI for package updates before startupfalse
MCP_KQL_AUTH_CHECK_TIMEOUT_SECONDSAzure CLI auth check timeout10
MCP_KQL_AUTH_LOGIN_TIMEOUT_SECONDSInteractive Azure login timeout120
MCP_KQL_AUTH_MODEKusto authentication mode: azure-cli or managed-identityazure-cli
AZURE_CLIENT_IDOptional user-assigned managed identity client IDunset
MCP_KQL_SQLITE_BUSY_TIMEOUT_MSSQLite busy timeout for concurrent local MCP instances30000
MCP_KQL_MAX_CONCURRENT_QUERIESMaximum simultaneous Kusto requests per process5
MCP_KQL_MAX_RESULT_ROWSMaximum rows returned in one MCP response10000
MCP_KQL_MAX_RESULT_BYTESMaximum default JSON response size2000000
MCP_KQL_MAX_CACHE_ENTRIESMaximum persisted query-result cache entries1000
MCP_KQL_MAX_CACHED_RESULT_BYTESMaximum size of one cached result2000000
MCP_KQL_CACHE_RESULTSPersist bounded query results in local SQLitetrue
MCP_KQL_EMBEDDING_MODELSentence Transformers model used for semantic retrievalall-MiniLM-L6-v2
MCP_KQL_LOG_LEVELServer log level written to stderrINFO
MCP_KQL_ALLOW_UNAUTHENTICATED_REMOTE_HTTPExplicitly permit a non-loopback HTTP bindfalse

The embedding model is lazy loaded. Changing it causes schemas to be re-embedded on refresh, and vectors produced by other models are ignored rather than mixed.

Roo-code Or Cline (VS-code Extentions)

Ask or Add to your Roo-code Or Cline MCP settings:

MCP Settings location:

  • All platforms: Through Roo-code extension settings or mcp_settings.json
json
{
  "mcp-kql-server": {
    "type": "stdio",
    "command": "python",
    "args": ["-m", "mcp_kql_server"],
    "alwaysAllow": []
  }
}

Generic MCP Client

For any MCP-compatible application:

bash
# Preferred: invoke as a Python module (cross-platform)
python -m mcp_kql_server

# Platform-stable launchers (recommended if `python` is ambiguous on PATH)
py -3 -m mcp_kql_server     # Windows
python3 -m mcp_kql_server   # macOS / Linux

# Equivalent console script installed by pip
mcp-kql-server

# Shared HTTP mode for multiple clients
python -m mcp_kql_server --transport http --host 127.0.0.1 --port 8000 --http-path /mcp --stateless-http

# Server provides these tools:
# - execute_kql_query: Execute KQL or generate KQL from natural language
# - kql_schema_memory: Discover, cache, and inspect cluster schemas

🔧 Quick Start

1. Start the MCP Server (Zero configuration)

bash
python -m mcp_kql_server

Server startup begins an Azure CLI token check in the background and runs plain interactive az login only when needed. Kusto tool calls never launch login; they wait for that startup task before executing. To authenticate manually before starting the server, run:

bash
az login

To inspect the installed server version and runtime defaults:

bash
python -m mcp_kql_server --info --json

The server starts immediately with:

  • 📁 Auto-created memory path: %APPDATA%\KQL_MCP\cluster_memory
  • 🔧 Optimized defaults: No configuration files needed
  • 🔐 Secure setup: Uses your existing Azure CLI credentials
  • ⚡ Responsive startup: MCP discovery starts immediately while authentication initializes in the background

3. Use via MCP Client

The server provides two main tools:

execute_kql_query - Execute KQL queries or generate KQL from natural language

kql_schema_memory - Discover, refresh, and inspect cached cluster schemas

💡 Usage Examples

Basic Query Execution

Ask your MCP client (like Claude):

"Execute this KQL query against the help cluster: cluster('help.kusto.windows.net').database('Samples').StormEvents | take 10 and summarize the result and give me high level insights "

Complex Analytics Query

Ask your MCP client:

"Query the Samples database in the help cluster to show me the top 10 states by storm event count, include visualization"

Schema Discovery

Ask your MCP client:

"Discover and cache the schema for the help.kusto.windows.net cluster, then tell me what databases and tables are available"

Data Exploration with Context

Ask your MCP client:

"Using the StormEvents table in the Samples database on help cluster, show me all tornado events from 2007 with damage estimates over $1M"

Time-based Analysis

Ask your MCP client:

"Analyze storm events by month for the year 2007 in the StormEvents table, group by event type and show as a visualization"

🎯 Key Benefits

For Data Analysts

  • ⚡ Faster Query Development: AI-powered autocomplete and suggestions
  • 🎨 Rich Visualizations: Instant markdown tables for data exploration
  • 🧠 Context Awareness: Understand your data structure without documentation

For DevOps Teams

  • 🔄 Automated Schema Discovery: Keep schema information up-to-date
  • 💾 Smart Caching: Reduce API calls and improve performance
  • 🔐 Secure Authentication: Leverage existing Azure CLI credentials

For AI Applications

  • 🤖 Intelligent Query Assistance: AI-generated table descriptions and suggestions
  • 📊 Structured Data Access: Clean, typed responses for downstream processing
  • 🎯 Context-Aware Responses: Rich metadata for better AI decision making

🏗️ Architecture

Report Generated by MCP-KQL-Server | ⭐ Star this repo on GitHub

🚀 Production Deployment

Ready to deploy MCP KQL Server to Azure for production use? We provide comprehensive deployment automation for Azure Container Apps with enterprise-grade security and scalability.

🌟 Features

  • ✅ Serverless Compute: Azure Container Apps with auto-scaling
  • ✅ Managed Identity: Passwordless authentication with Azure AD
  • ✅ Infrastructure as Code: Bicep templates for reproducible deployments
  • ✅ Monitoring: Integrated Log Analytics and Application Insights
  • ✅ Secure by Default: Network isolation, RBAC, and least-privilege access
  • ✅ One-Command Deploy: Automated PowerShell and Bash scripts

📖 Deployment Guide

For complete deployment instructions, architecture details, and troubleshooting:

👉 View Production Deployment Guide

The guide includes:

  • 🏗️ Detailed architecture diagrams
  • ⚙️ Step-by-step deployment instructions (PowerShell & Bash)
  • 🔒 Security configuration best practices
  • 🐛 Troubleshooting common issues
  • 📦 Docker containerization details

Quick Deploy

bash
# PowerShell (Windows)
cd deployment
.\deploy.ps1 -SubscriptionId "YOUR_SUB_ID" -ResourceGroupName "mcp-kql-prod-rg" -ClusterUrl "https://yourcluster.region.kusto.windows.net"

# Bash (Linux/Mac/WSL)
cd deployment
./deploy.sh --subscription "YOUR_SUB_ID" --resource-group "mcp-kql-prod-rg" --cluster-url "https://yourcluster.region.kusto.windows.net"

📁 Project Structure

mcp-kql-server/
├── mcp_kql_server/
│   ├── __init__.py          # Package initialization
│   ├── mcp_server.py        # Main MCP server implementation
│   ├── execute_kql.py       # KQL query execution logic
│   ├── memory.py            # Advanced memory management
│   ├── kql_auth.py          # Azure authentication
│   ├── utils.py             # Utility functions
│   └── constants.py         # Configuration constants
├── docs/                    # Documentation
├── Example/                 # Usage examples
├── pyproject.toml          # Project configuration
└── README.md               # This file

🔒 Security

  • Azure CLI Authentication: Reuses an existing token or starts interactive browser login
  • No Credential Storage: Server doesn't store authentication tokens
  • Local Memory: Schema cache stored locally, not transmitted

🐛 Troubleshooting

Common Issues

  1. Authentication Errors

    bash
    # Re-authenticate with Azure CLI
    az login --tenant your-tenant-id
  2. Memory Issues

    bash
    # The memory cache is now managed automatically. If you suspect issues,
    # you can clear the cache directory, and it will be rebuilt on the next query.
    # Windows:
    rmdir /s /q "%APPDATA%\KQL_MCP\unified_memory.json"
    
    # macOS/Linux:
    rm -rf ~/.local/share/KQL_MCP/cluster_memory
  3. Connection Timeouts

    • Check cluster URI format
    • Verify network connectivity
    • Confirm Azure permissions

🤝 Contributing

We welcome contributions! Please do.

📞 Support

🌟 Star History

Star History Chart


mcp-name: io.github.4R9UN/mcp-kql-server

Happy Querying! 🎉

Installation

TypingMind
Prérequis :

Node.js 18+

{
  "mcpServers": {
    "mcp-kql-server": {
      "command": "uvx",
      "args": [
        "mcp-kql-server"
      ]
    }
  }
}

Utilisez le serveur MCP KQL (Azure Data Explorer) avec plusieurs modèles IA

TypingMind connecte les outils MCP au niveau de l’espace de travail. Une fois KQL (Azure Data Explorer) connecté, vous pouvez donc l’utiliser avec différents modèles IA dans TypingMind sans avoir à le configurer séparément pour chaque modèle. Cette intégration MCP s’exécute localement sur votre appareil via le connecteur MCP de TypingMind.

Guide de configuration du connecteur local

Choisissez cette méthode si le serveur MCP doit accéder à des fichiers locaux, à des applications ou à des ressources privées sur votre ordinateur.

1

Ouvrir les paramètres MCP

Dans TypingMind, accédez à « Paramètres », puis à « Paramètres avancés » et à « Model Context Protocol », et choisissez « Configurer connecteur ».

  1. Ouvrez TypingMind dans votre navigateur.
  2. Cliquez sur l’icône Paramètres.
  3. Accédez aux paramètres avancés.
  4. Ouvrez la section Model Context Protocol.
  5. Cliquez sur « Configurer connecteur » et choisissez « Cet appareil ».
Écran de configuration du connecteur MCP de TypingMind avec l’option « Cet appareil » sélectionnée
2

Exécuter la commande du connecteur

Choisissez « Cet appareil », copiez la commande depuis TypingMind et exécutez-la dans Terminal. Laissez le processus en cours d’exécution pendant que vous utilisez MCP.

  1. Copiez la commande de configuration affichée par TypingMind.
  2. Ouvrez Terminal sur macOS ou Windows Terminal sur Windows.
  3. Collez et exécutez la commande.
  4. Autorisez l’installation du paquet si Terminal vous demande de confirmer.
  5. Gardez la fenêtre de Terminal ouverte et le processus en cours d’exécution pendant que vous utilisez les outils MCP.
3

Ajoutez KQL (Azure Data Explorer) en tant que serveur

Lorsque l’état du connecteur affiche « Prêt », cliquez sur « Éditer serveurs » et collez la configuration du serveur MCP.

  1. Attendez que l’état du connecteur affiche « Prêt ».
  2. Cliquez sur « Éditer serveurs ».
  3. Collez la configuration du serveur MCP KQL (Azure Data Explorer).
  4. Enregistrez la liste des serveurs.
  5. Actualisez pour vérifier que le connecteur est toujours prêt.
Paramètres MCP de TypingMind affichant un serveur actif et le bouton « Éditer serveurs »
{
  "mcpServers": {
    "kql-azure-data-explorer": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-kql-server"
      ]
    }
  }
}
4

Utiliser la connexion avec différents modèles

Enregistrez la liste des serveurs, ouvrez « Plugins », activez les outils MCP de KQL (Azure Data Explorer), puis sélectionnez un modèle IA compatible dans TypingMind et utilisez les outils dans une discussion ou attribuez-les à un agent IA.

  1. Ouvrez la page Plugins dans TypingMind.
  2. Activez les outils MCP de KQL (Azure Data Explorer).
  3. Démarrez une discussion et choisissez le modèle IA que vous souhaitez utiliser.
  4. Utilisez les outils MCP dans le chat ou attribuez-les à un agent IA.
  5. Passez à un autre modèle IA selon vos besoins sans rétablir la connexion MCP.
Discussion TypingMind utilisant des outils MCP activés avec un modèle d’IA sélectionné
Pouvez-vous utiliser KQL (Azure Data Explorer) pour m’aider dans cette tâche ?
KQL (Azure Data Explorer)
Bien sûr. J’ai tout lu.
Voici ce que j’ai trouvé avec KQL (Azure Data Explorer).

Foire aux questions

À quoi sert le serveur MCP KQL (Azure Data Explorer) ?

KQL (Azure Data Explorer) est un serveur MCP qui permet aux applications IA compatibles d’accéder à des outils et à des informations contextuelles externes. Dans TypingMind, il vous suffit d’ajouter ce serveur MCP une seule fois pour rendre ses outils disponibles dans votre espace de travail IA.

Puis-je utiliser le serveur MCP KQL (Azure Data Explorer) avec plusieurs modèles IA dans TypingMind ?

Oui. TypingMind connecte les outils MCP au niveau de l’espace de travail. Vous pouvez donc utiliser KQL (Azure Data Explorer) avec différents modèles IA comme Claude, ChatGPT, Gemini ou d’autres modèles configurés dans TypingMind, sans avoir à configurer le serveur MCP séparément pour chaque modèle.

Pourquoi utiliser le connecteur MCP KQL (Azure Data Explorer) avec TypingMind ?

TypingMind est l’une des meilleures interfaces de chat avec les LLM, car elle réunit plusieurs modèles IA, prompts, plugins, agents IA, clés API et outils MCP dans un seul espace de travail. Une fois KQL (Azure Data Explorer) connecté, vous pouvez utiliser ses outils MCP avec vos modèles préférés tout en gardant vos discussions bien organisées dans TypingMind.

Comment connecter le serveur MCP KQL (Azure Data Explorer) à TypingMind ?

KQL (Azure Data Explorer) fonctionne via le connecteur MCP local de TypingMind. C’est l’option idéale lorsque le serveur MCP doit accéder à des fichiers locaux, des applications de bureau, des outils en ligne de commande ou des ressources privées sur votre ordinateur.

Quels outils le serveur MCP KQL (Azure Data Explorer) propose-t-il dans TypingMind ?

KQL (Azure Data Explorer) propose des fonctionnalités MCP que vous pouvez activer depuis la page Plugins de TypingMind et utiliser dans les discussions ou attribuer à des agents IA.

Dois-je partager mes clés API avec TypingMind pour utiliser le serveur MCP KQL (Azure Data Explorer) ?

Non. TypingMind privilégie le fonctionnement local et vous permet de garder le contrôle de vos fournisseurs de modèles, clés API, prompts et paramètres MCP. Si KQL (Azure Data Explorer) nécessite une authentification, ajoutez les en-têtes, les paramètres OAuth ou la configuration locale requis pour ce serveur MCP lors de la création de la connexion.

Serveurs MCP similaires

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇