Skip to main content
Glama
wojtekkura

Purple AI MCP Server

by wojtekkura

Purple AI MCP 服务器

License: MIT

Purple AI MCP 服务器允许您使用任何 MCP 客户端访问 SentinelOne 服务。

功能

此服务器通过模型上下文协议 (MCP) 公开 SentinelOne 平台:

  • Purple AI:询问安全问题,调查威胁

  • 事件:在您的 SentinelOne 数据湖中的事件上运行 PowerQuery

  • 警报:查询、搜索和调查警报

  • 漏洞:跟踪 CVE 和安全发现

  • 错误配置:分析安全态势问题

  • 清单:询问有关端点、云资源、身份和网络设备的问题

Purple AI MCP 是一项只读服务 - 您无法通过此 MCP 对您的账户或账户内的任何对象进行更改。

Related MCP server: Sprinklr MCP Server

快速入门

使用 uv(推荐用于本地开发或部署)

# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

# Store your token securely (one-time setup, see Secure Token Storage below)
uvx --from git+https://github.com/Sentinel-One/purple-mcp.git purple-mcp-store-token

# Set base URL
export PURPLEMCP_CONSOLE_BASE_URL="https://your-console.sentinelone.net"

# Run
uvx --from git+https://github.com/Sentinel-One/purple-mcp.git purple-mcp --mode=stdio

⚠️ 安全说明 ⚠️

对于生产环境或对安全敏感的环境,请锁定到特定的提交哈希,而不是使用默认分支,以降低来自我们的 发布版本 或我们在 main 分支中经过验证的提交所带来的供应链风险。

# Run with pinned hash
uvx --from git+https://github.com/Sentinel-One/purple-mcp.git@<commit-hash> purple-mcp --mode=stdio

安全令牌存储(推荐)

与其将 PURPLEMCP_CONSOLE_TOKEN 保存在明文配置文件或环境变量中,不如将其存储在操作系统的凭据管理器中。这在 Windows 上使用 Windows 凭据管理器,在 macOS 上使用 钥匙串 (Keychain),或在 Linux 上使用 Secret Service。

1. 存储您的令牌(一次性设置):

uvx --from git+https://github.com/Sentinel-One/purple-mcp.git purple-mcp-store-token

系统将提示您输入并确认令牌。输入内容将被隐藏。

2. 更新您的客户端配置以从 env 中删除 PURPLEMCP_CONSOLE_TOKEN:

{
  "mcpServers": {
    "purple-mcp": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Sentinel-One/purple-mcp.git", "purple-mcp", "--mode", "stdio"],
      "env": {
        "PURPLEMCP_CONSOLE_BASE_URL": "https://your-console.sentinelone.net"
      }
    }
  }
}

令牌会在启动时自动从凭据存储中检索。如果 PURPLEMCP_CONSOLE_TOKEN 也被设置为环境变量,则环境变量优先。

要删除已存储的令牌:

uvx --from git+https://github.com/Sentinel-One/purple-mcp.git purple-mcp-delete-token

手动将令牌添加到 Windows 凭据管理器

如果您更喜欢直接添加令牌而不运行 purple-mcp-store-token 命令,请使用 PowerShell:

cmdkey /generic:"purple-mcp/PURPLEMCP_CONSOLE_TOKEN" /user:"PURPLEMCP_CONSOLE_TOKEN" /pass:"your-token-here"

验证它是否已存储:

cmdkey /list:purple-mcp*

删除它:

cmdkey /delete:"purple-mcp/PURPLEMCP_CONSOLE_TOKEN"

使用 Docker

# Build the image
docker build -t purple-mcp:latest .

docker run -p 8000:8000 \
  -e PURPLEMCP_CONSOLE_TOKEN="your_token" \
  -e PURPLEMCP_CONSOLE_BASE_URL="https://your-console.sentinelone.net" \
  -e MCP_MODE=streamable-http \
  purple-mcp:latest

注意: Docker 容器无法访问宿主操作系统的凭据存储,因此必须将 PURPLEMCP_CONSOLE_TOKEN 作为环境变量传递。请使用您平台的密钥管理(例如 Docker secrets、AWS Secrets Manager)以避免硬编码。

使用 Amazon Bedrock AgentCore

请按照 此处 的 Amazon Bedrock AgentCore 部署说明进行操作。

使用 Amazon Elastic Container Service (ECS)

请按照 此处 的 Amazon Elastic Container Service 部署说明进行操作。

对于生产部署,请参阅 部署指南。

注意: Purple AI MCP 不包含内置身份验证。对于暴露在网络上的部署,请将其置于反向代理或负载均衡器之后。请参阅 生产设置 以获取云负载均衡器配置(AWS ALB、GCP Cloud Load Balancing、Azure Application Gateway)或自托管部署的 nginx 示例。


您的令牌需要账户或站点级别的权限(而非全局权限)。请从控制台的“策略与设置”→“用户管理”→“服务用户”中获取一个。目前,此服务器仅支持有权访问单个账户或站点的令牌。如果您需要访问多个站点,则需要使用特定于账户或站点的令牌运行多个 MCP 服务器。

客户端

Purple AI MCP 支持 stdio、sse 和 streamable-http 协议,应可在任何支持 MCP 的客户端中工作。下面列出了一些示例配置。

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 %APPDATA%/Claude/claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "purple-mcp": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Sentinel-One/purple-mcp.git", "purple-mcp", "--mode", "stdio"],
      "env": {
        "PURPLEMCP_CONSOLE_BASE_URL": "https://your-console.sentinelone.net"
      }
    }
  }
}

Claude Code

在终端中运行此命令:

