A [Model Context Protocol][mcp] (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. [mcp]: https://m
Add this skill
npx mdskills install pab1it0/adx-mcp-serverWell-documented ADX/Kusto MCP server with comprehensive query and discovery tools
1# Azure Data Explorer MCP Server23<a href="https://glama.ai/mcp/servers/1yysyd147h">4 <img width="380" height="200" src="https://glama.ai/mcp/servers/1yysyd147h/badge" />5</a>67[](https://github.com/pab1it0/adx-mcp-server/actions/workflows/ci.yml)8[](https://codecov.io/gh/pab1it0/adx-mcp-server)9[](https://opensource.org/licenses/MIT)10[](https://www.python.org/downloads/)1112A [Model Context Protocol][mcp] (MCP) server that enables AI assistants to execute KQL queries and explore Azure Data Explorer (ADX/Kusto) databases through standardized interfaces.1314This 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.1516[mcp]: https://modelcontextprotocol.io1718## Features1920### Query Execution21- **Execute KQL queries** - Run arbitrary KQL queries against your ADX database22- **Structured results** - Get results formatted as JSON for easy consumption2324### Database Discovery25- **List tables** - Discover all tables in your database26- **View schemas** - Inspect table schemas and column types27- **Sample data** - Preview table contents with configurable sample sizes28- **Table statistics** - Get detailed metadata including row counts and storage size2930### Authentication31- **DefaultAzureCredential** - Supports Azure CLI, Managed Identity, and more32- **Workload Identity** - Native support for AKS workload identity33- **Flexible credentials** - Works with multiple Azure authentication methods3435### Deployment Options36- **Multiple transports** - stdio (default), HTTP, and Server-Sent Events (SSE)37- **Docker support** - Production-ready container images with security best practices38- **Dev Container** - Seamless development experience with GitHub Codespaces3940The 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.4142## Usage43441. Login to your Azure account which has the permission to the ADX cluster using Azure CLI.45462. Configure the environment variables for your ADX cluster, either through a `.env` file or system environment variables:4748```env49# Required: Azure Data Explorer configuration50ADX_CLUSTER_URL=https://yourcluster.region.kusto.windows.net51ADX_DATABASE=your_database5253# Optional: Azure Workload Identity credentials54# AZURE_TENANT_ID=your-tenant-id55# AZURE_CLIENT_ID=your-client-id56# ADX_TOKEN_FILE_PATH=/var/run/secrets/azure/tokens/azure-identity-token5758# Optional: Custom MCP Server configuration59ADX_MCP_SERVER_TRANSPORT=stdio # Choose between http/sse/stdio, default = stdio6061# Optional: Only relevant for non-stdio transports62ADX_MCP_BIND_HOST=127.0.0.1 # default = 127.0.0.163ADX_MCP_BIND_PORT=8080 # default = 808064```6566#### Azure Workload Identity Support6768The server now uses WorkloadIdentityCredential by default when running in Azure Kubernetes Service (AKS) environments with workload identity configured. It prioritizes the use of WorkloadIdentityCredential whenever the necessary environment variables are present.6970For AKS with Azure Workload Identity, you only need to:711. Make sure the pod has `AZURE_TENANT_ID` and `AZURE_CLIENT_ID` environment variables set722. Ensure the token file is mounted at the default path or specify a custom path with `ADX_TOKEN_FILE_PATH`7374If these environment variables are not present, the server will automatically fall back to DefaultAzureCredential, which tries multiple authentication methods in sequence.75763. Add the server configuration to your client configuration file. For example, for Claude Desktop:7778```json79{80 "mcpServers": {81 "adx": {82 "command": "uv",83 "args": [84 "--directory",85 "<full path to adx-mcp-server directory>",86 "run",87 "src/adx_mcp_server/main.py"88 ],89 "env": {90 "ADX_CLUSTER_URL": "https://yourcluster.region.kusto.windows.net",91 "ADX_DATABASE": "your_database"92 }93 }94 }95}96```9798> Note: if you see `Error: spawn uv ENOENT` in Claude Desktop, you may need to specify the full path to `uv` or set the environment variable `NO_UV=1` in the configuration.99100## Docker Usage101102This project includes Docker support for easy deployment and isolation.103104### Building the Docker Image105106Build the Docker image using:107108```bash109docker build -t adx-mcp-server .110```111112### Running with Docker113114You can run the server using Docker in several ways:115116#### Using docker run directly:117118```bash119docker run -it --rm \120 -e ADX_CLUSTER_URL=https://yourcluster.region.kusto.windows.net \121 -e ADX_DATABASE=your_database \122 -e AZURE_TENANT_ID=your_tenant_id \123 -e AZURE_CLIENT_ID=your_client_id \124 adx-mcp-server125```126127#### Using docker-compose:128129Create a `.env` file with your Azure Data Explorer credentials and then run:130131```bash132docker-compose up133```134135### Running with Docker in Claude Desktop136137To use the containerized server with Claude Desktop, update the configuration to use Docker with the environment variables:138139```json140{141 "mcpServers": {142 "adx": {143 "command": "docker",144 "args": [145 "run",146 "--rm",147 "-i",148 "-e", "ADX_CLUSTER_URL",149 "-e", "ADX_DATABASE",150 "-e", "AZURE_TENANT_ID",151 "-e", "AZURE_CLIENT_ID",152 "-e", "ADX_TOKEN_FILE_PATH",153 "adx-mcp-server"154 ],155 "env": {156 "ADX_CLUSTER_URL": "https://yourcluster.region.kusto.windows.net",157 "ADX_DATABASE": "your_database",158 "AZURE_TENANT_ID": "your_tenant_id",159 "AZURE_CLIENT_ID": "your_client_id",160 "ADX_TOKEN_FILE_PATH": "/var/run/secrets/azure/tokens/azure-identity-token"161 }162 }163 }164}165```166167This configuration passes the environment variables from Claude Desktop to the Docker container by using the `-e` flag with just the variable name, and providing the actual values in the `env` object.168169#### Using Docker with HTTP Transport170171For HTTP mode deployment, you can use the following Docker configuration:172173```json174{175 "mcpServers": {176 "adx": {177 "command": "docker",178 "args": [179 "run",180 "--rm",181 "-i",182 "-p", "8080:8080",183 "-e", "ADX_CLUSTER_URL",184 "-e", "ADX_DATABASE",185 "-e", "ADX_MCP_SERVER_TRANSPORT",186 "-e", "ADX_MCP_BIND_HOST",187 "-e", "ADX_MCP_BIND_PORT",188 "adx-mcp-server"189 ],190 "env": {191 "ADX_CLUSTER_URL": "https://yourcluster.region.kusto.windows.net",192 "ADX_DATABASE": "your_database",193 "ADX_MCP_SERVER_TRANSPORT": "http",194 "ADX_MCP_BIND_HOST": "0.0.0.0",195 "ADX_MCP_BIND_PORT": "8080"196 }197 }198 }199}200```201202## Using as a Dev Container / GitHub Codespace203204This 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.205206For more details, check the [devcontainer README](devcontainer-feature/adx-mcp-server/README.md).207208209210## Development211212Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.213214This project uses [`uv`](https://github.com/astral-sh/uv) to manage dependencies. Install `uv` following the instructions for your platform:215216```bash217curl -LsSf https://astral.sh/uv/install.sh | sh218```219220You can then create a virtual environment and install the dependencies with:221222```bash223uv venv224source .venv/bin/activate # On Unix/macOS225.venv\Scripts\activate # On Windows226uv pip install -e .227```228229## Project Structure230231The project has been organized with a `src` directory structure:232233```234adx-mcp-server/235├── src/236│ └── adx_mcp_server/237│ ├── __init__.py # Package initialization238│ ├── server.py # MCP server implementation239│ ├── main.py # Main application logic240├── Dockerfile # Docker configuration241├── docker-compose.yml # Docker Compose configuration242├── .dockerignore # Docker ignore file243├── pyproject.toml # Project configuration244└── README.md # This file245```246247### Testing248249The project includes a comprehensive test suite that ensures functionality and helps prevent regressions.250251Run the tests with pytest:252253```bash254# Install development dependencies255uv pip install -e ".[dev]"256257# Run the tests258pytest259260# Run with coverage report261pytest --cov=src --cov-report=term-missing262```263Tests are organized into:264265- Configuration validation tests266- Server functionality tests267- Error handling tests268- Main application tests269270When adding new features, please also add corresponding tests.271272## Available Tools273274| Tool | Category | Description | Parameters |275|------|----------|-------------|------------|276| `execute_query` | Query | Execute a KQL query against Azure Data Explorer | `query` (string) - KQL query to execute |277| `list_tables` | Discovery | List all tables in the configured database | None |278| `get_table_schema` | Discovery | Get the schema for a specific table | `table_name` (string) - Name of the table |279| `sample_table_data` | Discovery | Get sample data from a table | `table_name` (string), `sample_size` (int, default: 10) |280| `get_table_details` | Discovery | Get table statistics and metadata | `table_name` (string) - Name of the table |281282## Configuration283284### Required Environment Variables285286| Variable | Description | Example |287|----------|-------------|---------|288| `ADX_CLUSTER_URL` | Azure Data Explorer cluster URL | `https://yourcluster.region.kusto.windows.net` |289| `ADX_DATABASE` | Database name to connect to | `your_database` |290291### Optional Environment Variables292293#### Azure Workload Identity (for AKS)294| Variable | Description | Default |295|----------|-------------|---------|296| `AZURE_TENANT_ID` | Azure AD tenant ID | - |297| `AZURE_CLIENT_ID` | Azure AD client/application ID | - |298| `ADX_TOKEN_FILE_PATH` | Path to workload identity token file | `/var/run/secrets/azure/tokens/azure-identity-token` |299300#### MCP Server Configuration301| Variable | Description | Default |302|----------|-------------|---------|303| `ADX_MCP_SERVER_TRANSPORT` | Transport mode: `stdio`, `http`, or `sse` | `stdio` |304| `ADX_MCP_BIND_HOST` | Host to bind to (HTTP/SSE only) | `127.0.0.1` |305| `ADX_MCP_BIND_PORT` | Port to bind to (HTTP/SSE only) | `8080` |306307#### Logging308| Variable | Description | Default |309|----------|-------------|---------|310| `LOG_LEVEL` | Logging level: `DEBUG`, `INFO`, `WARNING`, `ERROR` | `INFO` |311312313## License314315MIT316317---318319[mcp]: https://modelcontextprotocol.io320
Full transparency — inspect the skill content before installing.