Azure Log Analytics MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Azure Log Analytics MCP
Query Azure Log Analytics workspaces from any MCP client
Azure Log Analytics MCP is a lightweight Model Context Protocol (MCP) server that lets AI assistants query your Azure Log Analytics workspaces. It runs locally via stdio and authenticates using your existing Azure credentials.
Tip: If your Application Insights resource is workspace-based (the default since February 2024), you can use this server to query App Insights data too. See App Insights vs Log Analytics tables for details.
π― What it does
This MCP server gives AI assistants read-only access to your Log Analytics telemetry data through two simple tools:
Discover what tables are available in your workspace
Query your telemetry using KQL (Kusto Query Language)
All operations are strictly read-only β KQL is a query language, not a mutation language.
Related MCP server: KQL MCP Server
β¨ Tools
Tool | Description | Parameters |
| Discovers available tables in the workspace by scanning recent data |
|
| Runs a KQL query and returns results as JSON |
|
π Installation
Prerequisites
Node.js 18+
An Azure account with access to a Log Analytics workspace
Azure CLI logged in (
az login) or another credential source supported by DefaultAzureCredential
Setup
No build step required for end users. Just use npx:
APP_INSIGHTS_WORKSPACE_ID=<your-workspace-id> npx @dkhalife/azure-log-analytics-mcp@latestFor development:
git clone https://github.com/dkhalife/azure-log-analytics-mcp.git
cd azure-log-analytics-mcp
npm install
npm run buildβοΈ Configuration
The server is configured via a single environment variable:
Variable | Required | Description |
| β | The Log Analytics workspace ID (GUID) |
Finding your Workspace ID
Azure Portal:
Go to your Log Analytics workspace β Overview
Copy the Workspace ID (a GUID)
Azure CLI:
az monitor log-analytics workspace show \
--workspace-name <workspace-name> \
-g <resource-group> \
--query "customerId" -o tsvAuthentication
The server uses DefaultAzureCredential which automatically picks up credentials from (in order):
Environment variables (
AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_CLIENT_SECRET)Azure CLI (
az login)Azure PowerShell
Managed Identity (when running in Azure)
For local development, az login is the simplest option.
π Usage Examples
VS Code
Add to your VS Code settings.json under MCP servers:
{
"mcp": {
"servers": {
"log-analytics": {
"command": "npx",
"args": ["@dkhalife/azure-log-analytics-mcp@latest"],
"env": {
"APP_INSIGHTS_WORKSPACE_ID": "<your-workspace-id>"
}
}
}
}
}Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"log-analytics": {
"command": "npx",
"args": ["@dkhalife/azure-log-analytics-mcp@latest"],
"env": {
"APP_INSIGHTS_WORKSPACE_ID": "<your-workspace-id>"
}
}
}
}Example Prompts
Once connected, you can ask your AI assistant things like:
"List all available tables in the workspace"
"Show me recent security events from the last hour"
"Query heartbeat data for the last 7 days grouped by computer"
"What are the top error events in the last 24 hours?"
Example KQL Queries
// Recent heartbeats by computer
Heartbeat
| summarize LastHeartbeat = max(TimeGenerated) by Computer
| order by LastHeartbeat desc
// Security events by type
SecurityEvent
| summarize count() by Activity
| top 10 by count_
// Performance counters β average CPU usage
Perf
| where CounterName == "% Processor Time"
| summarize avg(CounterValue) by Computer, bin(TimeGenerated, 1h)
| order by TimeGenerated desc
// Syslog errors
Syslog
| where SeverityLevel == "err"
| summarize count() by Facility, bin(TimeGenerated, 1h)
| order by TimeGenerated descπ App Insights vs Log Analytics Tables
If your Application Insights resource is linked to a Log Analytics workspace, you can query App Insights data through this server. However, the table names differ between the two:
Log Analytics Table | Application Insights Table | Description |
|
| Incoming HTTP requests |
|
| Outbound dependency calls |
|
| Application exceptions |
|
| Log traces |
|
| Custom events |
|
| Custom metrics |
|
| Page view telemetry |
|
| Browser performance |
|
| Availability tests |
|
| Performance counters |
When querying through this MCP server (which connects to the Log Analytics workspace), use the Log Analytics table names (left column).
β FAQ
Q: Does it work with Application Insights?
Yes, if your Application Insights resource is workspace-based (the default since February 2024). The App Insights data appears in the Log Analytics workspace under table names like AppRequests, AppExceptions, etc. See App Insights vs Log Analytics Tables.
Q: What authentication methods are supported?
Any method supported by Azure's DefaultAzureCredential β Azure CLI, environment variables, managed identity, and more. For local use, az login is the easiest.
Q: What is the timespan parameter?
An ISO 8601 duration string that limits how far back the query looks. Examples: PT1H (1 hour), P1D (1 day), P7D (7 days), P30D (30 days). Defaults to P1D (24 hours) if not specified.
Q: Can I query multiple workspaces?
Not currently. The server queries the single workspace specified by APP_INSIGHTS_WORKSPACE_ID.
Q: Why do I get "The requested path does not exist"?
Your APP_INSIGHTS_WORKSPACE_ID is incorrect. Make sure you're using the Workspace ID (a GUID like xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx), not the workspace name or ARM resource ID. See Finding your Workspace ID.
π€ Contributing
Contributions are welcome! Feel free to fork the repo and submit pull requests. If you have ideas but aren't familiar with code, you can also open issues.
π License
This project is licensed under the MIT License. See the LICENSE file for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Ask your AI assistant about your logs, traces, security events, robot runs and video. Read-only.
Official Microsoft MCP Server to query Microsoft Entra data using natural language
Query your org's data in natural language β read-only MCP access to SQL, NoSQL, files & warehouses.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables querying and managing Azure Log Analytics workspaces using KQL (Kusto Query Language). Supports executing queries, managing saved queries, and exploring workspace tables and schemas with Service Principal authentication.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query and analyze data in Azure Data Explorer, Log Analytics, and Microsoft Sentinel using Kusto Query Language (KQL) through tools, resources, and prompts.6MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI agents to query Azure Log Analytics workspaces using KQL.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to execute KQL queries against Azure Data Explorer and explore database resources like tables and schemas.MIT