Skip to main content
Glama
mac-doctor-mcp

mac-doctor-mcp

by Krezzy88

mac-doctor-mcp

A read-only macOS diagnostic MCP server for checking common developer cache sizes and finding large files in selected directories. It does not delete, move, or modify files.

Tool results are shown as readable Markdown summaries in clients that display text. The disk triage and large-file tools also return structured data separately for AI clients and integrations.

Requirements

  • macOS

  • Node.js 20 or newer

  • npm

Related MCP server: mac-cleaner

Install and run

npm ci
npm run check
npm run build

npm start builds the TypeScript sources and starts the MCP server over stdio. The server waits for an MCP client and normally prints no startup message. For local development with TypeScript execution, use npm run dev.

Test against real files

Create a disposable test directory under an allowed location and a sample file:

mkdir -p "$HOME/Projects/mac-doctor-demo"
mkfile -n 25m "$HOME/Projects/mac-doctor-demo/sample-25mb.bin"
du -h "$HOME/Projects/mac-doctor-demo/sample-25mb.bin"

Start MCP Inspector from the project directory:

npm run build
npx --yes @modelcontextprotocol/inspector node "$PWD/dist/index.js"

In the Inspector:

  1. Connect to the server and verify it lists diagnose_disk_pressure, analyze_caches, and find_large_files.

  2. Call diagnose_disk_pressure with {}. Verify it returns a readable report with disk pressure, measured areas and recommendations.

  3. Call analyze_caches with {} and compare the reported sizes with the cache paths on this Mac.

  4. Call find_large_files with:

    {
      "directoryPath": "/Users/YOUR_USER/Projects/mac-doctor-demo",
      "minSizeMB": 20,
      "limit": 10
    }

    Replace YOUR_USER with the output of whoami. The result should include sample-25mb.bin with a size of at least 20 MiB.

  5. Try directoryPath: "/etc" and verify the tool returns Path Access Denied.

The sample is sparse, so its logical size may differ from the physical disk space it consumes. The scan is read-only. When finished, remove only the sample created for this test:

rm "$HOME/Projects/mac-doctor-demo/sample-25mb.bin"
rmdir "$HOME/Projects/mac-doctor-demo"

MCP Inspector is a temporary test client; it does not add a dependency to this project. For repeatable automated checks, use npm run check.

Use with AI clients

Build the project first:

npm run build
pwd
command -v node

Use the absolute project path printed by pwd and the Node executable path printed by command -v node in the configurations below. If an app cannot find node, using its absolute path avoids relying on the app's PATH.

Gemini CLI

Gemini CLI supports local stdio MCP servers. Add this entry to ~/.gemini/settings.json, preserving any existing settings:

{
  "mcpServers": {
    "mac-doctor-mcp": {
      "command": "/ABSOLUTE/PATH/TO/node",
      "args": ["/ABSOLUTE/PATH/TO/mcp-mac-doctor/dist/index.js"]
    }
  }
}

Replace both placeholders with the paths from the previous commands, then restart Gemini CLI and inspect the available MCP tools (for example with /mcp). Gemini CLI is distinct from the Gemini web app; the web app does not launch a local stdio process from this configuration.

VS Code

Create or update .vscode/mcp.json at the workspace root. VS Code uses a servers property:

{
  "servers": {
    "mac-doctor-mcp": {
      "type": "stdio",
      "command": "/ABSOLUTE/PATH/TO/node",
      "args": ["/ABSOLUTE/PATH/TO/mcp-mac-doctor/dist/index.js"]
    }
  }
}

Open the file and use VS Code's MCP start control, then inspect and invoke the tools from the Chat view.

Claude Desktop

In Claude Desktop, open Settings → Developer → Edit Config. On macOS, the config is usually ~/Library/Application Support/Claude/claude_desktop_config.json. Merge this server entry into the existing top-level mcpServers object:

{
  "mcpServers": {
    "mac-doctor-mcp": {
      "command": "/ABSOLUTE/PATH/TO/node",
      "args": ["/ABSOLUTE/PATH/TO/mcp-mac-doctor/dist/index.js"]
    }
  }
}

Save and fully restart Claude Desktop. Start a new conversation, open its MCP tools menu, and invoke diagnose_disk_pressure. Do not replace other entries in the config file.

Other desktop AI apps

The server uses the standard local stdio transport. Other clients can connect if they support launching local MCP servers with a command and arguments. Use the same node command and dist/index.js argument, but follow that client's configuration format: some use mcpServers, while VS Code uses servers. A web-only AI chat cannot directly launch this local process; it would need an explicitly supported remote MCP integration and a separately hosted server.

Only enable this server in clients you trust. Once connected, the assistant can request these diagnostic tools; all three are intended to read data only.

Client configuration references:

Tools

diagnose_disk_pressure

