Execute KQL queries using Azure authentication. Requires Azure CLI login.
AI-Powered KQL Query Execution with Intelligent Schema Memory
A Model Context Protocol (MCP) server that provides intelligent KQL (Kusto Query Language) query execution with AI-powered schema caching and context assistance for Azure Data Explorer clusters.
Watch a quick demo of the MCP KQL Server in action:
execute_kql_query
:
schema_memory
:
graph TD
A[π€ User Submits KQL Query] --> B{π Query Validation}
B -->|β Invalid| C[π Syntax Error Response]
B -->|β
Valid| D[π§ Load Schema Context]
D --> E{πΎ Schema Cache Available?}
E -->|β
Yes| F[β‘ Load from Memory]
E -->|β No| G[π Discover Schema]
F --> H[π― Execute Query]
G --> I[πΎ Cache Schema + AI Context]
I --> H
H --> J{π― Query Success?}
J -->|β Error| K[π¨ Enhanced Error Message]
J -->|β
Success| L[π Process Results]
L --> M[π¨ Generate Visualization]
M --> N[π€ Return Results + Context]
K --> O[π‘ AI Suggestions]
O --> N
style A fill:#4a90e2,stroke:#2c5282,stroke-width:2px,color:#ffffff
style B fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
style C fill:#e74c3c,stroke:#c0392b,stroke-width:2px,color:#ffffff
style D fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
style E fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
style F fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff
style G fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
style H fill:#2980b9,stroke:#1f618d,stroke-width:2px,color:#ffffff
style I fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
style J fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
style K fill:#e74c3c,stroke:#c0392b,stroke-width:2px,color:#ffffff
style L fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff
style M fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
style N fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff
style O fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
The kql_schema_memory
functionality is now seamlessly integrated into the kql_execute
tool. When you run a query, the server automatically discovers and caches the schema for any tables it hasn't seen before. This on-demand process ensures you always have the context you need without any manual steps.
graph TD
A[π€ User Requests Schema Discovery] --> B[π Connect to Cluster]
B --> C[π Enumerate Databases]
C --> D[π Discover Tables]
D --> E[π Get Table Schemas]
E --> F[π€ AI Analysis]
F --> G[π Generate Descriptions]
G --> H[πΎ Store in Memory]
H --> I[π Update Statistics]
I --> J[β
Return Summary]
style A fill:#4a90e2,stroke:#2c5282,stroke-width:2px,color:#ffffff
style B fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
style C fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
style D fill:#2980b9,stroke:#1f618d,stroke-width:2px,color:#ffffff
style E fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
style F fill:#e67e22,stroke:#bf6516,stroke-width:2px,color:#ffffff
style G fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
style H fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
style I fill:#2980b9,stroke:#1f618d,stroke-width:2px,color:#ffffff
style J fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff
az login
)git clone https://github.com/4R9UN/mcp-kql-server.git && cd mcp-kql-server && pip install -e .
pip install mcp-kql-server
That's it! The server automatically:
%APPDATA%\KQL_MCP
(Windows) or ~/.local/share/KQL_MCP
(Linux/Mac)Add to your Claude Desktop MCP settings file (mcp_settings.json
):
Location:
%APPDATA%\Claude\mcp_settings.json
~/Library/Application Support/Claude/mcp_settings.json
~/.config/Claude/mcp_settings.json
{
"mcpServers": {
"mcp-kql-server": {
"command": "python",
"args": ["-m", "mcp_kql_server"],
"env": {}
}
}
}
Add to your VSCode MCP configuration:
Settings.json location:
%APPDATA%\Code\User\mcp.json
~/Library/Application Support/Code/User/mcp.json
~/.config/Code/User/mcp.json
{
"MCP-kql-server": {
"command": "python",
"args": [
"-m",
"mcp_kql_server"
],
"type": "stdio"
},
}
Ask or Add to your Roo-code Or Cline MCP settings:
MCP Settings location:
mcp_settings.json
{
"MCP-kql-server": {
"command": "python",
"args": [
"-m",
"mcp_kql_server"
],
"type": "stdio",
"alwaysAllow": [
]
},
}
For any MCP-compatible application:
# Command to run the server
python -m mcp_kql_server
# Server provides these tools:
# - kql_execute: Execute KQL queries with AI context
# - kql_schema_memory: Discover and cache cluster schemas
az login
python -m mcp_kql_server
The server starts immediately with:
%APPDATA%\KQL_MCP\cluster_memory
The server provides two main tools:
kql_execute
- Execute KQL Queries with AI Context
kql_schema_memory
- Discover and Cache Cluster Schemas
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 "
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"
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"
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"
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"
graph TD
A[MCP Client<br/>Claude/AI/Custom] <--> B[MCP KQL Server<br/>FastMCP Framework]
B <--> C[Azure Data Explorer<br/>Kusto Clusters]
B <--> D[Schema Memory<br/>Local AI Cache]
style A fill:#4a90e2,stroke:#2c5282,stroke-width:3px,color:#ffffff
style B fill:#8e44ad,stroke:#6a1b99,stroke-width:3px,color:#ffffff
style C fill:#e67e22,stroke:#bf6516,stroke-width:3px,color:#ffffff
style D fill:#27ae60,stroke:#1e8449,stroke-width:3px,color:#ffffff
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
Authentication Errors
# Re-authenticate with Azure CLI
az login --tenant your-tenant-id
Memory Issues
# 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
Connection Timeouts
We welcome contributions! Please do.
Happy Querying! π
Access Mina blockchain data, including events, actions, and network state, through the Mina Archive Node API.
Provides structured access to Aster DEX market data, including candlesticks, order books, trades, and funding rates.
a lightweight, local RAG memory store to record, retrieve, update, delete, and visualize persistent "memories" across sessionsβperfect for developers working with multiple AI coders (like Windsurf, Cursor, or Copilot) or anyone who wants their AI to actually remember them.
Vector search using the LanceDB vector database and Ollama embedding models.
Integrates with Odoo Accounting via XML-RPC, allowing AI tools to query and analyze account journal entries for auditing purposes.
Interact with StarRocks
A read-only MCP server for querying AWS PostgreSQL databases.
A read-only MCP server for querying live data from Outreach.io using the CData JDBC Driver.
Provides access to Azure Data Explorer (ADX) clusters, requiring Azure credentials for configuration.
An MCP server that wraps the dbt CLI, allowing AI agents to interact with dbt projects.