Skip to main content

Deploy Agent Monitor with Kandji MDM

Push system-level hooks configuration so devices send AI coding agent activity to the MintMCP dashboard (no plugin required).

Requirements

  • No existing managed hooks file on devices (this will create it fresh).

Find your org key

Go to Agent Monitor setup. Your org key starts with llmorgkey_.

Kandji custom script

Prepare the script

Paste your org key from Agent Monitor setup — the script updates automatically so you can copy it ready to go.

#!/bin/bash
# Agent Monitor — Kandji custom script (Claude Code)
# Writes managed-settings.json with native HTTP hooks for MintMCP.

set -euo pipefail

ORG_KEY="YOUR_ORG_KEY_HERE"

if [[ ! "$ORG_KEY" =~ ^llmorgkey_ ]]; then
echo "[AgentMonitor] ERROR: ORG_KEY not set. Edit the script and replace YOUR_ORG_KEY_HERE with your MintMCP org key."
exit 1
fi

TARGET_DIR="/Library/Application Support/ClaudeCode"
SETTINGS_FILE="${TARGET_DIR}/managed-settings.json"
mkdir -p "$TARGET_DIR"

cat > "$SETTINGS_FILE" <<JSON
{
"env": {
  "MINTMCP_ORG_KEY": "${ORG_KEY}"
},
"hooks": {
  "PreToolUse": [
    {
      "matcher": ".*",
      "hooks": [
        {
          "type": "http",
          "url": "https://app.mintmcp.com/hooks/claudecode",
          "headers": {
            "X-MINTMCP-ORG-KEY": "\$MINTMCP_ORG_KEY",
            "X-MINTMCP-USER": "\$USER"
          },
          "allowedEnvVars": [
            "MINTMCP_ORG_KEY",
            "USER"
          ]
        }
      ]
    }
  ],
  "PostToolUse": [
    {
      "matcher": ".*",
      "hooks": [
        {
          "type": "http",
          "url": "https://app.mintmcp.com/hooks/claudecode",
          "headers": {
            "X-MINTMCP-ORG-KEY": "\$MINTMCP_ORG_KEY",
            "X-MINTMCP-USER": "\$USER"
          },
          "allowedEnvVars": [
            "MINTMCP_ORG_KEY",
            "USER"
          ]
        }
      ]
    }
  ],
  "UserPromptSubmit": [
    {
      "hooks": [
        {
          "type": "http",
          "url": "https://app.mintmcp.com/hooks/claudecode",
          "headers": {
            "X-MINTMCP-ORG-KEY": "\$MINTMCP_ORG_KEY",
            "X-MINTMCP-USER": "\$USER"
          },
          "allowedEnvVars": [
            "MINTMCP_ORG_KEY",
            "USER"
          ]
        }
      ]
    }
  ]
}
}
JSON

/bin/chmod 0644 "$SETTINGS_FILE"
/usr/sbin/chown root:wheel "$SETTINGS_FILE"
echo "[AgentMonitor] Created ${SETTINGS_FILE} with MintMCP hooks enabled"

Add the script to Kandji

  1. In the Kandji web app, go to Library and click Add Library Item (top right).
  2. Select Custom Script.
  3. Name it "MintMCP Agent Monitor Hooks".
  4. Assign it to the blueprint(s) for devices running Claude Code or Cursor.
Kandji Custom Script library item showing Assignment section with Blueprint selection
  1. Set Execution Frequency to Run once per device. If the script fails, Kandji automatically retries on following check-ins.
Kandji Execution Frequency dropdown set to Run once per device
  1. Paste the script (with your org key filled in) into the Audit Script field.
Kandji Audit Script field with script editor
  1. Click Save.

Kandji deploys the script on the next device check-in (roughly every 15 minutes).

Validate on a test device

Confirm the files exist and contents look correct:

cat "/Library/Application Support/ClaudeCode/managed-settings.json"

Launch Claude Code and perform some actions. Verify activity appears in MintMCP Agent Monitor.

Hook events captured

HookDescription
PreToolUseFired before any tool execution (Bash, Edit, Write, etc.)
PostToolUseFired after any tool execution completes
UserPromptSubmitFired when the user submits a prompt

Troubleshooting

Reach out to support@mintmcp.com if you have issues.