MCP Server

MCP server for Microsoft Defender Advanced Hunting - execute KQL queries via natural language

Local serverstdioPython

What is the MCP MCP server?

MCP server for Microsoft Defender Advanced Hunting - execute KQL queries via natural language. The mcp mcp server wraps that behind the Model Context Protocol, so an assistant can use it through 3 defined tools rather than through you.

What it actually does

An MCP (Model Context Protocol) server for Microsoft Defender Advanced Hunting. Enables AI assistants to investigate security events using natural language by translating queries to KQL and executing them against Defender.

  • Advanced Hunting — Execute KQL queries against Defender's Advanced Hunting API
  • Dynamic Schema Discovery — Fetch available tables and columns directly from your Defender instance
  • Natural Language Security Investigations — Let AI translate your questions into KQL
  • Certificate Authentication — Secure authentication using Azure AD certificates (recommended)

Adding it to your client

The server ships on npm as @modelcontextprotocol/inspector, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

Its toolset

Everything the assistant can do here goes through one of these:

Configuration

You will need 5 environment variables: PYTHONPATH, AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_CERTIFICATE_PATH, AZURE_CLIENT_SECRET. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

  • Python 3.10+ - Azure AD App Registration with WindowsDefenderATP permission: - AdvancedQuery.Read.All - Run advanced queries

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the mcp mcp server does with a few real requests.

When to reach for it

Among the cloud and infrastructure options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. MCP's toolset — Endpoint, run_hunting_query, get_hunting_schema — is a fair guide to whether it matches your workflow.

This entry was verified against MCP's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Available tools

ToolWhat it does
Endpointhttps://api.securitycenter.microsoft.com
run_hunting_queryExecute KQL queries against Advanced Hunting
get_hunting_schemaGet available tables and columns dynamically

How to install the MCP MCP server

{
  "mcpServers": {
    "defender": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/inspector"],
      "env": {
        "PYTHONPATH": "your-value",
        "AZURE_TENANT_ID": "your-value",
        "AZURE_CLIENT_ID": "your-value",
        "AZURE_CLIENT_CERTIFICATE_PATH": "your-value",
        "AZURE_CLIENT_SECRET": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

  • Python 3.10+ - Azure AD App Registration with WindowsDefenderATP permission: - AdvancedQuery.Read.All - Run advanced queries
VariableDescriptionRequired
PYTHONPATHFilesystem location the server is allowed to use.Optional
AZURE_TENANT_IDConfiguration value read at startup.Optional
AZURE_CLIENT_IDConfiguration value read at startup.Optional
AZURE_CLIENT_CERTIFICATE_PATHFilesystem location the server is allowed to use.Optional
AZURE_CLIENT_SECRETCredential the server authenticates with.Yes

Example prompts to try

  • Use MCP to Endpoint.
  • Use MCP to run hunting query.
  • Use MCP to get hunting schema.

Frequently asked questions

It connects MCP to MCP-compatible AI assistants such as Claude and Cursor, exposing 3 tools (Endpoint, run_hunting_query, get_hunting_schema) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with MCP directly.