Entra ID SecOps MCP Server
This server provides read-only Entra ID security investigation tools for identity incidents, account risk, sign-ins, directory audits, and Conditional Access coverage.
get_user_context — retrieve a user's profile, groups, directory roles, and privileged role status to assess incident severity.
get_user_signins — fetch recent sign-in events with aggregated stats (successes, failures, distinct IPs/locations) and security notes.
get_risky_users — list Entra Identity Protection risky users, filtered to active at-risk or confirmed-compromised accounts.
get_risk_detections — get granular risk detection reasons (leaked credentials, anonymized IP, etc.) for a user or tenant.
get_directory_audits — review recent admin directory changes, flagging sensitive/persistence or privilege-escalation operations.
get_conditional_access_policies — list CA policies with real enforcement state to explain blocks or coverage gaps.
All tools are read-only; some require Entra ID P1/P2 licenses.
Provides access to VirusTotal threat intelligence, enabling security analysts to enrich investigations with reputation data on files, URLs, domains, and IP addresses.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Entra ID SecOps MCP Server Investigate recent sign-ins and risk detections for user@contoso.com"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Entra ID SecOps MCP Server
An MCP server that exposes Microsoft Entra ID security logs as tools executable by an AI agent (Claude Desktop, Cursor, or any other MCP client).
Goal: allow an analyst to ask a question in natural language — "why can't this account sign in anymore?" — and get an answer in seconds based on the tenant's actual data.
📖 Installation and testing guide — the three ways to launch the server, step by step. 🔍 Technical brief — market scan and secure exposure.
Design Principle
A raw Microsoft Graph response contains about sixty fields per event. The server applies aggressive truncation: only about a dozen security indicators reach the model. This is both a cost optimization (factor ~35 on tokens) and a security control, since unlisted fields — some of which are attacker-controlled — never enter the context.
Aggregates (number of failures, distinct IPs, suspicious patterns) are computed in Python, not inferred by the model.
Related MCP server: Microsoft MCP Server for Enterprise
Tools
Tool | Purpose | Graph Permission | License |
| Account record: position, groups, held roles. Determines the severity of an incident. |
| — |
| Recent sign-ins for a UPN, with summary and suspicious patterns |
| P1 |
| Accounts flagged as risky by Identity Protection |
| P2 |
| Individual detections: why an account is at risk |
| P2 |
| Administrative changes; flags persistence actions |
| — |
| Active policies and coverage gaps |
| — |
All tools are read-only: the server never modifies the tenant.
Recommended investigation order
get_user_context le compte est-il privilégié ? l'incident est-il grave ?
↓
get_user_signins que s'est-il passé sur l'authentification ?
↓
get_risk_detections qu'a détecté Identity Protection, et pourquoi ?
↓
get_directory_audits l'attaquant a-t-il modifié quelque chose une fois entré ?This sequence is also described in the server's instructions, which the MCP client sends to the model.
Quick start (without an Azure tenant)
The fixture mode replays a demo incident and requires no tenant, license, or secret.
python -m venv venv
venv/Scripts/activate # Windows ; sur Linux/macOS : source venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env # ENTRA_DATA_SOURCE=fixture est déjà la valeur par défaut
python -m entra_secops_mcpConnecting to a real tenant
Create an App Registration in the Entra portal.
Add the application permissions from the table above, then grant admin consent.
Generate a client secret.
Fill in
.env:
AZURE_TENANT_ID=...
AZURE_CLIENT_ID=...
AZURE_CLIENT_SECRET=...
ENTRA_DATA_SOURCE=graphLicense required. Accessing sign-in logs via the API requires an Entra ID P1 license, and Identity Protection tools require P2. Without them, Graph returns
403. The other tools work without a paid license. Check the tenant's license before you start: this is the classic blocker that wastes several days.
Security
No secret is present in the code or in the Docker image. They are injected at startup via
--env-file..envis excluded from git by.gitignore. A secret pushed to a repository must be revoked in Azure, not just deleted from the file.Logging goes to
stderr: in stdio transport,stdoutcarries the JSON-RPC protocol and tolerates no stray bytes.
Configuration
All variables are documented in .env.example.
Docker
docker build -t entra-secops-mcp .
docker run -i --rm --env-file .env entra-secops-mcpFinal image: 277 MB, multi-stage build, runs as a non-root user (uid=1000), no secrets in the layers.
-i keeps standard input open — that's where the MCP protocol passes through. No -t: a pseudo-terminal injects color codes that corrupt JSON frames.
Development
pytest # 81 tests
ruff check src tests
mypy src # mode strict
pre-commit install # contrôles avant chaque commit
python demo.py # investigation de démonstrationStatus
Tools | 6, all read-only |
Tests | 81, no Azure tenant required |
Types |
|
MCP Protocol |
|
Container | verified via a real MCP client: startup 2.4 s, tool call ~110 ms |
License
MIT.
Available Tools
6 toolsget_conditional_access_policiesARead-onlyIdempotent
Liste les politiques d'accès conditionnel du tenant, avec leur état réel d'application.
À utiliser pour expliquer pourquoi une connexion a été bloquée (code 53003), ou pour repérer une faille de couverture : politique désactivée, politique en mode audit seul, ou exclusion qui permet à un compte de contourner un contrôle.
Inputs: limit. Returns: Résultat de `get_conditional_access_policies`.
get_directory_auditsARead-onlyIdempotent
Récupère les modifications administratives récentes de l'annuaire, afin d'identifier une dérive de configuration ou un changement non autorisé.
Signale automatiquement les opérations à valeur de persistance ou d'élévation de privilèges : attribution de rôle, ajout d'un secret applicatif, enrôlement d'une méthode MFA, modification d'une politique d'accès conditionnel.
À utiliser après avoir constaté une connexion suspecte, pour déterminer ce que l'attaquant a fait une fois entré.
Inputs: hours, limit, initiated_by. Returns: Résultat de `get_directory_audits`.
get_risk_detectionsARead-onlyIdempotent
Récupère les détections de risque unitaires : identifiants divulgués, IP anonymisée, voyage impossible, pulvérisation de mots de passe.
C'est l'outil qui explique POURQUOI un compte est signalé à risque, là où
get_risky_users se contente de dire QUE le compte l'est.
Nécessite une licence Entra ID P2.
Inputs: upn, hours, limit. Returns: Résultat de `get_risk_detections`.
get_risky_usersARead-onlyIdempotent
Liste les comptes signalés à risque par Entra Identity Protection, du plus risqué au moins risqué.
À utiliser pour obtenir une vue d'ensemble de l'exposition du tenant, ou pour confirmer qu'un compte précis est bien considéré comme compromis.
Nécessite une licence Entra ID P2.
Inputs: limit, only_active. Returns: Résultat de `get_risky_users`.
get_user_contextARead-onlyIdempotent
Récupère la fiche d'identité d'un compte : poste, département, état, groupes d'appartenance et rôles d'annuaire détenus.
C'est l'outil qui détermine la GRAVITÉ d'un incident. Une connexion suspecte sur un compte sans privilège et sur un compte administrateur global appellent des réponses très différentes.
À appeler systématiquement avant de conclure sur un incident.
Inputs: upn (required). Returns: Fiche d'identité d'un compte : ce qui détermine la gravité d'un incident.
get_user_signinsARead-onlyIdempotent
Récupère les connexions récentes d'un utilisateur pour investiguer un blocage d'authentification, une anomalie géographique ou une compromission.
Retourne les événements réduits à leurs indicateurs de sécurité, plus une synthèse chiffrée (nombre d'échecs, IP distinctes, observations calculées).
Args: upn: User Principal Name complet, par exemple « alice@contoso.com ». hours: Fenêtre de recherche en heures. Défaut 24, maximum 168 (7 jours). limit: Nombre maximum d'événements retournés. Défaut 25, maximum 100.
Inputs: upn (required), hours, limit. Returns: Résultat de `get_user_signins` : les événements plus une synthèse chiffrée. La…
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct data source: user identity context, sign-in events, risky user aggregates, individual risk detections, directory audit logs, and conditional access policies. The closely related risky-user and risk-detection tools are explicitly differentiated by scope, so an agent can reliably pick the right one.
All tool names follow a consistent get_<resource> pattern using snake_case: get_user_context, get_user_signins, get_risky_users, get_risk_detections, get_directory_audits, get_conditional_access_policies. The naming convention is uniform and predictable.
Six tools is a tightly scoped set for an Entra ID SecOps investigation server. Each tool covers a necessary aspect of incident investigation without redundancy or bloat.
The tool surface covers the main investigative workflow: identify the user's privilege level, inspect sign-ins, review identity risk, understand specific risk detections, check for malicious directory changes, and evaluate conditional access impacts. No significant operational gap is apparent for the stated SecOps purpose.
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
Find relevant security data from Sentinel data lake for building effective agents. More:aka.ms/s/de
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceProvides secure access to Microsoft Entra ID (Azure AD) resources including users, devices, and applications through Microsoft Graph API. Enables querying organizational data with comprehensive audit logging to Azure Blob Storage.-
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to query Microsoft Entra data using natural language, converting requests into Microsoft Graph API calls for read-only enterprise IT scenarios.63CC BY-4.0
- AlicenseNot gradedqualityDmaintenanceEnables security investigation and threat hunting through Microsoft Defender and Entra ID, with 31 tools for KQL queries, alerts, threat intelligence, identity investigation, and advanced threat hunting.MIT
- AlicenseAqualityDmaintenanceEnables auditing and monitoring of Microsoft Entra ID security posture, Conditional Access policies, and Zero Trust alignment via Microsoft Graph API.5MIT