Skip to main content

mac-diagnostics

CI PyPI

macOS diagnostic shell scripts — sleep/wake, crashes, battery, disk, network, security, backups, storage, Wi-Fi — plus an MCP server that exposes them to AI agents (Claude Desktop, Claude Code, Cursor, VS Code).

Quickstart

uvx mac-diagnostics-mcp   # runs the MCP server on stdio, zero install

Point your client at it — Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "mac-diagnostics": {
      "command": "uvx",
      "args": ["mac-diagnostics-mcp"]
    }
  }
}
  • Claude Code: claude mcp add mac-diagnostics -- uvx mac-diagnostics-mcp
  • Cursor: same mcpServers JSON in ~/.cursor/mcp.json
  • VS Code: same JSON in ~/Library/Application Support/Code/User/mcp.json

Then ask your agent: "Run a quick health check on my Mac."

Scripts

All scripts live in mac_diagnostics_mcp/scripts/ and run standalone — no Python required:

  • mac-quick-health.sh — fast overview: CPU, memory, disk, network, sleep blockers, battery, crashes, startup items, thermal state.
  • mac-sleep-investigate.sh — sleep blockers, wake reasons, dark wakes, always-awake processes.
  • mac-cpu-memory.sh — CPU usage, memory pressure, swap, thermal throttling.
  • mac-disk-health.sh — free space, SMART status, large home directories, Time Machine state.
  • mac-network.sh — interfaces, routes, DNS, connectivity, listening ports, HTTP latency, DNS-tamper/proxy/ARP checks.
  • mac-network-addons.sh — third-party network/security add-ons (Little Snitch, LuLu, KnockKnock, Mac Monitor, dnscrypt-proxy).
  • mac-crashes.sh — crash/hang trends: repeat offenders, panics, OOM kills, hang reports (.ips/.diag and legacy .crash).
  • mac-battery.sh — battery health, cycle count, charging state and history.
  • mac-startup-items.sh — launch agents/daemons, login items, startup services, persistence code-signing spot-check.
  • mac-security.sh — FileVault, SIP, Gatekeeper, XProtect, firewall, sharing services, account hygiene, persistence spot-check.
  • mac-backup.sh — Time Machine destination, last-backup age, snapshot usage.
  • mac-storage.sh — what fills the disk: purgeable space, heavyweight directories (Xcode, simulators, Docker, caches, iOS backups).
  • mac-wifi.sh — Wi-Fi RSSI, noise, SNR, channel, transmit rate.
  • mac-software-update.sh — pending macOS updates, auto-update settings, XProtect age.

Developer environment:

  • mac-mcp-servers.sh — audit MCP server configs across AI clients (types, path health; env values redacted).
  • mac-node-packages.sh — Node.js/Bun installations, global packages, available updates.
  • mac-node-update.sh — apply npm/Bun updates (--include-mcp-venvs for Python MCP venvs).

Machine-readable findings

Every report ends with one-line findings an agent can parse deterministically:

FINDING:WARN:disk: boot volume / is 92% full
FINDING:CRIT:network: no outbound connectivity (ping 1.1.1.1 failed) [suggest: investigate_network]

Severity is INFO / WARN / CRIT. An optional [suggest: tool(args)] escalation hint names the recommended follow-up tool.

Conditional-depth checks

Expensive log show checks run only when a cheap trigger fires (active sleep blocker, crash reports on disk, memory pressure) or --deep is passed. Skips are listed as SKIPPED: ... lines — a clean machine's crash report takes well under a second.

Tools

The server exposes 18 tools. Each diagnostic tool returns status (ok/info/warn/crit/incomplete), a machine-readable findings list, and the prose report (or pass include_report: false for low-token multi-tool sweeps). Check findings first; read the report for detail.

Every read-only tool accepts compare_last: true — diffs findings against the previous run and adds a delta key (new/resolved/changed/status_change). Run history lives in ~/.local/state/mac-diagnostics/; see docs/baselines-design.md.

