How to Detect AI Tools on Macs with Mosyle

To see which Macs managed by Mosyle have Claude Code, Cursor, ChatGPT, Ollama, AI extensions or MCP configs, run the read-only script below as a custom command or command attribute. It prints one short line per Mac, such as Claude Code; Cursor; MCP configs (2), so Smart Device Groups can match on it.

By Kuntur team · Published · Updated

Short version. Add the script as a command attribute (or a custom command if your plan has no attributes), run it daily on a pilot group, then build Smart Device Groups on the value: "contains Claude Code", "contains MCP configs", "is None". Mind one catch with "contains", explained below.

Why one line of output

Mosyle runs administrator scripts on Macs through custom commands, and admins also use scripts as command attributes: the script's output is stored as a value on the device, and Smart Device Groups can match on that value. We could not check Mosyle's exact menu names against public documentation, so the steps here stay at the level the sources below confirm; use Mosyle's help resources for the options on your plan.

A device value is only useful if it is short and predictable, so the script is built around that:

The script and what it reports

Plain bash for the /bin/bash 3.2 shipped with macOS. It tests whether paths exist, never opens a file, makes no network calls and prints only names and counts. Open kuntur-ai-inventory-mosyle.sh in the browser to copy it, or download it. SHA-256 of the published file:

25a2a7dc0ca0a384c0734afa4c7dcbd30073aea9c44804b658e516039dc26839

These are all the values it can print, which is what you build groups on:

Value in the lineWhat the script found
Claude desktop, ChatGPT desktop, Cursor, Windsurf, LM StudioThe app in /Applications or in a user's ~/Applications (LM Studio also by its data folder)
Claude Code, Codex CLI, Gemini CLIThe binary in Homebrew, /usr/local/bin or ~/.local/bin, or the user data folder ~/.claude, ~/.codex, ~/.gemini
Ollama or Ollama (N models)The app or binary; with a count when model manifests exist under ~/.ollama/models
GitHub Copilot extension, Claude Code extension, Codex extension, Cline extension, Roo Code extension, Continue extension, Windsurf/Codeium extension, Gemini Code Assist extension, Amazon Q extension, Tabnine extensionThe extension folder in VS Code or Cursor
MCP configs (N)N MCP config files across all users (Claude Desktop, Claude Code, Cursor, VS Code, Windsurf). Counted, never read, so no token reaches Mosyle.
NoneNothing from the list

A developer's Mac typically returns something like Claude Code; Claude Code extension; Cursor; GitHub Copilot extension; MCP configs (3); Ollama (2 models). To see which servers an MCP config defines, and whether it holds secrets, paste it into the free MCP config auditor, which runs in your browser.

Add it in Mosyle

  1. If your plan offers command attributes, add the script as an attribute so the one-line result is stored on each device. Otherwise create a macOS custom command with it and read the output per device.
  2. Scope it to a pilot device group first (the IT team's Macs), then the fleet.
  3. Run it daily, or less often. An inventory does not need minute-level freshness, and a daily value is easy to compare from one week to the next.
  4. Build the Smart Device Groups from the next section.

Smart Device Groups that work

Matching with "contains" is the simple way to use the value, with one catch: some names contain others. Claude Code also matches Claude Code extension, and Ollama matches Ollama (3 models). Pick the criteria with that in mind:

Group you wantCriteria on the attributeNote
Macs with Claude Code in any formcontains Claude CodeCLI and the VS Code or Cursor extension together
Macs with the Claude Code extensioncontains Claude Code extensionExtension only
Macs with local models downloadedcontains Ollama (Only Macs where model files exist, not just the app
Macs with MCP servers configuredcontains MCP configsThen review those configs for plaintext tokens
Macs with no AI toolsis NoneUseful as a baseline count

A group per tool you have not approved gives you a live count of decisions still open. When you approve a tool, delete its group rather than editing the script, so the same value keeps meaning the same thing across the fleet.

Where the Mosyle approach stops

The gaps every fixed script shares (browser-only use, unusual install paths, WSL and containers, new tools) are listed in what every MDM inventory script misses. Specific to this one:

Fleet-wide inventory with the Kuntur agent

The Kuntur agent keeps this inventory on Mac, Windows and Linux from a catalog that is updated centrally, per user rather than per Mac, and keeps each approve-or-not decision with who made it and when. It installs on Macs with a configuration profile and a one-line install script run as root, which any MDM that runs root scripts can push; the deployment page has the steps. It detects and reports; it does not block, restrict or uninstall anything.

To try it on one Mac first, the free scanner needs no account and uploads nothing: curl -fsSL https://app.kuntur.io/scan.sh | sh (what it does, published hash). When it finishes, the terminal shows the trial link if you want the fleet view.

Free for up to 5 endpoints. Pro is US$3 per endpoint per month (or US$30 per endpoint per year) for 10 to 30 endpoints. The 14-day trial covers up to 25 endpoints and needs no credit card.

FAQ

Does Mosyle have something like Jamf extension attributes?
Mosyle admins use command attributes, where a script's output becomes a device value that Smart Device Groups can match on. Check Mosyle's help resources for the options available on your plan.
Why does my Claude Code group include Macs that only have the extension?
Because "contains Claude Code" also matches "Claude Code extension". Use that group for Claude Code in any form, and a separate "contains Claude Code extension" group if you need to tell them apart.
Does the script change anything on the Mac?
No. It only checks whether known paths exist and prints one line. It never opens MCP configs or other files and makes no network calls.
Can Kuntur block the tools it finds?
No. Kuntur detects and reports. Restricting an app is done in your MDM or with app control.

Sources

  1. Never Had To Fight: custom commands and command attributes for Mosyle (third party)
  2. acodega/mosyle: command attributes and custom commands for Mosyle (third party)
  3. Kuntur detection catalog

More guides and tools: