Prototype · Preview: every server in the official registry, synced every 30 minutes. Sign in with Google to write reviews.Prototype · updated every 30 min
PopNx MCPMCP servers for people who use AI · explained in plain words

Petra Security

by WYRE-AIversion 1.0.1i★ 0iRuns on your computerRepository ↗
Registry nameio.github.WYRE-AI/petra-mcp

How to install

What it does

Read-only Petra Security MCP: M365 compromise incidents, failed attacks, posture, tenants, usage.

  • Connects Runs on your computer
  • Account or key Needs PETRA_API_KEY, AUTH_MODE
  • Category Cybersecurity

Why it ranks here

Lists are ordered by a usage score (out of 100) built from these parts

Popularity0/80GitHub stars or weekly downloads: the larger counts 60, the smaller 20
Freshness12/12Full marks for a release or code change within 30 days
Still answering0/8The cloud endpoint answered at the last check
Usage score12/100

Quality: Passed 2/3 basic checks (shown, not used for ordering) · Momentum: No data yet (Used only on the Trending tab)

Install

Pick the AI app you use, then copy the settings.

Let your AI install it with one sentence

Please install Petra Security. Follow https://mcp.popnx.com/i/wyre-ai-petra-mcp.md, show me the commands and wait for my OK before running them.

Paste it into an AI that can work on your computer (such as Claude Code or Cursor). It reads our steps, shows you the commands and waits for your OK. No key, no sign-up. · See the full text your AI reads

Passed 2/3 checks · Runs on your computer · ✓ Commands checked Nov 14, 2026

First: which AI do you use?

Pick your app and the steps appear below.

Works with Claude, with some setup first

You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone

Let AI install it

Copy this message into a Claude chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server Petra Security for Claude on this computer, in this order: 1) Check Docker with docker --version. If it is missing, tell me to install it from https://www.docker.com/products/docker-desktop/; do not install it yourself. 2) Use only this config (already checked by 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) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For PETRA_API_KEY, AUTH_MODE, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Petra Security tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Docker (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    docker --version
    • A version number such as Docker version … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed

    Open the Docker download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: docker --version

    Install once; it works for everything that needs Docker

  2. Sign up and create a Petra Security key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the Petra Security site ↗

  3. Open the Claude desktop app’s settings file

    SettingsDeveloperEdit Config

  4. Paste these settings and save the file

    {
      "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"
          }
        }
      }
    }

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Quit Claude and open it again

  6. Try it

    Use Petra Security and tell me what you can do for me, then show me one thing

    ✓ If Claude says it is using Petra Security or shows a Petra Security tool in the answer, you are connected

2 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • MCP_TRANSPORT Transport mode for the server. Set to 'stdio' for local CLI use; the image defaults to 'http' for gateway hosting. · default stdio
  • LOG_LEVEL Log verbosity: debug, info, warn, error · default info

Descriptions are as written by the maker.

Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version

ChatGPT cannot connect Petra Security yet

Petra Security runs on your computer, but ChatGPT can only connect servers that run on the web

What you can do instead

A · Use an app that can connect Petra Security

  • You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
  • You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time)
  • You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time)
  • You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time)

B · Others in Cybersecurity that work with ChatGPT

Picked from the most used in the same category, only ones that connect by address with no key

Works with Claude Code, with some setup first

You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time)

Let AI install it

Copy this message into a Claude Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server Petra Security for Claude Code on this computer, in this order: 1) Check Docker with docker --version. If it is missing, tell me to install it from https://www.docker.com/products/docker-desktop/; do not install it yourself. 2) Use only this config (already checked by 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) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For PETRA_API_KEY, AUTH_MODE, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Petra Security tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Docker (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    docker --version
    • A version number such as Docker version … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed

    Open the Docker download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: docker --version

    Install once; it works for everything that needs Docker

  2. Sign up and create a Petra Security key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the Petra Security site ↗

  3. Open Terminal

    Mac: press Command+Space and type Terminal · Windows: open PowerShell

  4. Paste this command and press Enter

    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

    Replace “your-value” with your key before pressing Enter

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Type /mcp in Claude Code

    You should see Petra Security listed as connected

  6. Try it

    Use Petra Security and tell me what you can do for me, then show me one thing

    ✓ If Claude Code says it is using Petra Security or shows a Petra Security tool in the answer, you are connected

2 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • MCP_TRANSPORT Transport mode for the server. Set to 'stdio' for local CLI use; the image defaults to 'http' for gateway hosting. · default stdio
  • LOG_LEVEL Log verbosity: debug, info, warn, error · default info

