Skip to main content
Glama
BOD-25-01-CSA-Microsoft-Policy-MCP

BOD-25-01-CSA-Microsoft-Policy-MCP

CISA M365 MCP 服务器

铁匠徽章为 Microsoft 365 (Azure AD/Entra ID) 实施 CISA 绑定操作指令 25-01 安全控制的模型上下文协议 (MCP) 服务器。

目录

Related MCP server: SharePoint MCP Server

概述

此 MCP 服务器提供根据 BOD 25-01 要求配置和管理 Microsoft 365 安全设置的工具。它与 Microsoft Graph API 集成,以强制执行安全控制、监视合规性并提供详细的报告。

主要特点

  • 旧式身份验证控制

  • 基于风险的访问控制

  • 多因素身份验证管理

  • 应用程序注册和同意控制

  • 密码策略管理

  • 特权角色管理

  • 仅限云的帐户执行

  • PAM系统集成

  • 全面的合规报告

  • 基于令牌的身份验证

  • 类型安全参数验证

  • 详细的错误处理和日志记录

安全控制

MS.AAD.1.1v1

到期日:2025年6月20日

阻止旧式身份验证:

  • 禁用旧式身份验证协议

  • 减少攻击面

  • 改善安全态势

实施细节:

await graphClient
  .api('/policies/authenticationMethodsPolicy')
  .patch({
    allowLegacyAuthentication: false,
    blockLegacyAuthenticationMethods: true,
  });

MS.AAD.2.1v1 和 MS.AAD.2.3v1

到期日:2025年6月20日

阻止高风险用户和登录:

  • 阻止被检测为高风险的用户

  • 阻止被检测为高风险的登录

  • 利用微软的威胁情报

实施细节:

await graphClient
  .api('/policies/identitySecurityDefaultsEnforcementPolicy')
  .patch({
    blockHighRiskUsers: true,
    riskLevelForBlocking: 'high',
  });

MS.AAD.3.1v1、MS.AAD.3.2v1、MS.AAD.3.3v1

到期日:2025年6月20日

MFA 配置:

  • 实施防网络钓鱼 MFA

  • 配置替代的 MFA 方法

  • 在 Microsoft Authenticator 中显示登录上下文

实施细节:

await graphClient
  .api('/policies/authenticationMethodsPolicy')
  .patch({
    policies: {
      fido2: {
        isEnabled: true,
        isSelfServiceRegistrationAllowed: true,
      },
      windowsHelloForBusiness: {
        isEnabled: true,
        isSelfServiceRegistrationAllowed: true,
      },
    },
  });

MS.AAD.5.1v1、MS.AAD.5.2v1、MS.AAD.5.3v1、MS.AAD.5.4v1

到期日:2025年6月20日

应用程序控制:

  • 限制仅管理员注册应用程序

  • 限制仅管理员获得应用许可

  • 配置管理员同意工作流程

  • 阻止群组所有者同意

实施细节:

await graphClient
  .api('/policies/applicationRegistrationManagement')
  .patch({
    restrictAppRegistration: true,
    restrictNonAdminUsers: true,
  });

MS.AAD.6.1v1

到期日:2025年6月20日

密码策略:

  • 禁用密码过期

  • 遵循现代安全最佳实践

实施细节:

await graphClient
  .api('/policies/passwordPolicy')
  .patch({
    passwordExpirationPolicy: {
      passwordExpirationDays: 0,
      neverExpire: true,
    },
  });

MS.AAD.7.1v1 到 MS.AAD.7.8v1

到期日:2025年6月20日

特权角色管理:

  • 限制全局管理员数量

  • 执行细粒度的角色

  • 需要仅限云的帐户

  • 强制使用 PAM 系统

  • 配置审批工作流程

  • 设置警报

实施细节:

await graphClient
  .api('/policies/roleManagementPolicies')
  .patch({
    enforceGranularRoles: true,
    blockGlobalAdminForGeneralUse: true,
    requireApprovalForGlobalAdmin: true,
  });

建筑学