claude mcp add --transport stdio purple-mcp --env PURPLEMCP_CONSOLE_BASE_URL=https://your-console.sentinelone.net -- uvx --from git+https://github.com/Sentinel-One/purple-mcp.git purple-mcp --mode stdio

OpenAI Codex

在终端中运行此命令:

codex mcp add purple-mcp --env PURPLEMCP_CONSOLE_BASE_URL=https://your-console.sentinelone.net -- uvx --from git+https://github.com/Sentinel-One/purple-mcp.git purple-mcp --mode stdio

Pydantic AI

以下是一些将 Purple MCP 与 Pydantic AI Agent 一起使用的 Python 代码示例。

from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio

server = MCPServerStdio(
    'uvx', args=["--from", "git+https://github.com/Sentinel-One/purple-mcp.git", "purple-mcp", "--mode", "stdio"], timeout=10
)
agent = Agent('anthropic:claude-haiku-4-5', toolsets=[server])

Zed

编辑 ~/.zed/mcp.json:

{
  "mcpServers": {
    "purple-mcp": {
      "enabled": true,
      "source": "custom",
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Sentinel-One/purple-mcp.git", "purple-mcp", "--mode", "stdio"],
      "env": {
        "PURPLEMCP_CONSOLE_BASE_URL": "https://your-console.sentinelone.net"
      }
    }
  }
}

其他客户端

为了调试或为多个客户端托管服务器,请以 streamable-http 模式运行并通过 mcp-remote 连接:

# Terminal 1: Start server
export PURPLEMCP_CONSOLE_BASE_URL="https://your-console.sentinelone.net"
uvx --from git+https://github.com/Sentinel-One/purple-mcp.git purple-mcp --mode streamable-http --host localhost --port 8000

# Terminal 2: Connect with any client
npx -y mcp-remote http://127.0.0.1:8000/mcp

我们建议您目前不要在网络上暴露 Purple AI MCP,因为没有强制执行身份验证,任何人都可以访问已配置的 SentinelOne 账户。

可用工具

Purple AI

  • purple_ai(query) - 询问安全问题

数据湖

  • powerquery(query, start_time, end_time) - 运行 PowerQuery 分析

警报

  • get_alert(alert_id) - 获取警报详情

  • list_alerts(first, after, view_type) - 列出最近的警报

  • search_alerts(filters, first) - 使用过滤器搜索

  • get_alert_notes(alert_id) - 获取警报评论

  • get_alert_history(alert_id) - 查看警报时间线

漏洞

  • get_vulnerability(id) - 获取漏洞详情

  • list_vulnerabilities(first, after) - 列出最近的漏洞

  • search_vulnerabilities(filters, first) - 搜索 CVE 和发现

  • get_vulnerability_notes(id) - 获取评论

  • get_vulnerability_history(id) - 查看时间线

错误配置

  • get_misconfiguration(id) - 获取错误配置详情

  • list_misconfigurations(first, after) - 列出最近的问题

  • search_misconfigurations(filters, first) - 按条件搜索

  • get_misconfiguration_notes(id) - 获取评论

  • get_misconfiguration_history(id) - 查看时间线

资产清单

  • get_inventory_item(item_id) - 获取资产详情

  • list_inventory_items(limit, skip, surface) - 按表面类型列出资产

  • search_inventory_items(filters, limit) - 使用高级过滤器搜索

环境变量

  • PURPLEMCP_CONSOLE_TOKEN - 服务用户令牌(账户或站点级别)

  • PURPLEMCP_CONSOLE_BASE_URL - 控制台 URL(例如 https://console.sentinelone.net)

  • PURPLEMCP_TRANSPORT_MODE - MCP 传输模式:stdio(默认)、sse 或 streamable-http

  • PURPLEMCP_STATELESS_HTTP - 为无服务器部署(例如 Amazon Bedrock AgentCore)启用无状态 HTTP 模式 - 请参阅 部署指南

开发

我们欢迎您的拉取请求或问题提交。

设置

# Install all dependencies
uv sync --group dev --group test

# Format and lint
uv run ruff format
uv run ruff check
uv run mypy

测试

# Run unit tests
uv run pytest tests/unit/ -v

# Run integration tests (requires .env.test with real credentials)
uv run pytest tests/integration/ -v

# All tests with coverage
uv run pytest --cov=src/purple_mcp --cov-report=html

故障排除

  • 身份验证错误:检查您的令牌是否具有账户/站点级别权限(而非全局权限),并且您的令牌尚未过期

  • PowerQuery 未返回预期结果:检查您的令牌是否具有账户/站点级别权限(而非全局权限)

  • 连接失败:验证您的控制台 URL 和网络访问;使用 --verbose 获取调试日志

许可证

本项目采用 MIT 许可证 - 有关详细信息,请参阅 LICENSE 文件。

支持

对于此 MCP 服务器的问题,请 提交问题。

本项目是开源且社区驱动的。虽然它不是 SentinelOne 的官方产品,但它由 SentinelOne 与更广泛的开源开发者社区合作维护。有关更多信息,请参阅我们的 LICENSE 文件。

对于 SentinelOne 平台支持,请使用相应的 支持渠道。

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    Enables MCP clients to interact with SentinelOne's cybersecurity platform for security analysis, threat investigation, and asset management through natural language queries. Provides read-only access to alerts, vulnerabilities, misconfigurations, and inventory data.
    33
    99
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants read-only access to Sprinklr data via MCP, allowing querying reports, searching cases, and calling Sprinklr API endpoints.
    5 npm
    ISC
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides read-only, guarded access to business databases via MCP. Enables natural language querying with built-in security barriers like table allowlists, PII masking, and audit logging.
    MIT