M

MCP安全策略管理平台

@DynamicEndpoints/Automated-BOD-25-01-CISA-Microsoft-Policies-MCP
0 Stars 305 次浏览 DynamicEndpoints 更新于 2026-08-23

该MCP服务器根据CSA BOD 25-01对Microsoft 365云服务的要求实现了各种策略。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

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

该服务需要配置环境变量:CLIENT_ID、CLIENT_SECRET、TENANT_ID

可用工具 (21 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

block_legacy_auth

Block legacy authentication (MS.AAD.1.1v1)

该工具无需必填参数,直接调用即可

block_high_risk_users

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

该工具无需必填参数,直接调用即可

block_high_risk_signins

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

该工具无需必填参数,直接调用即可

enforce_phishing_resistant_mfa

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

该工具无需必填参数,直接调用即可

enforce_alternative_mfa

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

该工具无需必填参数,直接调用即可

configure_authenticator_context

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

该工具无需必填参数,直接调用即可

complete_auth_methods_migration

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

该工具无需必填参数,直接调用即可

enforce_privileged_mfa

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

该工具无需必填参数,直接调用即可

restrict_app_registration

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

该工具无需必填参数,直接调用即可

restrict_app_consent

Allow only administrators to consent to applications (MS.AAD.5.2v1)

该工具无需必填参数,直接调用即可

configure_admin_consent

Configure admin consent workflow for applications (MS.AAD.5.3v1)

该工具无需必填参数,直接调用即可

restrict_group_consent

Prevent group owners from consenting to applications (MS.AAD.5.4v1)

该工具无需必填参数,直接调用即可

disable_password_expiry

Disable password expiration (MS.AAD.6.1v1)

该工具无需必填参数,直接调用即可

configure_global_admins 1 个参数 需填 1 项

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

必填参数:userIds

enforce_granular_roles

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

该工具无需必填参数,直接调用即可

enforce_cloud_accounts

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

该工具无需必填参数,直接调用即可

enforce_pam

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

该工具无需必填参数,直接调用即可

configure_global_admin_approval

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

该工具无需必填参数,直接调用即可

configure_role_alerts 1 个参数 需填 1 项

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

必填参数:notificationEmails

configure_admin_alerts 1 个参数 需填 1 项

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

必填参数:notificationEmails

get_policy_status

Get current status of all CISA M365 security policies

该工具无需必填参数,直接调用即可

服务介绍

CISA M365 MCP 服务器

smithery 徽章
这是一个实现 CISA 绑定操作指令 25-01 安全控制的 Model Context Protocol (MCP) 服务器,适用于 Microsoft 365 (Azure AD/Entra ID)。

目录

概述

此 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日

阻止高风险用户和登录:

  • 阻止被检测为高风险的用户
  • 阻止被检测为高风险的登录
  • 利用 Microsoft 的威胁情报

实现细节:

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应用程序:
    • Policy.ReadWrite.All
    • RoleManagement.ReadWrite.All
    • User.Read.All
    • Application.ReadWrite.All

安装

通过Smithery安装

要通过Smithery自动安装CISA M365 MCP Server:

npx -y @smithery/cli install cisa-m365

您还可以直接从Smithery Protocol Directory复制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

阻止遗留的身份验证方法。

{}

block_high_risk_users

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

{}

enforce_phishing_resistant_mfa

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

{}

configure_global_admins

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

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

get_policy_status

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

{}

示例使用

// 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. 提交拉取请求

指南:

  • 遵循现有的代码风格
  • 为新功能添加测试
  • 更新文档
  • 保持提交原子性

许可证

MIT

相关 MCP 服务