Labsco
pab1it0 logo

Azure Data Explorer

β˜… 55

from pab1it0

An MCP server for integrating with Azure Data Explorer, allowing for data querying and management.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

Azure Data Explorer MCP Server

<a href="https://glama.ai/mcp/servers/1yysyd147h"> <img width="380" height="200" src="https://glama.ai/mcp/servers/1yysyd147h/badge" /> </a>

CI codecov License: MIT Python 3.12

A Model Context Protocol (MCP) server that enables AI assistants to execute KQL queries and explore Azure Data Explorer (ADX/Kusto) databases through standardized interfaces.

This server provides seamless access to Azure Data Explorer and Eventhouse (in Microsoft Fabric) clusters, allowing AI assistants to query and analyze your data using the powerful Kusto Query Language.

Features

Query Execution

  • Execute KQL queries - Run arbitrary KQL queries against your ADX database
  • Structured results - Get results formatted as JSON for easy consumption

Database Discovery

  • List tables - Discover all tables in your database
  • View schemas - Inspect table schemas and column types
  • Sample data - Preview table contents with configurable sample sizes
  • Table statistics - Get detailed metadata including row counts and storage size

Authentication

  • DefaultAzureCredential - Supports Azure CLI, Managed Identity, and more
  • Workload Identity - Native support for AKS workload identity
  • Flexible credentials - Works with multiple Azure authentication methods

Deployment Options

  • Multiple transports - stdio (default), HTTP, and Server-Sent Events (SSE)
  • Docker support - Production-ready container images with security best practices
  • Dev Container - Seamless development experience with GitHub Codespaces

The list of tools is configurable, so you can choose which tools you want to make available to the MCP client. This is useful if you don't use certain functionality or if you don't want to take up too much of the context window.

Using as a Dev Container / GitHub Codespace

This repository can also be used as a development container for a seamless development experience. The dev container setup is located in the devcontainer-feature/adx-mcp-server folder.

For more details, check the devcontainer README.

Development

Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.

This project uses uv to manage dependencies. Install uv following the instructions for your platform:

curl -LsSf https://astral.sh/uv/install.sh | sh

You can then create a virtual environment and install the dependencies with:

uv venv
source .venv/bin/activate  # On Unix/macOS
.venv\Scripts\activate     # On Windows
uv pip install -e .

Project Structure

The project has been organized with a src directory structure:

adx-mcp-server/
β”œβ”€β”€ src/
β”‚   └── adx_mcp_server/
β”‚       β”œβ”€β”€ __init__.py      # Package initialization
β”‚       β”œβ”€β”€ server.py        # MCP server implementation
β”‚       β”œβ”€β”€ main.py          # Main application logic
β”œβ”€β”€ Dockerfile               # Docker configuration
β”œβ”€β”€ docker-compose.yml       # Docker Compose configuration
β”œβ”€β”€ .dockerignore            # Docker ignore file
β”œβ”€β”€ pyproject.toml           # Project configuration
└── README.md                # This file

Testing

The project includes a comprehensive test suite that ensures functionality and helps prevent regressions.

Run the tests with pytest:

# Install development dependencies
uv pip install -e ".[dev]"

# Run the tests
pytest

# Run with coverage report
pytest --cov=src --cov-report=term-missing

Tests are organized into:

  • Configuration validation tests
  • Server functionality tests
  • Error handling tests
  • Main application tests

When adding new features, please also add corresponding tests.

Available Tools

ToolCategoryDescriptionParameters
execute_queryQueryExecute a KQL query against Azure Data Explorerquery (string) - KQL query to execute
list_tablesDiscoveryList all tables in the configured databaseNone
get_table_schemaDiscoveryGet the schema for a specific tabletable_name (string) - Name of the table
sample_table_dataDiscoveryGet sample data from a tabletable_name (string), sample_size (int, default: 10)
get_table_detailsDiscoveryGet table statistics and metadatatable_name (string) - Name of the table