Descriptions are as written by the maker.

Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Works with Cursor, with some setup first

You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time)

Let AI install it

Copy this message into a Cursor chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server Petra Security for Cursor on this computer, in this order: 1) Check Docker with docker --version. If it is missing, tell me to install it from https://www.docker.com/products/docker-desktop/; do not install it yourself. 2) Use only this config (already checked by 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) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For PETRA_API_KEY, AUTH_MODE, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Petra Security tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Docker (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    docker --version
    • A version number such as Docker version … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed

    Open the Docker download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: docker --version

    Install once; it works for everything that needs Docker

  2. Sign up and create a Petra Security key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the Petra Security site ↗

  3. Click this button to open Cursor

    Open in Cursor

    Cursor asks you to confirm; click Install

  4. Fill in your key

    In the Petra Security settings, PETRA_API_KEY, AUTH_MODE is empty; add your key and save

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Open the AI chat in Cursor in Agent mode

  6. Try it

    Use Petra Security and tell me what you can do for me, then show me one thing

    ✓ If Cursor says it is using Petra Security or shows a Petra Security tool in the answer, you are connected

2 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • MCP_TRANSPORT Transport mode for the server. Set to 'stdio' for local CLI use; the image defaults to 'http' for gateway hosting. · default stdio
  • LOG_LEVEL Log verbosity: debug, info, warn, error · default info

Descriptions are as written by the maker.

Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Works with VS Code, with some setup first

You need a Petra Security key (create it on the maker’s site) · Install Docker on your computer first (one time)

Let AI install it

Copy this message into a VS Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server Petra Security for VS Code on this computer, in this order: 1) Check Docker with docker --version. If it is missing, tell me to install it from https://www.docker.com/products/docker-desktop/; do not install it yourself. 2) Use only this config (already checked by 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) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For PETRA_API_KEY, AUTH_MODE, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Petra Security tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Docker (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    docker --version
    • A version number such as Docker version … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed

    Open the Docker download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: docker --version

    Install once; it works for everything that needs Docker

  2. Sign up and create a Petra Security key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the Petra Security site ↗

  3. Click this button to open VS Code

    Open in VS Code

    VS Code asks you to confirm; click Install

  4. Fill in your key

    In the Petra Security settings, PETRA_API_KEY, AUTH_MODE is empty; add your key and save

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Open the AI chat in VS Code in Agent mode

  6. Try it

    Use Petra Security and tell me what you can do for me, then show me one thing

    ✓ If VS Code says it is using Petra Security or shows a Petra Security tool in the answer, you are connected

2 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • MCP_TRANSPORT Transport mode for the server. Set to 'stdio' for local CLI use; the image defaults to 'http' for gateway hosting. · default stdio
  • LOG_LEVEL Log verbosity: debug, info, warn, error · default info

Descriptions are as written by the maker.

Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Other apps that use MCP, such as Windsurf, Zed or Gemini CLI, each add servers differently. See how in the app list.

See every app that uses MCP →

JSON settings are under “For developers” below

Stuck? Ask people who use Petra Security💬 Discussion →
For developers: Terminal commands and JSON settings

Installed on your computer

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.1

Claude 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"
      }
    }
  }
}

Values you fill in

  • PETRA_API_KEY secret required env
    Petra Security API key, created by a Petra Admin under Settings > API Keys at app.petrasecurity.com. Shown only once at creation.
  • MCP_TRANSPORT env
    Transport mode for the server. Set to 'stdio' for local CLI use; the image defaults to 'http' for gateway hosting.
  • AUTH_MODE secret required env
    Credential source: 'env' reads vars locally, 'gateway' expects header injection from the WYRE MCP Gateway.
  • LOG_LEVEL env
    Log verbosity: debug, info, warn, error

Descriptions are as written by the maker.

These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.

At a glance

Downloads per weeki
Not on npm/PyPI
Licencei
No licence stated
Connection
Runs on your computer
Latest versioni
1.0.1
Published to registryi
Nov 6, 2026
Code last changedi
Nov 12, 2026
Maker
WYRE-AI
Packages
oci: ghcr.io/wyre-ai/petra-mcp:v1.0.1
Website
github.com
Registry status
Active

Which apps can use it

Based on how this server connects and on each app’s own docs, checked Nov 10, 2026.

Run on your computer in

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

All apps, with pros and cons →

Related guides

What it can do

Runs on your computer; the tool list appears in your AI app after you install it.

Basic checksi