成分

  1. 服务器类

    • 处理 MCP 协议实现

    • 管理工具注册和执行

    • 实现错误处理和日志记录

  2. 验证

    • 使用 Microsoft Graph API 进行基于令牌的身份验证

    • 自动令牌刷新

    • 安全凭证管理

  3. Graph客户端

    • Microsoft Graph API 的包装器

    • 类型安全的请求/响应处理

    • 重试逻辑和错误处理

  4. 工具

    • 旧式身份验证控制

    • 基于风险的访问管理

    • MFA 配置

    • 应用程序控制

    • 密码策略管理

    • 角色管理

    • 警报配置

    • 政策状态报告

数据流

graph TD
    A[MCP Client] -->|Request| B[MCP Server]
    B -->|Authentication| C[Token Manager]
    C -->|Access Token| D[Graph Client]
    D -->|API Calls| E[Microsoft Graph]
    E -->|Response| D
    D -->|Results| B
    B -->|Response| A

先决条件

  • Node.js 18.x 或更高版本

  • 具有管理员访问权限的 Microsoft 365 租户

  • 具有所需权限的 Azure AD 应用程序:

    • 策略.读写.全部

    • 角色管理.读写.全部

    • 用户.读取.全部

    • 应用程序.读写.全部

安装

通过 Smithery 安装

要通过Smithery自动安装 CISA M365 MCP 服务器:

npx -y @smithery/cli install cisa-m365

您还可以直接从Smithery 协议目录复制 MCP 设置和定义,并将 MCP 服务器添加到支持 MCP 协议的 Claude 或 LLM 设置中。

  1. 克隆存储库:

git clone https://github.com/DynamicEndpoints/BOD-25-01-CSA-MCP.git
cd cisa-m365
  1. 安装依赖项:

npm install
  1. 构建服务器:

npm run build

配置

  1. 创建 Azure AD 应用程序:

    • 导航至 Azure 门户 > Azure Active Directory

    • 注册新应用程序

    • 添加所需的 API 权限

    • 创建客户端机密

  2. 配置环境变量:

cp .env.example .env

编辑.env文件:

TENANT_ID=your-tenant-id
CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
  1. 配置 MCP 设置:

