GitHits
Search public open-source code, documentation, metadata, vulnerabilities, changelogs, and examples.
Read-only Petra Security MCP: M365 compromise incidents, failed attacks, posture, tenants, usage.
列表按使用分(满分 100)排序,由以下部分组成
| 热度 | 0/80 | GitHub 星标或每周下载量:较大的计 60,较小的计 20 |
|---|---|---|
| 新鲜度 | 12/12 | 30 天内有发布或代码更新得满分 |
| 仍在响应 | 0/8 | 上次检查时云端端点有响应 |
| 使用分 | 12/100 |
质量: 基础检查通过 2/3 项(仅展示,不用于排序) · 上升势头: 暂无数据 (只用于“上升中”标签)
选择你使用的 AI 应用,然后复制设置。
用一句话让 AI 帮你安装
请帮我安装 Petra Security。按照 https://mcp.popnx.com/i/wyre-ai-petra-mcp.md 操作,先把命令给我看,等我同意后再运行。粘贴到能在你电脑上工作的 AI(如 Claude Code、Cursor)。它会读取我们的步骤,先给你看命令,等你同意。无需密钥,无需注册。 · 查看 AI 会读取的全文
通过 2/3 项检查 · 在你的电脑上运行 · ✓ 命令已检查 2026年11月14日
第一步:你用哪个 AI?
选择你用的应用,步骤会显示在下方。
可连接 Claude,但需要先准备
需要 Petra Security 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
把这段话复制到 Claude 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 Claude 安装 MCP server Petra Security,按顺序:1) 用 docker --version 检查是否有 Docker。没有的话,请让我从 https://www.docker.com/products/docker-desktop/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "petra": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "PETRA_API_KEY", "-e", "AUTH_MODE", "ghcr.io/wyre-ai/petra-mcp:v1.0.1" ], "env": { "PETRA_API_KEY": "your-value", "AUTH_MODE": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) PETRA_API_KEY, AUTH_MODE 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 Petra Security 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --versionMac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号: docker --version
安装一次,所有需要 Docker 的工具都能用
SettingsDeveloperEdit Config
{
"mcpServers": {
"petra": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PETRA_API_KEY",
"-e",
"AUTH_MODE",
"ghcr.io/wyre-ai/petra-mcp:v1.0.1"
],
"env": {
"PETRA_API_KEY": "your-value",
"AUTH_MODE": "your-value"
}
}
}
}只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
用 Petra Security 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude 说正在使用 Petra Security,或回答中出现 Petra Security 的工具名称,就表示连接成功
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
MCP_TRANSPORT 服务器的传输模式。本地 CLI 使用时设为 'stdio';镜像默认为 'http',用于网关托管。 LOG_LEVEL 日志详细程度:debug、info、warn、error 说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
ChatGPT 暂时无法连接 Petra Security
Petra Security 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器
A · 使用能连接 Petra Security 的应用
B · 网络安全 类中能连接 ChatGPT 的其他服务器
从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的
可连接 Claude Code,但需要先准备
需要 Petra Security 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
把这段话复制到 Claude Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 Claude Code 安装 MCP server Petra Security,按顺序:1) 用 docker --version 检查是否有 Docker。没有的话,请让我从 https://www.docker.com/products/docker-desktop/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):claude mcp add --scope user petra --env PETRA_API_KEY=your-value --env AUTH_MODE=your-value -- docker run -i --rm -e PETRA_API_KEY -e AUTH_MODE ghcr.io/wyre-ai/petra-mcp:v1.0.1 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) PETRA_API_KEY, AUTH_MODE 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 Petra Security 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --versionMac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号: docker --version
安装一次,所有需要 Docker 的工具都能用
Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell
claude mcp add --scope user petra --env PETRA_API_KEY=your-value --env AUTH_MODE=your-value -- docker run -i --rm -e PETRA_API_KEY -e AUTH_MODE ghcr.io/wyre-ai/petra-mcp:v1.0.1按 Enter 前,把“your-value”改成你的密钥
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
应能看到 Petra Security 在列表中并显示已连接
用 Petra Security 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude Code 说正在使用 Petra Security,或回答中出现 Petra Security 的工具名称,就表示连接成功
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
MCP_TRANSPORT 服务器的传输模式。本地 CLI 使用时设为 'stdio';镜像默认为 'http',用于网关托管。 LOG_LEVEL 日志详细程度:debug、info、warn、error 说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
可连接 Cursor,但需要先准备
需要 Petra Security 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
把这段话复制到 Cursor 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 Cursor 安装 MCP server Petra Security,按顺序:1) 用 docker --version 检查是否有 Docker。没有的话,请让我从 https://www.docker.com/products/docker-desktop/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "petra": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "PETRA_API_KEY", "-e", "AUTH_MODE", "ghcr.io/wyre-ai/petra-mcp:v1.0.1" ], "env": { "PETRA_API_KEY": "your-value", "AUTH_MODE": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) PETRA_API_KEY, AUTH_MODE 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 Petra Security 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --versionMac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号: docker --version
安装一次,所有需要 Docker 的工具都能用
在 Petra Security 的设置中,PETRA_API_KEY, AUTH_MODE 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
用 Petra Security 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Cursor 说正在使用 Petra Security,或回答中出现 Petra Security 的工具名称,就表示连接成功
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
MCP_TRANSPORT 服务器的传输模式。本地 CLI 使用时设为 'stdio';镜像默认为 'http',用于网关托管。 LOG_LEVEL 日志详细程度:debug、info、warn、error 说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同
可连接 VS Code,但需要先准备
需要 Petra Security 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
把这段话复制到 VS Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 VS Code 安装 MCP server Petra Security,按顺序:1) 用 docker --version 检查是否有 Docker。没有的话,请让我从 https://www.docker.com/products/docker-desktop/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "servers": { "petra": { "type": "stdio", "command": "docker", "args": [ "run", "-i", "--rm", "-e", "PETRA_API_KEY", "-e", "AUTH_MODE", "ghcr.io/wyre-ai/petra-mcp:v1.0.1" ], "env": { "PETRA_API_KEY": "your-value", "AUTH_MODE": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) PETRA_API_KEY, AUTH_MODE 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 Petra Security 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --versionMac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号: docker --version
安装一次,所有需要 Docker 的工具都能用
在 Petra Security 的设置中,PETRA_API_KEY, AUTH_MODE 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
用 Petra Security 告诉我你能帮我做什么,然后做一件给我看✓ 如果 VS Code 说正在使用 Petra Security,或回答中出现 Petra Security 的工具名称,就表示连接成功
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
MCP_TRANSPORT 服务器的传输模式。本地 CLI 使用时设为 'stdio';镜像默认为 'http',用于网关托管。 LOG_LEVEL 日志详细程度:debug、info、warn、error 说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同
Claude Code
claude mcp add --scope user petra --env PETRA_API_KEY=your-value --env AUTH_MODE=your-value -- docker run -i --rm -e PETRA_API_KEY -e AUTH_MODE ghcr.io/wyre-ai/petra-mcp:v1.0.1Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"petra": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PETRA_API_KEY",
"-e",
"AUTH_MODE",
"ghcr.io/wyre-ai/petra-mcp:v1.0.1"
],
"env": {
"PETRA_API_KEY": "your-value",
"AUTH_MODE": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"petra": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PETRA_API_KEY",
"-e",
"AUTH_MODE",
"ghcr.io/wyre-ai/petra-mcp:v1.0.1"
],
"env": {
"PETRA_API_KEY": "your-value",
"AUTH_MODE": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"petra": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PETRA_API_KEY",
"-e",
"AUTH_MODE",
"ghcr.io/wyre-ai/petra-mcp:v1.0.1"
],
"env": {
"PETRA_API_KEY": "your-value",
"AUTH_MODE": "your-value"
}
}
}
}PETRA_API_KEY 机密 必填 envMCP_TRANSPORT envAUTH_MODE 机密 必填 envLOG_LEVEL env说明为自动翻译,变量名保持原样;不确定时请查看原文。
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月19日
注册名称已通过 GitHub 账户 WYRE-AI 验证,该账户拥有此仓库
代码最后更新于7天前
GitHub 无法识别许可证类型;请打开文件自行查看
它在你的电脑上运行,没有互联网端点
在你的电脑上运行,改用本地设置
它在你的电脑上运行;我们只能读取互联网端点的工具列表
如果你是作者,可把这段代码贴到 README。徽章会链接回本页。
[](https://mcp.popnx.com/en/servers/wyre-ai-petra-mcp)提问、分享技巧或报告无法使用。按“有帮助”数量排序。
还没有评价
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
它在 3 项适用的基础检查中通过了 2 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
你需要填写:PETRA_API_KEY, AUTH_MODE
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
GitHub 仓库最后更新于7天前,最新版本(1.0.1)于13天前进入注册中心。
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Docker。
同一分类中有:GitHits, Dependency Management MCP Server, Snyk MCP, TokenSafe, Draugr
同一分类、其他作者、命令已通过检查。官方的排在前面,再按星标排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Search public open-source code, documentation, metadata, vulnerabilities, changelogs, and examples.
Sonatype component intelligence: versions, security analysis, and Trust Score recommendations
Easily find and fix security issues in your applications leveraging Snyk platform capabilities.
Your AI agent is smart enough to code all day. Local firewall & zero-loss runtime.
Security scanning for AI agents: SAST, SCA, secrets, IaC, DAST, ranked by real risk.
| 本项 Petra Security | GitHits | Dependency Management MCP Server | Snyk MCP | TokenSafe | Draugr | |
|---|---|---|---|---|---|---|
| 运行位置 | 需要安装在电脑上 | 云端或安装在电脑上都可以 | 在云端运行,无需安装 | 需要安装在电脑上 | 云端或安装在电脑上都可以 | 需要安装在电脑上 |
| 需要密钥 | 是 | 否 | 否 | 否 | 否 | 否 |
| 可在 Claude 中按 + 添加 | 否 | 否 | 否 | 否 | 否 | 否 |
| 基础检查 | 2/3 | 5/5 | 3/4 | 3/3 | 5/5 | 3/3 |
| 许可证 | NOASSERTION | Apache-2.0 | – | Apache-2.0 | MIT | Apache-2.0 |
| 价格 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 |
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
Read-only MCP server for Petra Security's public REST API, for AI assistants and the WYRE Conduit gateway. Petra detects and investigates Microsoft 365 account compromises (BEC, session hijacks). This server exposes its incidents, failed attacks, posture reports, tenants, usage and billable users.
A Petra Admin creates an API key at app.petrasecurity.com under Settings > API Keys. The full key is shown only once, so store it in a secrets manager immediately. Full Members can see the key list but cannot create keys.
Every request goes to https://api.petrasecurity.com with Authorization: Bearer and a User-Agent header (Petra returns 403 without one). The host is fixed and cannot be changed by request headers or tool arguments.
Petra rate-limits each route to 10 requests per minute. A 429 comes back as a tool error that names the Retry-After-public-api wait. To spare that budget, successful responses are cached in memory per API key (keyed by a SHA-256 of the key) for 60 seconds, and /v1/failed-attacks for 5 minutes. Identical concurrent requests share one upstream call.
Copy .env.example and set the variables below. The stdio transport reads PETRA_API_KEY and does not use CONDUIT_S2S_SECRET.
| Env var | Description | |||
|---|---|---|---|---|
PETRA_API_KEY | Petra API key. Required for stdio and AUTH_MODE=env. Not read in gateway mode. | |||
MCP_TRANSPORT | stdio (default) or http. | |||
AUTH_MODE | env (default, reads PETRA_API_KEY) or gateway (Docker image and Compose default). Gateway mode requires X-Petra-Api-Key on each /mcp request and never falls back to PETRA_API_KEY. | |||
CONDUIT_S2S_SECRET | Required for HTTP. HMAC secret checked against X-Gateway-S2S on /mcp. Generate with openssl rand -hex 32. If empty or a known placeholder, the HTTP server logs an error and exits non-zero. The value is never logged. | |||
MCP_ALLOW_INSECURE_DEV | Set to exactly 1 to start HTTP without CONDUIT_S2S_SECRET. Logs a warning, does not enforce X-Gateway-S2S, and binds 127.0.0.1 only. A non-loopback MCP_HTTP_HOST refuses to start. A known placeholder secret is still refused. Local development only. | |||
MCP_HTTP_HOST | Bind address when MCP_TRANSPORT=http. Defaults to 127.0.0.1. A configured CONDUIT_S2S_SECRET honors this value. The container image sets 0.0.0.0. | |||
MCP_HTTP_PORT | HTTP port. Defaults to 8080. | |||
LOG_LEVEL | debug \ | info (default) \ | warn \ | error. |
/health and /healthz stay unauthenticated and do not read credentials.
With MCP_TRANSPORT=http and CONDUIT_S2S_SECRET set, every /mcp request must include X-Gateway-S2S. The check is verifyS2sHeader in src/s2s-verify.ts: the header value is t= ,v1= , where the hex is HMAC-SHA256 of the literal string t= keyed with CONDUIT_S2S_SECRET (64 lowercase hex characters). The timestamp must be within 300 seconds of the server clock. A missing or invalid header is HTTP 401, before vendor credentials are read. An empty secret refuses to start unless MCP_ALLOW_INSECURE_DEV=1. A known placeholder (replace-with-a-real-secret, your-s2s-secret, changeme, change-me, placeholder, secret, example, replace-me, s2s-secret, any case) refuses to start even with that flag, so a copied example cannot forge the header.
TS=$(date +%s)
SIG=$(printf 't=%s' "$TS" | openssl dgst -sha256 -hmac "$CONDUIT_S2S_SECRET" -hex | awk '{print $NF}') curl -sS http://127.0.0.1:8080/mcp \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/event-stream' \ -H "X-Gateway-S2S: t=${TS},v1=${SIG}" \ -H "X-Petra-Api-Key: $PETRA_API_KEY" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
In AUTH_MODE=gateway, /mcp also requires X-Petra-Api-Key. That header is the only credential source for the request. A request without it returns 401 and does not fall back to PETRA_API_KEY in the process environment.
AUTH_MODE=env still requires a valid X-Gateway-S2S header, then uses PETRA_API_KEY from the environment.
X-Gateway-S2S check (and, with AUTH_MODE=gateway, the X-Petra-Api-Key presence check) passes, a Content-Length above the cap returns 413 with a JSON-RPC error; bodies without Content-Length are capped by the MCP SDK transport. Unauthenticated requests still get 401 first.tools/call arguments are capped at 10,000 elements (every array item and object key at any depth). Larger inputs return an isError tool result and are never dispatched.These limits address CVE-2026-111768 / GHSA-46jr-4wx8-v453 (memory exhaustion during validation) and GHSA-f897-62hf-6gxq (no request body / batch cap).
Every tool is a GET, annotated readOnlyHint: true and destructiveHint: false. Where a tool takes tenantId, either the Petra tenant ID (e.g. ZZk90t, from petra_list_tenants or the app.petrasecurity.com/tenant/ URL) or the Microsoft tenant ID works.
petra_list_tenants - every client tenant with Petra and Microsoft tenant IDs, onboarding date and paused flag (GET /v1/tenants). Optional nameContains and includePaused filters.petra_get_usage - organization-wide billing snapshot per tenant: service, billable status, licensed and billable users, prorating, first billable date, plus totals (GET /v1/usage). Optional asOf, includePaused (set false so paused tenants don't inflate counts) and billableStatus.petra_list_billable_users - billable users for one tenant with UPN, mail, enabled flag and license SKUs (GET /v1/billable-users). Petra documents only the Petra tenant ID here, so a Microsoft tenant ID is resolved through /v1/tenants first. Optional enabledOnly.petra_list_incidents - M365 compromise incidents, newest first, with user, remediation status, live flag, dwell time and phishing email (GET /v1/incidents). Omit tenantId for all tenants. startDate and limit (1-500) go to Petra; remediationStatus, liveOnly, userPrincipalName and includePhishingEmail are applied locally after the limit.petra_get_incident - one incident by ID. Petra has no single-incident route, so this searches the newest 500 (pass tenantId to reach older ones in a tenant).petra_get_failed_attacks - blocked-attack summary for one tenant: total, by country, daily by attack type, and most-targeted users (GET /v1/failed-attacks). Defaults to the last 30 days.petra_list_posture_reports - M365 posture reports: score and grade, control rollup, Global Admin review, top risks and every check with its suggested fix (GET /v1/posture-reports). Latest per tenant by default. Optional includeChecks: false for a compact view.This server covers the first five tools StackJack ships for Petra (petra_list_tenants, petra_get_usage, petra_list_billable_users, petra_list_incidents, petra_get_failed_attacks), with the same names, and adds petra_get_incident and petra_list_posture_reports.
Petra's public API has no write, remediation, pause or scan-trigger routes, so there is nothing to gate. GET /v1/usage-xlsx is left out on purpose: it returns a binary spreadsheet and needs a separate Multi-MSP API key.
The request and response shapes come from Petra's published OpenAPI spec (/docs/api-reference/openapi.json). Tests mock the API, and nothing has been tested against a live Petra key yet.
npm install
npm run build npm test npm run lint # tsc --noEmit
The image listens on 0.0.0.0 inside the container (MCP_HTTP_HOST) and defaults to AUTH_MODE=gateway. Startup still refuses to run without a real CONDUIT_S2S_SECRET. Publish the port on loopback. In gateway mode, the Petra key arrives on each request as a header and is not read from the environment.
docker build -t petra-mcp .
docker run \ -e CONDUIT_S2S_SECRET="$CONDUIT_S2S_SECRET" \ -p 127.0.0.1:8080:8080 \ petra-mcp
Compose refuses to start when CONDUIT_S2S_SECRET is unset, defaults AUTH_MODE to gateway, publishes 127.0.0.1:8080:8080, and does not set PETRA_API_KEY or env_file:
CONDUIT_S2S_SECRET="$CONDUIT_S2S_SECRET" docker compose up
Single-tenant HTTP (AUTH_MODE=env) still requires the S2S secret, then uses PETRA_API_KEY:
docker run \
-e CONDUIT_S2S_SECRET="$CONDUIT_S2S_SECRET" \ -e AUTH_MODE=env \ -e PETRA_API_KEY=... \ -p 127.0.0.1:8080:8080 \ petra-mcp
Local HTTP without a secret is development-only. It binds 127.0.0.1 (including when MCP_HTTP_HOST is localhost or ::1) and logs a warning. A non-loopback MCP_HTTP_HOST makes startup exit. The container image sets MCP_HTTP_HOST=0.0.0.0, so the bypass inside Docker also needs -e MCP_HTTP_HOST=127.0.0.1. Do not publish that port off loopback.
MCP_TRANSPORT=http MCP_ALLOW_INSECURE_DEV=1 npm run start:http