Tool Description Mutates?
triage Map a symptom in plain language to an ordered tool plan no
quick_health_check Fast 30-second overview no
investigate_sleep Sleep blockers, wake reasons no
investigate_cpu_memory CPU usage, memory pressure no
investigate_disk SMART status, free space no
investigate_network Connectivity, DNS, routing, DNS-tamper checks no
check_network_addons Third-party tools (Little Snitch, KnockKnock, …): presence, state, conflicts no
investigate_crashes App crash/hang trends, panics, OOM kills no
investigate_battery Battery health, cycle count no
investigate_startup_items Launch agents and daemons, with code-signing assessment no
security_audit FileVault, SIP, firewall, sharing, persistence spot-check no
backup_audit Time Machine destination, last-backup age, snapshots no
storage_breakdown What is consuming the boot volume no
wifi_quality Wi-Fi RSSI, noise, SNR, channel, Tx rate no
check_software_updates Pending macOS updates, auto-update settings, XProtect age no
list_mcp_servers Audit MCP configs across AI clients no
inspect_node_packages Node/Bun ecosystem audit and update report no
update_node_packages Apply npm/bun updates (dry-run by default) only with apply=true

All read-only tools carry readOnlyHint annotations so clients can auto-approve them safely.

Mutation guard

update_node_packages(apply=true) modifies the system (brew upgrade, npm update -g, pip install --upgrade) and is refused unless the server was started with MAC_DIAG_ALLOW_MUTATIONS=1:

{
  "mcpServers": {
    "mac-diagnostics": {
      "command": "uvx",
      "args": ["mac-diagnostics-mcp"],
      "env": { "MAC_DIAG_ALLOW_MUTATIONS": "1" }
    }
  }
}

Without it the tool returns a structured refusal — a prompt-injected or over-eager agent cannot run upgrades.

Workflow prompts

Guided multi-tool workflows shipped with the server: diagnose_slow_mac, investigate_sleep_issues, weekly_maintenance, security_review, and pre_travel_check.

Example prompts

System overview

  • "Run a quick health check on my Mac."

Symptoms → plan

  • "My battery drains overnight — what should we check?" (uses triage)

Change since last time

  • "Run the health check and tell me what changed since last week." (uses compare_last)

Sleep & wake

  • "Investigate why my Mac isn't sleeping."
  • "Check for sleep issues from the last 48 hours." (uses since param)

CPU & memory

  • "Diagnose high CPU and memory pressure."
  • "Check CPU and memory from the last 2 hours." (uses since param)

Disk & storage

  • "Check my disk health and free space."
  • "Show verbose disk info including all partitions." (uses verbose param)
  • "My disk is full — what is taking up the space?"

Network & Wi-Fi

  • "Test my network connectivity and DNS."
  • "Is my Wi-Fi signal any good?"

Crashes

  • "Show recent app crashes and panics."
  • "List crashes from the last 48 hours." (uses since param)

Battery (MacBook only)

  • "Check my battery health and cycle count."

Startup items

  • "List everything that launches at startup."

Security

  • "Run a security audit of this Mac."
  • "Are any of my startup items unsigned?"

Backups

  • "When did my last Time Machine backup finish?"

Software updates

  • "Are my macOS updates up to date?"

MCP server audit

  • "Audit my MCP server configuration across all AI clients."

Node / Bun packages

  • "Audit my Node.js and Bun global packages."
  • "Check for npm and Bun package updates (dry-run)."
  • "Apply npm and Bun updates, including Python MCP venvs." (uses apply + include_mcp_venvs params; requires the mutation guard)

Usage (standalone scripts)