Creates a readable report and structured data for one read-only disk triage, combining available space on the home volume with measured sizes for developer and user-data areas. Results are ordered by measured size and include:

  • Volume capacity, available bytes, available percentage, and pressure band.

  • The path, measured size, category, measurement status, and cleanup risk for each area.

  • A cautious next step tied to the area. Recommendations do not execute actions.

Pressure bands are based on available space: critical at 5% or less, high at 10% or less, moderate at 20% or less, and healthy above 20%. cleanupRisk distinguishes rebuildable caches that still merit review from personal or active developer data that should not be removed based on size alone. Missing areas and measurement errors are represented explicitly in the report.

The report measures Docker VM data, Projects, npm and Homebrew caches, Downloads, and Documents when those locations exist and pass the path guard. It runs du -sk using execFile, with a 10-second timeout per process. No files are changed.

analyze_caches

Reports du -sh sizes for available Homebrew, npm, and Docker cache paths. Missing caches are reported as unavailable. It never removes or changes cache data.

find_large_files

Scans an allowed directory. The human-readable result lists each file and its size; structured clients also receive a JSON array of records:

[
  {
    "path": "/Users/example/Projects/archive.zip",
    "size": 2097152
  }
]

Arguments:

Name

Type

Constraints

directoryPath

string

Must resolve inside one of the allowlisted directories

minSizeMB

integer

1–1,000,000 MiB

limit

integer

1–100 results

Paths are checked against canonical paths, including symlink resolution. The find invocation is passed as an argument array to execFile, with a 10-second timeout, an 8 MiB output cap, and no shell. File records include byte sizes. The server validates returned paths again before reading file metadata.

Access boundaries

The path allowlist is built from the current user's home directory and includes:

  • ~/Downloads

  • ~/Documents

  • ~/Projects

  • ~/.npm

  • ~/Library/Caches/Homebrew

  • ~/Library/Containers/com.docker.docker/Data/vms/0/data

  • /opt/homebrew/var/cache

  • /usr/local/var/cache

Only paths within these locations can be scanned. Cache analysis also checks each existing cache path against this allowlist. Filesystem permission errors and child-process failures are returned as tool errors rather than hidden.

This is a local diagnostic utility, not a sandbox. Keep the allowlist narrow and review changes to it before exposing the server to an assistant. Path validation uses canonical paths, but—as with ordinary path-based filesystem operations—cannot make a mutable filesystem immune to every time-of-check/time-of-use race. Run the server as an unprivileged user and do not grant it elevated permissions.

Development

npm run dev
npm run typecheck
npm test
npm run test:coverage
npm run build

The security-guard suite enforces 100% statement, branch, function, and line coverage. Tests use temporary directories and mocked child-process calls where appropriate. GitHub Actions runs the checks on macOS with Node.js 20, 22, and 24.

License

ISC. See LICENSE.

Available Tools

3 tools
analyze_cachesA

Returns the size of common macOS development caches (Homebrew, npm, and Docker) without modifying them.

Inputs: no named parameters.

diagnose_disk_pressureA

Creates a read-only macOS disk triage report with available space, measured developer-data/cache sizes, risk labels, and evidence-based next steps. It never deletes or modifies files.

Inputs: no named parameters.

find_large_filesC

Finds large files in an allowed directory without modifying them.

Inputs: limit (required), minSizeMB (required), directoryPath (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 3 tools

    Disambiguation3/5

    analyze_caches and diagnose_disk_pressure overlap substantially, since the triage report explicitly includes measured developer-data/cache sizes — an agent may reasonably be unsure which tool to call first. find_large_files is clearly distinct. The descriptions do help differentiate the cache-only view from the broader report, keeping it at a middling score.

    Naming Consistency5/5

    All three tools follow a clean verb_noun snake_case pattern: analyze_caches, find_large_files, diagnose_disk_pressure. The verbs are meaningful and predict the action (analyze, find, diagnose) consistently.

    Tool Count4/5

    Three tools is on the lean side but each covers a distinct facet (caches, large files, holistic triage) of a deliberately narrow read-only diagnostic scope. Nothing feels padded, though the surface is thin enough that users may want more granularity.

    Completeness3/5

    The read-only design is intentional, so the absence of delete/cleanup is fine, but the cache coverage is hardcoded to Homebrew/npm/Docker and omits major macOS dev offenders like Xcode DerivedData, pip, and Gradle. There is also no drill-down into a specific directory or file, leaving notable gaps for real disk triage.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables safe scanning and cleaning of macOS developer caches and temporary files, with dry-run support and strict refusal to delete non-whitelisted locations.
      3
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables read-only local disk cleanup scanning via MCP, allowing clients to find large files, duplicates, junk extensions, and old files, and generate cleanup lists without deleting or modifying anything.
      5
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to scan a developer machine for disk space hogs, audit git worktrees for stale or orphaned ones, re-check individual findings, and run allowlisted cleanup actions as dry runs unless explicitly confirmed. Risky items are reported with warnings and refused by default.
      58 npm
      2
      MIT