intune-mcp
intune-mcp
通过 Microsoft Graph API 提供对 Microsoft Intune 的只读访问的 MCP 服务器。允许 Claude(或任何 MCP 客户端)查询托管设备、应用、合规性策略和配置配置文件。
前提条件
Node.js >= 18
具有委派权限的 Azure AD(Entra ID)应用注册
用于自动注册应用的 Azure CLI(
az)(可选)
Related MCP server: azure-query-mcp
快速开始
1. 注册 Azure AD 应用
# Automated (requires Azure CLI + admin consent permissions)
.\scripts\register-app.ps1 -WriteEnv
# Or manually: create a public client app in Entra ID with these delegated permissions:
# - DeviceManagementManagedDevices.Read.All
# - DeviceManagementApps.Read.All
# - DeviceManagementConfiguration.Read.All
# Then create .env:
# AZURE_CLIENT_ID=<your-app-client-id>
# AZURE_TENANT_ID=<your-tenant-id>2. 安装并构建
npm install
npm run build3. 进行身份验证
npm run auth按照设备代码提示,使用您的 Microsoft 帐户登录。
4. 运行
# Stdio mode (for local MCP clients like Claude Code)
npm start
# HTTP mode (for shared/remote deployment)
npm run start:http传输模式
模式 | 标志 | 用途 |
Stdio | (默认) | 本地、单用户、预认证 |
HTTP |
| 共享部署、多会话、每会话认证 |
HTTP 模式会在端口 3000 上启动一个 Express 服务器(可通过 --port 或 PORT 环境变量进行配置),并提供以下端点:
路径 | 方法 | 用途 |
| POST | MCP JSON-RPC(Streamable HTTP) |
| GET | SSE 流,用于服务器通知 |
| DELETE | 会话终止 |
| GET | 健康检查(状态、版本、会话数) |
可用工具
类别 | 工具 | 说明 |
认证 |
| 设备代码登(仅限 HTTP 模式) |
设备 |
| 列出受管设备(支持 OData 筛选) |
设备 |
| 按 ID 获取设备详细信息 |
设备 |
| 按名称、UPN 或序列号搜索 |
应用 |
| 设备上检测到的应用(beta API) |
应用 |
| Intune 中的 LOB/商店/Web 应用 |
合规性 |
| 所有合规性策略 |
合规性 |
| 每台设备的合规性状态 |
合规性 |
| 状态为不合规的设备 |
合规性 |
| 某个策略下每台设备的状态 |
配置配置文件 |
| 设备配置配置文件 |
配置配置文件 |
| 某个配置文件下每台设备的状态 |
配置配置文件 |
| 设备上的配置文件状态 |
所需权限(委派)
DeviceManagementManagedDevices.Read.AllDeviceManagementApps.Read.AllDeviceManagementConfiguration.Read.All
开发
npm run dev # TypeScript watch mode
npm test # Run unit tests
npm run build # Compile to dist/实时验证
针对真实 Intune 租户测试全部 12 个端点(需要事先完成身份验证):
node scripts/validate-tools.mjs架构
MCP Client -> Transport (stdio | HTTP) -> McpServer -> Tool Handlers -> GraphClient -> Microsoft Graph API认证: MSAL 设备代码流程,基于文件的令牌缓存位于
~/.intune-mcp/token-cache.json日志: 结构化 JSON 行,存储于
~/.intune-mcp/logs/intune-mcp.log(10 MB 轮转,保留 5 个文件)Graph 客户端: 自动重试并采用指数退避(429、401、5xx),支持
Retry-After,30 秒请求超时,自动分页最多 10 页HTTP 模式: 每会话认证,30 分钟会话 TTL,100 个会话上限
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only MCP access to a documented IT fleet: state, changes, posture. 15 tools.
XFA's remote MCP server — query device posture, compliance, policies & CVEs. Read-only.
Read-only access to InfluSense influencer discovery, ratings, watchlists, and reports via MCP.
Provides read access to your GKE and Kubernetes resources.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Microsoft 365 services including SharePoint, OneDrive, Outlook, Teams, and Calendar through the Microsoft Graph API, enabling users to search, browse, and retrieve content across their M365 suite.2MIT
- AlicenseAqualityAmaintenanceEnables read-only querying of Azure Log Analytics and Azure Resource Graph through MCP, supporting KQL queries, workspace discovery, and resource inventory exploration with Azure RBAC authentication.11527 npm2MIT
- AlicenseBqualityCmaintenanceA read-only MCP server for Microsoft Intune and Entra ID that enables list, get, search, and reporting operations for tenant visibility, audits, troubleshooting, and health reporting without write actions. It includes authentication helpers, report exports, and metadata discovery tools.361MIT
- FlicenseNot gradedqualityCmaintenanceRead-only MCP server for Microsoft Entra ID (Azure AD) that enables querying user sign-in logs, group memberships, and assigned Microsoft 365 licenses via Microsoft Graph API. Provides security and audit visibility without any write operations.-