./mac_diagnostics_mcp/scripts/mac-sleep-investigate.sh --since 24h
./mac_diagnostics_mcp/scripts/mac-quick-health.sh
./mac_diagnostics_mcp/scripts/mac-startup-items.sh
./mac_diagnostics_mcp/scripts/mac-crashes.sh --since 48h
./mac_diagnostics_mcp/scripts/mac-battery.sh
./mac_diagnostics_mcp/scripts/mac-cpu-memory.sh --since 2h
./mac_diagnostics_mcp/scripts/mac-disk-health.sh
./mac_diagnostics_mcp/scripts/mac-network.sh
./mac_diagnostics_mcp/scripts/mac-network-addons.sh
./mac_diagnostics_mcp/scripts/mac-security.sh
./mac_diagnostics_mcp/scripts/mac-backup.sh
./mac_diagnostics_mcp/scripts/mac-storage.sh
./mac_diagnostics_mcp/scripts/mac-wifi.sh
./mac_diagnostics_mcp/scripts/mac-software-update.sh

# Developer environment tools
./mac_diagnostics_mcp/scripts/mac-mcp-servers.sh --stdout
./mac_diagnostics_mcp/scripts/mac-node-packages.sh --stdout
./mac_diagnostics_mcp/scripts/mac-node-update.sh --stdout                        # dry-run
./mac_diagnostics_mcp/scripts/mac-node-update.sh --stdout --apply                # apply updates
./mac_diagnostics_mcp/scripts/mac-node-update.sh --stdout --apply --include-mcp-venvs

By default each script writes a timestamped report folder on your Desktop; with --stdout (the mode the MCP server uses) it uses an ephemeral temp dir that is cleaned up automatically on exit. Use --out PATH to choose a persistent folder explicitly.

Development

python -m pip install -e ".[dev]"
mac-diagnostics-mcp        # runs the server from the checkout

For development, point your client at the venv console script: "/path/to/mac-diagnostics/.venv/bin/mac-diagnostics-mcp".

Checks:

bash -n mac_diagnostics_mcp/scripts/*.sh
shellcheck --shell=bash mac_diagnostics_mcp/scripts/*.sh
ruff check mac_diagnostics_mcp/ tests/
ruff format --check mac_diagnostics_mcp/ tests/
pytest

Releases are tagged (vX.Y.Z) and published via GitHub release — the publish.yml workflow uploads to PyPI automatically (OIDC trusted publishing, no tokens).

Requirements

  • macOS and Bash (system /bin/bash 3.2+ works out of the box; timeouts fall back to /usr/bin/perl when GNU timeout is absent)
  • Standard macOS tools: pmset, log, launchctl, system_profiler, ioreg, osascript
  • Python ≥ 3.11 and fastmcp — MCP server only

Some commands return partial output depending on macOS privacy settings.

Privacy note

Reports can include hostnames, usernames, process names, installed services, and log excerpts. Review report output before sharing it outside your machine.

License

MIT

Metadata

Release files for mac-diagnostics-mcp 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mac-diagnostics-mcp 0.7.0
File Size Uploaded Provenance Actions
mac_diagnostics_mcp-0.7.0.tar.gz 75.7 kB With provenance Details for mac_diagnostics_mcp-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mac-diagnostics-mcp 0.7.0
File Interpreter ABI Platform Actions
mac_diagnostics_mcp-0.7.0-py3-none-any.whl Python 3 none any Details for mac_diagnostics_mcp-0.7.0-py3-none-any.whl

Total release size: 157.7 kB

Release files / mac_diagnostics_mcp-0.7.0.tar.gz

Download URL mac_diagnostics_mcp-0.7.0.tar.gz
Size 75.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ddf936e3702a669f8551bcba17cc27d08af4e3493dc5d78665c41165879b3366
BLAKE2b-256 checksum
How to use checksums
6aea0c5079365cd139caa34a56ca6aeda62519708d3ce1e78d1bee6ed7600ff4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / mac_diagnostics_mcp-0.7.0-py3-none-any.whl

Download URL mac_diagnostics_mcp-0.7.0-py3-none-any.whl
Size 81.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbe0d10eae99515d50061ae4f53dd17e0726051d038655f06a770e29fb849abd
BLAKE2b-256 checksum
How to use checksums
b091c5e8f1ed7a4479a0b7dbb73acb09f5d1a76d2b4b82e1bb594ccd345d755f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for mac-diagnostics-mcp 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mac_diagnostics_mcp-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page