๐ 106 Tools. One MCP Server. Claude Desktop + Copilot Studio — Microsoft Purview on Full Autopilot
106 Tools. One MCP Server.
Total Microsoft Purview Control.
The step-by-step guide to building an AI-powered security command center that connects Claude Desktop and Copilot Studio to Microsoft Purview, SharePoint, and the entire M365 security stack.
๐ What You'll Build — 10 Steps
1️⃣ What is MCP and Why Should You Care?
Imagine telling an AI assistant: "Search all Copilot interactions from the last 6 months, generate an analytics report, and upload it to SharePoint" — and it just does it. No scripts. No portals. No clicking through 47 tabs.
Model Context Protocol (MCP) is an open standard created by Anthropic that lets AI assistants like Claude and Microsoft Copilot Studio connect to external tools through a standardized interface.
๐ฏ What This Server Does
Search any M365 audit log
Sites, lists, files, sharing
Usage, security, dashboards
10 MITRE ATT&CK presets
Apply, remove, scan labels
Alerts, eDiscovery, risk
2️⃣ Architecture: How It All Connects
๐ฅ️ Mode 1: Claude Desktop (Local)
☁️ Mode 2: Copilot Studio (Azure)
3️⃣ Create Azure App Registration
App registrations → click + New registrationPurview MCP Server · Single tenant · No redirect URI → Register๐ Create Client Secret
4️⃣ Add API Permissions (18)
Click API permissions → + Add → Microsoft Graph → Application permissions:
| Permission | Purpose | Required |
|---|---|---|
AuditLogsQuery.Read.All | Purview audit search | ✅ |
AuditLog.Read.All | Sign-in + directory logs | ✅ |
Sites.ReadWrite.All | SharePoint | ✅ |
Files.ReadWrite.All | File operations | ✅ |
SecurityAlert.ReadWrite.All | Security alerts | ✅ |
SecurityIncident.ReadWrite.All | Incidents | ✅ |
SecurityEvents.Read.All | Secure Score | ✅ |
IdentityRiskEvent.Read.All | Identity risk | ✅ |
InformationProtectionPolicy.Read.All | Sensitivity labels | ✅ |
Policy.Read.All | Conditional Access | ✅ |
Reports.Read.All | Usage reports | ✅ |
ServiceHealth.Read.All | Service health | ✅ |
Mail.Send | Email notifications | Optional |
5️⃣ Download, Install & Build
๐ฆ Download from GitHub
# Option 1: Clone with Git
git clone https://github.com/PowerofAutomation2026/MCP.git
cd MCP/purview-mcp-server
# Option 2: Download ZIP
# https://github.com/PowerofAutomation2026/MCP → Code → Download ZIP
⭐ PowerofAutomation2026/MCP on GitHub
๐ Prerequisites
1. Node.js 20+ — download from nodejs.org
2. Azure CLI — aka.ms/installazurecliwindows (only for Azure deploy)
๐ Build
cd C:\Projects\purview-mcp-server
npm install
npm run build
dist/ folder.6️⃣ Configure Claude Desktop
Open %APPDATA%\Claude\claude_desktop_config.json and add:
{
"mcpServers": {
"purview": {
"command": "node",
"args": ["C:\\Projects\\purview-mcp-server\\dist\\index.js"],
"env": {
"PURVIEW_TENANT_ID": "ENTER_YOUR_TENANT_ID",
"PURVIEW_CLIENT_ID": "ENTER_YOUR_CLIENT_ID",
"PURVIEW_CLIENT_SECRET": "ENTER_YOUR_SECRET",
"PURVIEW_EXPORT_PATH": "C:\\Projects\\PurviewExports"
}
}
}
}
Save → Create C:\Projects\PurviewExports folder → Fully quit Claude Desktop (system tray → Quit) → Reopen.
7️⃣ Your First Audit Search
Test 1: Connection
Test 2: Create Search
Test 3: Full Pipeline
8️⃣ Deploy to Azure App Service
cd C:\Projects\purview-mcp-server
.\deploy-azure.ps1 `
-TenantId "YOUR_TENANT_ID" `
-ClientId "YOUR_CLIENT_ID" `
-ClientSecret "YOUR_SECRET"
The script handles everything: Azure login, resource creation, build, package with node_modules, deploy, verify health.
๐ง Key Azure Fixes Built In
| Fix | Solution |
|---|---|
| WAM Auth bug | az config set core.enable_broker_on_windows=false |
| Azure build fails | Skip Oryx build, include node_modules in zip |
| Startup resets | Re-apply node dist/web.js after env vars + deploy |
| MCP transport fails | Manual JSON-RPC handler (bypasses SDK) |
| Free tier quota | Auto-detect + offer B1 upgrade |
9️⃣ Connect to Copilot Studio
https://YOUR-APP.azurewebsites.net/mcp๐ All 106 Tools at a Glance
search · status · list · results · delete · export · full pipeline
upload · sites · lists · CRUD · files · sharing · pages · permissions
Exchange · SP · OD · Teams · Entra · PP · Copilot · DLP · Compliance
tracking · pipeline · dashboard · trends · agent security scan
risk scoring · 10 MITRE hunts · executive summary · timeline
list · apply site · apply library · default · extract · remove
alerts · incidents · Secure Score · eDiscovery · risk · KQL · privacy
service health · sign-in logs · CA · usage · Teams · SP · email
๐ง Troubleshooting
| Error | Fix |
|---|---|
segment not found | Auto-retries beta endpoint. Check AuditLogsQuery.Read.All permission. |
403 Forbidden | Grant admin consent (Step 4) |
| Search stuck | Normal — takes 2-15 min. Keep polling. |
403 Site Disabled | Free tier quota exceeded — upgrade to B1 |
| Copilot no tools | Delete old MCP tool, re-add with correct URL |
| Not in Claude | Fully quit (system tray → Quit) + restart |
powerofautomation2025.blogspot.com · GitHub: PowerofAutomation2026/MCP
Purview MCP Server v6.0 · 106 Tools · 12 Modules · 7,628 Lines · TypeScript
© 2026 Power of Automation. All credentials shown are placeholders.
Comments
Post a Comment