We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 19, 2026

  • ✓ Pass

    Maker matches the repo

    The registry name was verified with the GitHub account WYRE-AI, which owns the repo

  • ✓ Pass

    Still maintained

    Code last changed 7 days ago

  • ! Caution

    Has a licence

    GitHub could not identify the licence type; open the file to check

  • – Not applicable

    Endpoint responds

    This one runs on your computer; there is no internet endpoint

  • – Not applicable

    Sign-in with OAuth

    Runs on your computer and uses local settings instead

  • … Not checked yet

    No hidden instructions in tool descriptions

    Runs on your computer; we can only read tool lists from internet endpoints

Published vulnerabilities (OSV.dev)

Not checked: only npm and PyPI packages with a version can be checked

What we check → · JSON

Makers: ask for a re-check or report wrong info
For makers: add a badge to your README

If you made this, paste this code into your README. The badge links back to this page.

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/wyre-ai-petra-mcp.svg)](https://mcp.popnx.com/en/servers/wyre-ai-petra-mcp)

Discussion

Ask, share a tip or report that it does not work. Sorted by what people marked helpful.

No posts yet. Be the first to ask or share.

Posts here are written by users, not the PopNx team.

Sign in to post

User reviews

No reviews yet

Sign in to write a review

Compared with others in Cybersecurityi

  • More stars than 0% of the other 1109 servers in this category
  • Published to the registry more recently than 75% of the other 1109 servers in this category
  • Basic checks equal to or better than 46% of the other 1109 servers in this category

Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.

Common questions

Is Petra Security safe?

It passed 2 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.

What keys or codes does it need?

You need to fill in: PETRA_API_KEY, AUTH_MODE

Does it run on my computer or in the cloud?

It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).

Is it still maintained?

The GitHub repo last changed 7 days ago, and the latest version (1.0.1) reached the registry 13 days ago.

Which apps can use it?

Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Docker on your computer.

What can I use instead?

In the same category: GitHits, Dependency Management MCP Server, Snyk MCP, TokenSafe, Draugr

Similar alternatives

Same category, other makers, commands already checked. Official ones first, then by stars.

Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi

GitHits

Search public open-source code, documentation, metadata, vulnerabilities, changelogs, and examples.

by githits-comGrowing↓ 3.8K/wk★ 138Updated 10 days ago

Computer or cloud✓ service owner · githits.com

Snyk MCP

Easily find and fix security issues in your applications leveraging Snyk platform capabilities.

by snykWidely used↓ 762.1K/wk★ 61Updated 7 months ago

Runs on your computer✓ service owner · snyk.io

TokenSafe

Your AI agent is smart enough to code all day. Local firewall & zero-loss runtime.

by tokensafe-devWidely used↓ 6.8K/wk★ 46Updated today

Computer or cloud✓ service owner · tokensafe.dev

Draugr

Security scanning for AI agents: SAST, SCA, secrets, IaC, DAST, ranked by real risk.

by draugr-devEarly★ 30Updated 2 days ago

Runs on your computer✓ service owner · draugr.dev
Compared with similar ones
This one
Petra Security
GitHitsDependency Management MCP ServerSnyk MCPTokenSafeDraugr
Runs whereInstalls on your computerCloud or install on your computerRuns in the cloud, nothing to installInstalls on your computerCloud or install on your computerInstalls on your computer
Needs a keyYesNoNoNoNoNo
Add with + in ClaudeNoNoNoNoNoNo
Basic checks2/35/53/43/35/53/3
LicenseNOASSERTIONApache-2.0–Apache-2.0MITApache-2.0
PriceNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registry

README from the maker

Open the README

Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.

Petra Security MCP Server

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.

Authentication

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.

Configuration

Copy .env.example and set the variables below. The stdio transport reads PETRA_API_KEY and does not use CONDUIT_S2S_SECRET.

Env varDescription
PETRA_API_KEYPetra API key. Required for stdio and AUTH_MODE=env. Not read in gateway mode.
MCP_TRANSPORTstdio (default) or http.
AUTH_MODEenv (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_SECRETRequired 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_DEVSet 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_HOSTBind 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_PORTHTTP port. Defaults to 8080.
LOG_LEVELdebug \info (default) \warn \error.

/health and /healthz stay unauthenticated and do not read credentials.

HTTP authentication

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.

Request limits
  • HTTP request bodies are capped at 256 KiB (262144 bytes). After the 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).

Tools

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.

Tenants and billing
  • 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.
Security events
  • 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.

Scope

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.

Development

npm install

npm run build npm test npm run lint # tsc --noEmit

Docker

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