{
  "mcpServers": {
    "cisa-m365": {
      "command": "node",
      "args": ["path/to/cisa-m365/build/index.js"],
      "env": {
        "TENANT_ID": "your-tenant-id",
        "CLIENT_ID": "your-client-id",
        "CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

用法

可用工具

block_legacy_auth

阻止传统的身份验证方法。

{}

阻止高风险用户

阻止被检测为高风险的用户。

{}

强制执行防钓鱼_mfa

对所有用户强制实施防网络钓鱼的 MFA。

{}

配置全局管理员

配置全局管理员角色分配。

{
  "userIds": ["user1-id", "user2-id"]
}

获取策略状态

获取所有安全策略的当前状态。

{}

示例用法

// Block legacy authentication
const result = await client.callTool('block_legacy_auth', {});

// Get policy status
const status = await client.callTool('get_policy_status', {});

API 参考

策略设置 API

interface PolicySettings {
  legacyAuthentication: {
    blocked: boolean;
    compliant: boolean;
  };
  highRiskUsers: {
    blocked: boolean;
    compliant: boolean;
  };
  mfa: {
    phishingResistant: boolean;
    alternativeEnabled: boolean;
    compliant: boolean;
  };
  applications: {
    registrationRestricted: boolean;
    consentRestricted: boolean;
    compliant: boolean;
  };
  passwords: {
    expirationDisabled: boolean;
    compliant: boolean;
  };
  roles: {
    globalAdminCount: number;
    granularRolesEnforced: boolean;
    pamEnforced: boolean;
    compliant: boolean;
  };
}

错误处理

服务器实现了全面的错误处理:

  1. 身份验证错误

    • 令牌获取失败

    • 权限问题

    • 租户配置问题

  2. API 错误

    • Graph API 请求失败

    • 速率限制

    • 服务不可用

  3. 验证错误

    • 无效参数

    • 缺少必需参数

    • 类型不匹配

  4. 运行时错误

    • 网络问题

    • 超时问题

    • 资源限制

错误响应示例:

{
  "error": {
    "code": "InvalidParams",
    "message": "Invalid role assignment arguments",
    "details": {
      "parameter": "userIds",
      "constraint": "Must have between 2 and 8 users",
      "received": "1 user"
    }
  }
}

测试

  1. 运行单元测试:

npm test
  1. 运行集成测试:

npm run test:integration
  1. 运行合规性测试:

npm run test:compliance

安全注意事项

  1. 验证

    • 使用安全令牌存储

    • 实施代币轮换

    • 监控可疑活动

  2. API 访问

    • 遵循最小特权原则

    • 定期权限审核

    • 监控 API 使用情况

  3. 数据保护

    • 无敏感数据记录

    • 安全配置存储

    • 定期安全扫描

  4. 遵守

    • 定期合规性检查

    • 自动策略验证

    • 审计日志

贡献

  1. 分叉存储库

  2. 创建功能分支

  3. 进行更改

  4. 运行测试

  5. 提交拉取请求

指南:

  • 遵循现有的代码风格

  • 添加新功能测试

  • 更新文档

  • 保持提交的原子性

执照

麻省理工学院

Available Tools

21 tools
block_high_risk_signinsB

Block sign-ins detected as high risk (MS.AAD.2.3v1)

Inputs: no named parameters.

block_high_risk_usersB

Block users detected as high risk (MS.AAD.2.1v1)

Inputs: no named parameters.

block_legacy_authB

Block legacy authentication (MS.AAD.1.1v1)

Inputs: no named parameters.

complete_auth_methods_migrationC

Set Authentication Methods Manage Migration to Complete (MS.AAD.3.4v1)

Inputs: no named parameters.

configure_admin_alertsC

Configure alerts for Global Administrator activation (MS.AAD.7.8v1)

Inputs: notificationEmails (required).

configure_authenticator_contextB

Configure Microsoft Authenticator to show login context (MS.AAD.3.3v1)

Inputs: no named parameters.

configure_global_admin_approvalB

Configure approval requirement for Global Administrator activation (MS.AAD.7.6v1)

Inputs: no named parameters.

configure_global_adminsC

Configure Global Administrator role assignments (MS.AAD.7.1v1)

Inputs: userIds (required).

configure_role_alertsC

Configure alerts for privileged role assignments (MS.AAD.7.7v1)

Inputs: notificationEmails (required).

disable_password_expiryB

Disable password expiration (MS.AAD.6.1v1)

Inputs: no named parameters.

enforce_alternative_mfaB

Enforce alternative MFA method if phishing-resistant MFA not enforced (MS.AAD.3.2v1)

Inputs: no named parameters.

enforce_cloud_accountsB

Enforce cloud-only accounts for privileged users (MS.AAD.7.3v1)

Inputs: no named parameters.

enforce_granular_rolesB

Enforce use of granular roles instead of Global Administrator (MS.AAD.7.2v1)

Inputs: no named parameters.

enforce_pamB

Enforce PAM system for privileged role assignments (MS.AAD.7.5v1)

Inputs: no named parameters.

enforce_phishing_resistant_mfaC

Enforce phishing-resistant MFA for all users (MS.AAD.3.1v1)

Inputs: no named parameters.

enforce_privileged_mfaB

Enforce phishing-resistant MFA for privileged roles (MS.AAD.3.6v1)

Inputs: no named parameters.

get_policy_statusB

Get current status of all CISA M365 security policies

Inputs: no named parameters.

restrict_app_registrationB

Allow only administrators to register applications (MS.AAD.5.1v1)

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 21 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting specific security policy controls - blocking sign-ins vs. users, configuring different admin workflows, enforcing various MFA methods, restricting different consent types. The descriptions with MS.AAD codes further clarify boundaries, leaving no ambiguity about which tool to use for each security requirement.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern using snake_case throughout - every tool starts with an action verb (block, complete, configure, disable, enforce, get, restrict) followed by a specific noun phrase describing the security control. This creates a highly predictable and readable naming convention across all 21 tools.

    Tool Count4/5

    21 tools is slightly high but reasonable for the comprehensive CISA M365 security policy domain. The server covers authentication methods, admin controls, application consent, and privileged access management - each area requiring multiple specific controls. While borderline heavy, each tool addresses a distinct security requirement that earns its place in the set.

    Completeness5/5

    The tool set provides complete coverage for CISA M365 security policy implementation with get_policy_status for assessment and enforcement tools for every major control area: authentication methods (MFA, migration), admin security (global admins, alerts, PAM), and application governance (consent, registration). There are no obvious gaps - agents can implement the full security framework without dead ends.

    Related MCP Connectors

    Related MCP Servers