griffin31-m365-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.
Griffin31 M365 MCP
Safe Microsoft 365 admin from your AI assistant. Read freely, change only with approval, always with a backup.
An open-source Model Context Protocol server by Griffin31 for Microsoft Entra ID, Conditional Access, Intune, SharePoint and Microsoft Defender, built on Microsoft Graph.
Status: skeleton, not production-ready. This is a starter kit. The safety core works and is tested (tenant isolation, two-step approval, backups and restore, two auth modes), but it ships with only a few example tools. We run a much larger, heavily customized version ourselves. Rather than publish our personal setup, we're opening the core so we can build the rest together. Contributions are welcome. See CONTRIBUTING.md and the roadmap.
Try it in a test tenant first. Read SECURITY.md before you point it at a production tenant.
Why another M365 MCP server?
Most Graph MCP servers give an AI model one powerful token and hope for the best. This one is built around how a careful admin actually works:
Principle | How it's enforced |
One tenant per session | The server is pinned to one tenant ID. Every tool call must name that tenant, and every token's |
Read and write are different identities | Certificate mode uses two app registrations. The read-only app handles every read. The admin app's key isn't even loaded until an approved change is applied. If the read app ever holds a write permission, the server refuses to use it. |
No change without a human yes | Changes take two steps. A |
Backup before every write | The current object's JSON is saved to a local backups folder before the write. If the backup can't be written, nothing is changed. |
Writes are off by default | Write tools aren't even registered unless you set |
Related MCP server: Minerva MCP
Quick start
Requirements: Node.js 20+ and a Microsoft 365 tenant where you can register apps (use a test tenant first).
git clone https://github.com/griffin31-public/griffin31-m365-mcp.git
cd griffin31-m365-mcp
npm install
npm test # runs against a mock Graph, no tenant needed
npm run buildCreate the app registrations and certificates: docs/setup-app-registrations.md.
Copy
.env.example(orconfig.example.json) and fill in your own values.Add the server to your MCP client.
Claude Code
claude mcp add griffin31-m365 \
-e G31_TENANT_ID=<TENANT_ID> \
-e G31_READ_CLIENT_ID=<READ_APP_CLIENT_ID> \
-e G31_READ_CERT_PATH=/secure/path/read.pem \
-- node /path/to/griffin31-m365-mcp/dist/index.jsClaude Desktop and other clients (mcpServers JSON)
{
"mcpServers": {
"griffin31-m365": {
"command": "node",
"args": ["/path/to/griffin31-m365-mcp/dist/index.js"],
"env": {
"G31_TENANT_ID": "<TENANT_ID>",
"G31_READ_CLIENT_ID": "<READ_APP_CLIENT_ID>",
"G31_READ_CERT_PATH": "/secure/path/read.pem"
}
}
}
}To enable changes, also set G31_ALLOW_WRITES=true, G31_ADMIN_CLIENT_ID and G31_ADMIN_CERT_PATH. To manage a second tenant, add a second server entry with its own tenant ID and apps. One process never serves two tenants.
Configuration
Set these as environment variables, or put them in a JSON file and point G31_M365_CONFIG at it. Environment variables override the file.
Variable | Meaning |
| Tenant ID (GUID). Required. Domains and placeholders are rejected. |
|
|
| Read-only app and its PEM (certificate + private key). |
| Admin app (same pattern as the read app). Only needed when writes are on. |
| Delegated mode: public client app ID; |
|
|
| How long a plan stays valid (default 15, max 120). |
| Token cache, backups, audit log. Default |
Tools
Every tenant-bound tool takes a required tenantId, which must match the pinned tenant.
Read (read-only app or read scopes)
Tool | What it does |
| Pinned tenant, auth mode, whether writes are on, whether the admin credential is loaded. |
| Delegated mode. Starts a device-code sign-in and returns the code to show the user. |
| Users ( |
| Groups ( |
| Conditional Access policies: summary list, or one policy in full. |
| Device compliance policies. |
| Device configuration profiles (template-based). |
| Tenant-wide SharePoint and OneDrive settings (sharing capability and more). |
| Latest Microsoft Secure Score and percentage, with per-control scores on request. |
| Microsoft Defender XDR incidents. |
| Backups taken before changes. |
Write (only when G31_ALLOW_WRITES=true)
Tool | What it does |
| Plans a new CA policy. It defaults to report-only unless you set a state. |
| Plans a partial update to a CA policy. |
| Plans setting a CA policy to on, off or report-only. |
| Plans a partial update to a compliance policy. |
| Plans the undo of an earlier change from its backup. |
| Shows or drops pending plans. |
| Applies a plan. Needs |
Plan tools also return warnings, for example when a CA policy targets all users with no exclusions (break-glass lock-out risk), blocks access, or is set to enforce right away.
Exact Microsoft Graph permissions for each tool and mode are in docs/permissions.md.
Safety model
plan tool ──read app──▶ Graph GET → change ID + diff + warnings (nothing written)
│
human reviews the diff, says yes
│
change_apply(changeId, confirm=true)
├─ load admin credential (first time only)
├─ re-read object, refuse if it changed since the plan
├─ save backup JSON (refuse to continue if this fails)
├─ PATCH / POST / DELETE
└─ re-read and verify, write audit recordTenant pinning:
tenant.jsonin the tenant's folder, atenantIdargument on every call, and atidcheck on every token.Least privilege: the read app holds read permissions only, and the server checks this. The admin app holds just the write permissions the write tools need.
Audit: every plan outcome (applied, failed, discarded, expired) is written to
<data dir>/tenants/<tenant id>/changes/.Local secrets: certificates and keys stay on your machine. Backups can contain tenant configuration, so treat that folder as sensitive.
Details and threat model: SECURITY.md.
Roadmap
The core is the hard part. Each item below is mostly one well-scoped tool plus a permission row and a test, which makes them good first contributions:
Entra: get a user or group, group members, directory role assignments, PIM eligibility, named locations, authentication methods policy, sign-in and audit logs.
Conditional Access: what-if evaluation, policy templates, export/import of a baseline.
Intune: settings catalog policies, endpoint security policies, assignments, update rings, apps;
intune_plan_update_device_configuration.SharePoint: site search and per-site sharing,
sharepoint_plan_update_tenant_settings.Defender: alerts (
alerts_v2), secure score control profiles, advanced hunting.Exchange Online: a separate, isolated module (it isn't Graph).
Platform: a certificate in the OS keychain instead of a PEM file, an HTTP transport with auth, change approval through a second person, packaging on npm.
Open an issue before you start on a big one, so we can agree on the shape.
Check your tenant against these controls
This server lets an assistant read and change settings. It doesn't tell you which settings matter. Griffin31 continuously checks your Microsoft 365 tenant against a large catalog of security recommendations (Conditional Access, Intune, Defender, SharePoint, Exchange and more), maps them to frameworks such as CIS, and tells you what to fix first.
Check your tenant at www.griffin31.com →
Related: Argus
Also from Griffin31: Argus. Website: argus.griffin31.com. Source: github.com/griffin31-public/argus.
Contributing
Issues and pull requests are welcome. Read CONTRIBUTING.md first. In short: every tool lists its exact permissions, tests run without a tenant, and no real IDs or secrets ever go into the repo.
License
MIT © Griffin31 and contributors.
Microsoft, Microsoft 365, Entra, Intune, SharePoint and Defender are trademarks of the Microsoft group of companies. This project is not affiliated with or endorsed by Microsoft.
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
Copilot connector permission audits with owner signoff receipts.
Human-in-the-loop review and approval for AI agents. Audit trail, approval policies, native MCP.
Read-only finance and operations controls for AI agents with evidence and safe next actions.
Governed memory and workspace for any AI: tasks, calendar, mail and pages, with per-action consent.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants and automation tools to manage Microsoft 365, Entra ID, and Intune resources through 32 tools for user/device/file management and infrastructure monitoring.8MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to administer Microsoft 365 and Azure, including PowerShell-only areas like Exchange, SharePoint, Teams, and Purview, with risk classification and human approval for write operations.59 npm2MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to query Microsoft Defender XDR telemetry for read-only threat hunting, incident triage, and vulnerability discovery using delegated per-user authentication and production guardrails.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to perform read/write management of Microsoft Intune and Entra ID across devices, apps, users, groups, Conditional Access, Cloud PC, compliance, and reports via Microsoft Graph.MIT