ms-365-admin-mcp-server
Click on "Install 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., "@ms-365-admin-mcp-serverfind all inactive guest users"
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.
ms-365-admin-mcp-server
A Model Context Protocol (MCP) server for Microsoft 365 administration via Graph API application permissions (client credentials).
Built on the architecture and endpoint-driven design pioneered by Softeria/ms-365-mcp-server, and complementary to it: Softeria's server uses delegated permissions for end-user productivity scenarios, while this one uses application permissions for admin operations — security monitoring, identity audits, incident response, and service health. See Acknowledgments below.
Features
622 tools covering security, audit, identity, app credentials, guest users, Exchange, Intune (devices, apps, MAM, reports, macOS Platform Scripts, macOS custom attribute scripts, assignment filters, Remediations, Windows PowerShell scripts, custom compliance scripts), governance (PIM, access reviews, entitlement, lifecycle), compliance, threat intelligence, advanced hunting, Defender for Identity (sensors, candidates, migration, identity accounts, audit policy), Microsoft 365 Copilot admin (usage reports, interaction history audit, AI users, meeting insights, agent registrations, policy settings), custom security attributes, LAPS, policies, reports, incident response, eDiscovery v3 (cases, custodians, noncustodial data sources, review sets, queries, exports, operations), Purview DSPM (protection scopes), event-based retention triggers, Teams online meeting attendance reports (app-only with Application Access Policy), deleted chats restore (admin recovery flow), Teams chat investigation reads (Chat.Read.All for triage; eDiscovery v3 for court-admissible production), Cloud PC, call records, Universal Print, information protection, SharePoint admin, and records management
Application permissions (client credentials) — no user interaction required
Read-only by default — write operations require explicit
--allow-writesRisk classification on write tools (low/medium/high/critical)
Presets to filter tools by domain (security, audit, identity, etc.)
Two transports: stdio (default) and HTTP (StreamableHTTP)
Multi-cloud: Microsoft global and China (21Vianet)
Key Vault support for secrets management
Documentation
Document | Purpose |
18 typical admin scenarios with sample prompts and tool lists | |
End-to-end security incident response playbooks | |
Drop-in skills for LLM agents (Claude Code et al.) with safety patterns | |
Step-by-step Azure AD app registration and permission consent | |
HTTP transport, JWT validation, Docker, Azure Container Apps | |
Threat model, required controls, and checklist for Azure production deploys | |
Common errors and how to diagnose them | |
Internal architecture and code generation pipeline | |
Risk classification rubric for write tools | |
How to contribute new tools, presets, and fixes | |
Vulnerability reporting and operator hardening checklist | |
Release history |
Prerequisites
Node.js >= 18
An Azure AD app registration with application permissions (not delegated)
A specific tenant ID (not "common")
Installation
npm (recommended)
npm install -g @okapi-ca/ms-365-admin-mcp-server
ms-365-admin-mcp-server --helpDocker
docker pull ghcr.io/okapi-ca/ms-365-admin-mcp-server:latest
docker run --rm -i \
-e MS365_ADMIN_MCP_CLIENT_ID=... \
-e MS365_ADMIN_MCP_CLIENT_SECRET=... \
-e MS365_ADMIN_MCP_TENANT_ID=... \
ghcr.io/okapi-ca/ms-365-admin-mcp-server:latestFrom source
git clone https://github.com/okapi-ca/ms-365-admin-mcp-server.git
cd ms-365-admin-mcp-server
npm install
npm run generate
npm run buildConfiguration
Environment variables
Variable | Required | Description |
| Yes | App registration client ID |
| Yes | App registration client secret |
| Yes | Azure AD tenant ID (must be specific) |
| No |
|
| No | Azure Key Vault URL (overrides env vars) |
| No | Cap |
| No |
|
| No | Regex to filter available tools |
MCP client configuration (Claude Desktop, etc.)
{
"mcpServers": {
"ms365-admin": {
"command": "node",
"args": ["/path/to/ms-365-admin-mcp-server/dist/index.js"],
"env": {
"MS365_ADMIN_MCP_CLIENT_ID": "your-client-id",
"MS365_ADMIN_MCP_CLIENT_SECRET": "your-client-secret",
"MS365_ADMIN_MCP_TENANT_ID": "your-tenant-id"
}
}
}
}VS Code (1.102+)
VS Code consumes the same MCP protocol but uses a different config layout —
servers instead of mcpServers, an explicit type field, and inputs for
secret prompts. A ready-to-copy sample lives at
.vscode/mcp.json.example; copy it to
.vscode/mcp.json and VS Code will prompt for the tenant / client / secret on
first start, then store them in its secret store (the real mcp.json is
gitignored so resolved secrets never reach the repo).
Minimal stdio setup:
{
"inputs": [
{ "type": "promptString", "id": "ms365-tenant-id", "description": "Tenant ID" },
{ "type": "promptString", "id": "ms365-client-id", "description": "Client ID" },
{
"type": "promptString",
"id": "ms365-client-secret",
"description": "Client secret",
"password": true,
},
],
"servers": {
"ms365-admin": {
"type": "stdio",
"command": "ms-365-admin-mcp-server",
"args": ["--preset", "security,audit,identity,health"],
"env": {
"MS365_ADMIN_MCP_TENANT_ID": "${input:ms365-tenant-id}",
"MS365_ADMIN_MCP_CLIENT_ID": "${input:ms365-client-id}",
"MS365_ADMIN_MCP_CLIENT_SECRET": "${input:ms365-client-secret}",
},
},
},
}For remote HTTP deployments, use "type": "http" with a url field (VS Code
1.103+ handles OAuth 2.0 Dynamic Client Registration natively) or fall back to
the mcp-remote bridge when the native browser flow is unavailable — see the
example file for both shapes.
Tools surface in Agent mode (GitHub Copilot Chat). VS Code asks for
per-tool approval; the --preset flag above keeps the catalog manageable.
Use Cmd/Ctrl+Shift+P → MCP: List Servers → Show Output to see logs.
Remote HTTP server: device_code authentication (RFC 8628)
If the server runs in HTTP / OAuth mode on a remote host (e.g. Azure Container Apps) and the client connects via mcp-remote, the standard flow requires a browser to reach localhost:14543/oauth/callback. When that isn't possible — macOS Platform SSO hijacks the WebKit flow, Claude Code runs in a headless Docker container, the user is on a remote SSH dev env — use the ms-365-admin-mcp-auth bootstrap to pre-seed mcp-remote's token cache instead.
npx @okapi-ca/ms-365-admin-mcp-server@latest auth \
--server https://your-mcp-host.azurecontainerapps.io/mcpThe helper prints a URL and a user code; you sign in on any device you trust (phone, another laptop) and the tokens are written to ~/.mcp-auth/mcp-remote-<version>/. Claude Desktop / Claude Code then launches mcp-remote normally and finds the cached tokens without ever opening a browser.
See docs/TROUBLESHOOTING.md for Docker / remote-dev patterns and exit code reference.
Usage
CLI options
--read-only Read-only mode (default)
--allow-writes Enable write operations
--enabled-tools <regex> Filter tools by regex pattern
--preset <names> Use preset categories (comma-separated)
--list-presets List available presets and exit
--list-tools List available tools and exit
--list-permissions List required Graph API permissions and exit
--verify-login Test credentials against Graph API and exit
--cloud <type> Cloud environment: global (default) or china
--transport <type> Transport: stdio (default) or http
--port <number> HTTP port (default: 8080)
--host <address> HTTP bind address (default: 127.0.0.1)
--allowed-clients <ids> Comma-separated Entra app IDs (required for HTTP)
-v Verbose loggingPresets
# Security alerts and incidents only
node dist/index.js --preset security
# Identity management tools
node dist/index.js --preset identity
# Multiple presets
node dist/index.js --preset security,audit,identityPreset | Description |
| Security alerts, incidents, attack simulations, and threat intelligence |
| Directory audits, sign-ins, provisioning logs, deleted items |
| Service health and Message Center |
| Usage reports (Teams, Email, SharePoint, OneDrive, Mailbox, M365 Apps) |
| Users, groups, roles, devices, PIM, guest users, external identities |
| Exchange administration (message traces, mailboxes) |
| Managed devices, compliance, configurations, Autopilot, apps, RBAC |
| Access reviews, entitlement management, lifecycle workflows, terms of use |
| Licenses, Secure Score, Identity Protection, risk detections, policies |
| Incident response write operations (disable, revoke, confirm, dismiss) |
| eDiscovery cases (Microsoft Purview) |
| Cloud PC / Windows 365 (provisioning, images, connections, settings, audit) |
| Teams call records |
| Universal Print (printers, shares, connectors, services, operations, tasks) |
| Information Protection (BitLocker recovery keys, threat assessment) |
| SharePoint tenant administration settings |
| Records Management (retention labels, file plan metadata) |
| All available tools |
Verify credentials
node dist/index.js --verify-loginAvailable tools (515)
Security (11)
Tool | Method | Risk |
| GET | |
| GET | |
| PATCH | medium |
| GET | |
| GET | |
| PATCH | medium |
| GET | |
| GET | |
| POST | high |
| PATCH | medium |
| DELETE | medium |
Audit logs & deleted items (5)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
Service health (3)
Tool | Method |
| GET |
| GET |
| GET |
Usage reports (8)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
Users (10)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | high |
| PATCH | medium |
| DELETE | critical |
| POST | medium |
| POST | low |
Devices (2)
Tool | Method |
| GET |
| GET |
Groups (8)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | critical |
| POST | medium |
Directory roles & PIM (7)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | critical |
Administrative units (7)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
Conditional access (3)
Tool | Method |
| GET |
| GET |
| GET |
Applications & app roles (8)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| PATCH | high |
| DELETE | critical |
| PATCH | high |
App credentials & owners (7)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
App management policies (2)
Tool | Method |
| GET |
| GET |
Organization & domains (4)
Tool | Method | Risk |
| GET | |
| GET | |
| POST | high |
| POST | medium |
Licenses (2)
Tool | Method |
| GET |
| GET |
Secure Score (4)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
Identity Protection & risk detections (7)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
Security & access policies (13)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | high |
| PATCH | high |
| DELETE | high |
| GET | |
| GET | |
| POST | high |
Guest user invitations (2)
Tool | Method | Risk |
| GET | |
| POST | medium |
External identity providers (2)
Tool | Method |
| GET |
| GET |
Self-service sign-up (4)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
Custom authentication extensions (2)
Tool | Method |
| GET |
| GET |
Exchange message traces (2)
Tool | Method |
| GET |
| GET |
Exchange mailboxes (7)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | critical |
Threat intelligence - hosts (4)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
Threat intelligence - articles & profiles (6)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
Threat intelligence - vulnerabilities & WHOIS (4)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
Threat intelligence - infrastructure (2)
Tool | Method |
| GET |
| GET |
Managed devices (6)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| DELETE | critical |
Compliance policies (5)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
Device configurations (3)
Tool | Method |
| GET |
| GET |
| GET |
macOS Platform Scripts (6)
Intune shell scripts deployed to managed macOS devices. Targets Graph beta (/beta/deviceManagement/deviceShellScripts) — Microsoft has never promoted this endpoint to v1.0. Requires DeviceManagementScripts.ReadWrite.All.
Tool | Method | Risk |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
Notes:
scriptContentis strict base64 (not URL-safe) of a script with LF line endings — CRLF will break execution on Macs.runAsAccount=useris required for scripts that interact with the user session (e.g.osascripttouching System Events).assign-device-shell-scriptREPLACES all existing assignments — it is not additive. To add a group without removing others, first GET the current assignments, append the new target, then POST the full merged list.By default
get-device-shell-scriptdoes not returnscriptContent; pass$select=id,displayName,scriptContent,...to fetch the base64 body.
Intune Remediations / Proactive Remediations (6)
Paired detection + remediation PowerShell scripts for Windows 10/11 Azure AD joined devices. Targets Graph beta (/beta/deviceManagement/deviceHealthScripts). Requires DeviceManagementScripts.ReadWrite.All.
Tool | Method | Risk |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
Notes:
Both
detectionScriptContentandremediationScriptContentare base64-encoded PowerShell — UTF-8 encoded scripts before base64.Detection script returns exit code 0 (compliant) or 1 (needs remediation). The remediation script only runs when detection returns 1.
assign-device-health-scriptREPLACES all existing assignments — schedules can be daily / hourly / run-once. SetrunRemediationScript: falsefor detect-only deployments.By default
get-device-health-scriptdoes not return the script bodies; pass$select=id,displayName,detectionScriptContent,remediationScriptContent,....Modern replacement for
deviceShellScriptsfor Windows "verify + fix" use cases (CIS hardening, agent install verification, service state).
Assignment filters (5)
Dynamic membership filters that scope policy/app assignments to a sub-set of an Entra group. Targets Graph beta (/beta/deviceManagement/assignmentFilters). Requires DeviceManagementConfiguration.ReadWrite.All.
Tool | Method | Risk |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
Notes:
Rule syntax is KQL-like on device properties — example:
(device.osVersion -startsWith "14")for macOS Sonoma only,(device.deviceOwnership -eq "Corporate")for corporate-owned devices.Operators:
-eq,-ne,-startsWith,-contains,-in,-matches, joined by-and/-or.Filters are referenced by
deviceConfigurations/mobileApps/deviceCompliancePoliciesassignments (not by users — you target the assignment to a group, then add a filter to narrow it).assignmentFilterManagementType:devicesfor device-scoped assignments,appsfor app-scoped (some properties differ).Deleting a filter that is in use will silently fall the dependent assignments back to "all members of the group" — audit assignments before deleting.
macOS custom attribute shell scripts (6)
Intune shell scripts whose STDOUT is stored as a named custom attribute on each device — useful for surfacing inventory data (FileVault, Gatekeeper, encryption flags, custom markers) and driving dynamic group filters. Targets Graph beta (/beta/deviceManagement/deviceCustomAttributeShellScripts). Requires DeviceManagementScripts.ReadWrite.All.
Tool | Method | Risk |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
Notes:
The script's STDOUT becomes the value stored under
customAttributeNameon each device.customAttributeTypecontrols how Intune parses STDOUT:integer,string, ordateTime(ISO 8601).scriptContentis strict base64 of a script with LF line endings — CRLF breaks execution on Macs.Changing
customAttributeNameorcustomAttributeTypeafter deployment breaks downstream dynamic groups and assignment filters that reference the previous key — audit references first.Deleting a script does NOT clear previously-collected attribute values from device records.
Windows PowerShell scripts (deviceManagementScripts) (6)
One-shot PowerShell scripts deployed to managed Windows 10/11 devices. Runs once per device per assignment, retries on failure. For detect-and-fix patterns use deviceHealthScripts (Remediations) instead. Targets Graph beta (/beta/deviceManagement/deviceManagementScripts). Requires DeviceManagementScripts.ReadWrite.All.
Tool | Method | Risk |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
Notes:
scriptContentis base64-encoded UTF-8 PowerShell.Runs ONCE per device on the next Intune Management Extension sync after assignment — does NOT re-run after successful execution (use
deviceHealthScriptsfor repeating patterns).Updating
scriptContentdoes NOT re-run on devices that already succeeded; delete + recreate to force re-execution.enforceSignatureCheck=truerequires code-signed scripts (recommended for prod).runAs32Bit=trueforces 32-bit PowerShell on 64-bit Windows (rarely needed).
Windows custom compliance scripts (deviceComplianceScripts) (6)
PowerShell scripts that emit a JSON object on STDOUT evaluated against rules declared on an associated windows10CustomComplianceConfiguration policy — for organization-specific compliance signals beyond the built-in BitLocker / Defender / firewall checks. Targets Graph beta (/beta/deviceManagement/deviceComplianceScripts). Requires DeviceManagementScripts.ReadWrite.All.
Tool | Method | Risk |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
Notes:
detectionScriptContentmust emit a JSON object on STDOUT (e.g.ConvertTo-Json -Compress @{BitLockerEnabled=$true;TpmReady=$true}).The script alone has no compliance effect — you must also author a
windows10CustomComplianceConfigurationpolicy with matching rules.Changing the JSON keys without updating the linked policy's rules silently breaks compliance evaluation.
Deleting a script in use causes referencing compliance policies to fail evaluation on next device check-in.
Assignment shape reuses
deviceHealthScriptAssignment(setrunRemediationScript: falsesince compliance scripts have no remediation pairing).
Enrollment & Autopilot (10)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| PATCH | medium |
| DELETE | high |
| POST | medium |
Detected apps (3)
Tool | Method |
| GET |
| GET |
| GET |
Intune RBAC & config (7)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
Intune connectors & updates (3)
Tool | Method |
| GET |
| GET |
| GET |
Device categories (1)
Tool | Method |
| GET |
Access reviews (5)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
Entitlement management (7)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
Lifecycle workflows (3)
Tool | Method |
| GET |
| GET |
| GET |
PIM for Groups (2)
Tool | Method |
| GET |
| GET |
Terms of use (3)
Tool | Method |
| GET |
| GET |
| GET |
App consent requests (3)
Tool | Method |
| GET |
| GET |
| GET |
Incident response (11) -- requires --allow-writes
Tool | Method | Risk |
| PATCH | critical |
| POST | high |
| POST | low |
| PATCH | high |
| POST | high |
| POST | high |
| DELETE | high |
| POST | high |
| POST | high |
| POST | high |
| POST | low |
Intune device remote actions (16) -- requires --allow-writes
Tool | Method | Risk |
| POST | critical |
| POST | high |
| POST | low |
| POST | high |
| POST | medium |
| POST | high |
| POST | high |
| POST | low |
| POST | low |
| POST | high |
| POST | low |
| POST | low |
| POST | critical |
| POST | medium |
| POST | high |
| POST | medium |
Conditional Access CRUD (8) -- requires --allow-writes
Tool | Method | Risk |
| GET | |
| GET | |
| POST | high |
| PATCH | high |
| DELETE | critical |
| POST | medium |
| PATCH | medium |
| DELETE | high |
Intune policies CRUD (6) -- requires --allow-writes
Tool | Method | Risk |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
| PATCH | medium |
| DELETE | high |
eDiscovery (1)
Tool | Method | Risk |
| GET |
Teams call records (11)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
Cloud PC / Windows 365 (10)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
Universal Print (6)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Information Protection & Sensitivity Labels (7)
Tool | Method |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
| GET |
SharePoint administration (25)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| PATCH | medium |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | low |
| PATCH | low |
| DELETE | high |
| GET | |
| POST | low |
| PATCH | low |
| DELETE | medium |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| GET | |
| GET |
Records Management (6)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Teams administration (30)
Tool | Method | Risk |
| GET | |
| POST | medium |
| GET | |
| PATCH | medium |
| DELETE | critical |
| GET | |
| POST | low |
| GET | |
| DELETE | high |
| GET | |
| POST | medium |
| POST | medium |
| GET | |
| GET | |
| POST | medium |
| POST | low |
| POST | medium |
| GET | |
| GET | |
| GET | |
| PATCH | high |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Intune reports (18) -- requires --allow-writes (POST endpoints)
Tool | Method | Risk |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| POST | low |
| GET | |
| POST | low |
Intune partners & infrastructure (10)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Intune app management (11)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Advanced policies (15)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Identity Governance+ (11)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
PIM role management (6)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Identity Protection+ (2)
Tool | Method | Risk |
| GET |
Security advanced (9)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Defender for Identity (24)
Full surface coverage of Microsoft Defender for Identity (DfI) administration via Graph: sensors, sensor candidates (auto-discovery), sensor migration to unified Defender XDR architecture, identity accounts (with break-glass invokeAction for AD on-prem / Okta), audit policy enforcement, and health alerts. Most endpoints are Graph v1.0; sensorMigration is beta-only.
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| PATCH | medium |
| GET | |
| GET | |
| POST | high |
| GET | |
| GET | |
| GET | |
| PATCH | medium |
| POST | medium |
| GET | |
| GET | |
| POST | high |
| GET | |
| GET | |
| PATCH | medium |
| GET | |
| GET | |
| POST | critical |
Notes:
invoke-identity-account-actionis the highest-impact write — performs identity-response actions (disable, enable, forcePasswordReset, revokeAllSessions, requireUserToSignInAgain, markUserAsCompromised) on accounts in their source system (AD on-prem, Okta). Action / provider compatibility:disable/enablefor AD + Okta,forcePasswordResetfor AD only,revokeAllSessionsfor Okta only.regenerate-sensor-deployment-access-keyinvalidates the previous key immediately — coordinate with anyone rolling out new sensors before calling.migrate-sensorsrestarts the sensor service on the target DC during migration to unified Defender XDR — brief capture gap (~minutes). Schedule maintenance windows for production DCs. Beta-only.activate-sensor-candidatestriggers sensor installation on detected hosts using the deployment access key flow. Verify withget-sensor-candidatefirst — wrong serverId installs on the wrong host.update-auto-auditing-configwithenabled=truemakes DfI enforce the recommended Windows advanced audit policies on every sensor host (revert local admin overrides on next heartbeat) — recommended for production.
New Graph permissions required since v0.10.0 / 0.11.1 (must be consented on the app registration):
SecurityIdentitiesSensors.Read.All+SecurityIdentitiesSensors.ReadWrite.All(sensors mgmt)SecurityIdentitiesAutoConfig.Read.All+SecurityIdentitiesAutoConfig.ReadWrite.All(autoAuditingConfiguration)SecurityIdentitiesAccount.Read.All(identityAccounts list/get)SecurityIdentitiesActions.ReadWrite.All(identityAccounts invokeAction — break-glass)SecurityIdentitiesMigration.Read.All+SecurityIdentitiesMigration.ReadWrite.All(sensorMigration, beta)
Threat intelligence+ (7)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Reports+ (5)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Copilot admin (2)
Tool | Method | Risk |
| GET | |
| GET |
Directory+ (5)
Tool | Method | Risk |
| GET | |
| GET | |
| GET | |
| GET | |
| GET |
Application credentials & owners CRUD (11) -- requires --allow-writes
Tool | Method | Risk |
| POST | high |
| POST | high |
| POST | high |
| POST | high |
| POST | high |
| POST | high |
| DELETE | high |
| POST | high |
| PATCH | high |
| DELETE | high |
| POST | medium |
Service Principals CRUD & credentials (10) -- requires --allow-writes
Tool | Method | Risk |
| POST | high |
| DELETE | critical |
| POST | high |
| POST | high |
| POST | high |
| POST | high |
| POST | high |
| POST | high |
| DELETE | high |
| POST | high |
PIM activation & requests (10) -- requires --allow-writes
Tool | Method | Risk |
| POST | critical |
| POST | high |
| POST | critical |
| POST | high |
| POST | high |
| POST | medium |
| POST | high |
| POST | medium |
| POST | high |
| PATCH | high |
Entitlement Management CRUD (12) -- requires --allow-writes
Tool | Method | Risk |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | medium |
| PUT | medium |
| DELETE | high |
| POST | medium |
| POST | low |
| POST | medium |
Lifecycle Workflows CRUD & execution (8) -- requires --allow-writes
Tool | Method | Risk |
| POST | medium |
| PATCH | medium |
| DELETE | high |
| POST | high |
| POST | medium |
| POST | medium |
| PATCH | medium |
| DELETE | high |
Access Reviews CRUD & actions (8) -- requires --allow-writes
Tool | Method | Risk |
| POST | medium |
| PUT | medium |
| DELETE | high |
| POST | high |
| POST | low |
| POST | high |
| POST | high |
| POST | medium |
eDiscovery v2 (Purview) (12) -- writes require --allow-writes
Tool | Method | Risk |
| GET | |
| POST | medium |
| PATCH | medium |
| DELETE | critical |
| POST | medium |
| POST | medium |
| GET | |
| POST | medium |
| POST | high |
| POST | high |
| GET | |
| POST | medium |
Azure AD permissions
Read-only (default)
AccessReview.Read.All
AdministrativeUnit.Read.All
AgentRegistration.Read.All
Agreement.Read.All
AiEnterpriseInteraction.Read.All
APIConnectors.Read.All
AppCatalog.Read.All
Application.Read.All
AppRoleAssignment.Read.All
AttackSimulation.Read.All
AuditLog.Read.All
BitlockerKey.Read.All
CallRecords.Read.All
Chat.ManageDeletion.All
Channel.ReadBasic.All
Chat.Read.All
ChatMember.Read.All
ChatMessage.Read.All
CloudPC.Read.All
ConsentRequest.Read.All
CopilotPolicySettings.Read
CopilotSettings-Internal.ReadWrite.All
CustomAuthenticationExtension.Read.All
CustomSecAttributeDefinition.Read.All
Device.Read.All
DeviceLocalCredential.Read.All
DeviceManagementApps.Read.All
DeviceManagementConfiguration.Read.All
DeviceManagementManagedDevices.Read.All
DeviceManagementRBAC.Read.All
DeviceManagementServiceConfig.Read.All
Directory.Read.All
Domain.Read.All
eDiscovery.Read.All
EntitlementManagement.Read.All
Exchange.ManageAsApp
Group.Read.All
GroupMember.Read.All
IdentityProvider.Read.All
IdentityRiskEvent.Read.All
IdentityRiskyServicePrincipal.Read.All
IdentityRiskyUser.Read.All
IdentityUserFlow.Read.All
InformationProtectionPolicy.Read.All
LifecycleWorkflows.Read.All
MailboxSettings.Read
OnlineMeetingArtifact.Read.All
OnlineMeetings.Read.All
OnPremDirectorySynchronization.Read.All
Organization.Read.All
Policy.Read.All
Printer.Read.All
ProtectionScopes.Compute.All
PrintConnector.Read.All
PrintJob.Read.All
PrivilegedAccess.Read.AzureADGroup
RecordsManagement.Read.All
Reports.Read.All
RoleAssignmentSchedule.Read.Directory
RoleEligibilitySchedule.Read.Directory
RoleManagement.Read.Directory
RoleManagementPolicy.Read.Directory
SecurityAlert.Read.All
SecurityEvents.Read.All
SecurityIdentitiesAccount.Read.All
SecurityIdentitiesAutoConfig.Read.All
SecurityIdentitiesHealth.Read.All
SecurityIdentitiesMigration.Read.All
SecurityIdentitiesSensors.Read.All
SecurityIncident.Read.All
ServiceHealth.Read.All
ServiceMessage.Read.All
SharePointTenantSettings.Read.All
Sites.Read.All
Sites.FullControl.All
SubjectRightsRequest.Read.All
Team.ReadBasic.All
TeamMember.Read.All
TeamsAppInstallation.ReadForTeam.All
TeamworkAppSettings.Read.All
TeamworkDevice.Read.All
ThreatAssessment.Read.All
ThreatHunting.Read.All
ThreatIntelligence.Read.All
User.Invite.All
User.Read.All
UserAuthenticationMethod.Read.AllWrite (incident response, device actions, CA policies, Teams, SharePoint, identity management)
AccessReview.ReadWrite.All
AdministrativeUnit.ReadWrite.All
Application.ReadWrite.All
Application.ReadWrite.OwnedBy
AppRoleAssignment.ReadWrite.All
AttackSimulation.ReadWrite.All
Channel.Create
Channel.Delete.All
CloudPC.ReadWrite.All
Device.ReadWrite.All
DeviceManagementConfiguration.ReadWrite.All
DeviceManagementManagedDevices.PrivilegedOperations.All
DeviceManagementManagedDevices.ReadWrite.All
DeviceManagementServiceConfig.ReadWrite.All
Directory.AccessAsUser.All
Domain.ReadWrite.All
eDiscovery.ReadWrite.All
EntitlementManagement.ReadWrite.All
Group.ReadWrite.All
GroupMember.ReadWrite.All
IdentityRiskyServicePrincipal.ReadWrite.All
IdentityRiskyUser.ReadWrite.All
LifecycleWorkflows.ReadWrite.All
Policy.ReadWrite.AuthenticationMethod
Policy.ReadWrite.ConditionalAccess
PrivilegedAccess.ReadWrite.AzureADGroup
RecordsManagement.ReadWrite.All
RoleAssignmentSchedule.ReadWrite.Directory
RoleEligibilitySchedule.ReadWrite.Directory
RoleManagement.ReadWrite.Directory
RoleManagementPolicy.ReadWrite.Directory
SecurityAlert.ReadWrite.All
SecurityIdentitiesActions.ReadWrite.All
SecurityIdentitiesAutoConfig.ReadWrite.All
SecurityIdentitiesMigration.ReadWrite.All
SecurityIdentitiesSensors.ReadWrite.All
SecurityIncident.ReadWrite.All
Sites.ReadWrite.All
Team.Create
Team.ReadWrite.All
TeamMember.ReadWrite.All
TeamworkAppSettings.ReadWrite.All
User.ReadWrite.All
UserAuthenticationMethod.ReadWrite.AllRemote HTTP deployment
Local HTTP mode
node dist/index.js \
--transport http \
--port 8080 \
--allowed-clients "app-id-1,app-id-2"The --allowed-clients flag is mandatory in HTTP mode. It validates incoming bearer tokens against Microsoft's JWKS endpoint (signature verification, audience, tenant, and client ID checks).
Docker
docker build -t ms365-admin-mcp .
docker run -p 8080:8080 \
-e MS365_ADMIN_MCP_CLIENT_ID=... \
-e MS365_ADMIN_MCP_CLIENT_SECRET=... \
-e MS365_ADMIN_MCP_TENANT_ID=... \
ms365-admin-mcp --allowed-clients "your-app-id"Azure Container Apps
A Bicep template is provided in infra/main.bicep. It deploys:
User-Assigned Managed Identity (UAMI)
Key Vault (RBAC, purge protection, 90-day soft-delete)
Log Analytics workspace + Application Insights
Container App Environment
Container App using the UAMI, with
MS365_ADMIN_MCP_KEYVAULT_URLwired to the vault
MY_OID=$(az ad signed-in-user show --query id -o tsv)
az deployment group create \
--resource-group rg-mcp-admin \
--template-file infra/main.bicep \
--parameters baseName=ms365mcpprod \
containerImage=your-acr.azurecr.io/ms365-admin-mcp:latest \
kvAdminObjectIds="['$MY_OID']"Seed the vault with ms365-admin-mcp-{client-id,tenant-id,client-secret} after deploy — see docs/HTTP_DEPLOYMENT.md.
Development
npm run dev # Run with tsx (hot reload)
npm run generate # Download OpenAPI spec + generate client
npm run build # Build with tsup
npm run test # Run vitest
npm run lint # ESLint
npm run format # Prettier
npm run verify # Full pipeline (generate + lint + format + build + test)
npm run inspector # MCP Inspector for interactive testingAdding a new tool
Add the endpoint entry in
src/endpoints.jsonRun
npm run generateto regenerate the clientThe tool is automatically registered at startup by
registerGraphTools()Run
npm run verifyto validate
Security
Read-only by default -- mutations require
--allow-writesRisk levels on write tools (critical/high/medium/low) with LLM-visible warnings
JWT signature verification via Microsoft JWKS (RS256) in HTTP mode
Mandatory authentication in HTTP mode (
--allowed-clientsrequired)Rate limiting (100 req/min) on the MCP endpoint
Security headers (nosniff, DENY, no-store, CSP)
Non-root Docker user
Sensitive data redacted from logs
Acknowledgments
This project would not exist without Softeria/ms-365-mcp-server. Their work served as the foundation and inspiration for this server — in particular:
The endpoint-driven architecture (
endpoints.json+ auto-registration viagraph-tools.ts)The OpenAPI-based code generation pipeline (
npm run generate→ trimmed Graph spec + Zodios client)The CLI ergonomics (presets,
--list-tools,--list-permissions,--verify-login, MCP Inspector integration)The read-only-by-default +
--allow-writessafety model
This server diverges from Softeria's by targeting application permissions (client credentials via MSAL ConfidentialClientApplication) rather than delegated permissions, and by adding admin-specific capabilities — risk classification on write tools, JWT validation via Microsoft JWKS for HTTP mode, Azure Key Vault integration, and incident-response tooling.
Sincere thanks to the Softeria team and contributors for making their work available under an open license, and for setting a high bar for MCP server design in the Microsoft 365 ecosystem.
License
MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/okapi-ca/ms-365-admin-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server