Skip to main content
Glama
mac-doctor-mcp
by bmdy6

快速开始 · 能力 · 工作流程 · 完整参考

快速开始

uvx --from git+https://github.com/bmdy6/mac-doctor-mcp mac-doctor-mcp

需要 macOS、Python 3.12+ 和 uv。首次安装需要网络。

这是等待客户端连接的 stdio 服务。把命令加入 MCP 客户端后,先问:“读取内存压力,解释 swap 与进程分组,先不要清理。” Claude Code、Codex 配置和完整工具参数可直接查阅。

Related MCP server: DiskSweep MCP

为什么用它

面向使用 AI agent 的 Mac 开发者:知道内存和磁盘发生了什么,把“删掉试试”换成能检查、能撤回的文件事务。

手动处理

用 mac-doctor-mcp

在多个系统命令间拼凑状态

从 MCP 读取内存、存储与可选硬件信息

直接删除后才发现删错

先保存计划,再用确认码移入同卷隔离区

出错后手动找回文件

rollback 恢复原位置;recover 处理被中断的移动

能力

看清现状

保留退路

内存压力与进程分组:读取 pressure、swap,按应用归类进程。

先计划再执行:保存逐项目标、风险、大小与确认码。

存储候选:扫描直接子项;Mole 可作为可选分析源。

同卷隔离与回滚:移动文件,遇到原位置冲突拒绝覆盖。

可选硬件快照:读取 siltop;未安装时返回原因。

中断恢复:journal 记录移动状态,恢复后再继续。

看它运行

横幅来自附带的可重放演示:MCP 实际返回 9 个工具;创建 1 个目录、3 个文件,执行计划、隔离与回滚,恢复后的内容 SHA 与原始内容一致。 这些是图中合成样例的结果,不是清理性能或真实磁盘释放量。

工作流程

flowchart LR
    A[只读检查] --> B[保存计划]
    B --> C[人工确认码]
    C --> D[同卷隔离]
    D --> E[回滚或中断恢复]
    D --> F[到期预览并单独确认清空]

路径策略先检查白名单、禁区和符号链接。apply 重新验证目标身份,用同卷 rename 移动文件;journal 与审计记录保留操作轨迹。

可信度

  • 开发测试命令:uv run pytest -q。

  • 以当前用户权限运行,不使用 sudo;只读检查不会结束进程。

  • 清理计划也会写本地元数据;readOnlyHint 不是操作系统权限控制。

常见问题与限制

隔离就释放磁盘空间吗? 不会。同卷移动仍占用空间;只有到期 purge 真正删除,且不可回滚,须另行确认。

确认码能证明是人批准的吗? 不能。客户端仍须审批写操作,不能让模型自动回传计划里的码。

必须安装 Mole 或 siltop 吗? 不必。它们是可选的只读数据源;缺失或失败会报告状态,不会自动安装。

支持 Linux 吗? Linux 采集器服务于开发测试,产品面向 macOS。内存指标口径、安全规则与完整开发命令保留在参考页。

参与贡献

先提 Issue;开发时运行 uv run pytest -q。图源和复现方式见 SOURCES。 English banner · Dark English banner

许可证

MIT。如果这套确认与回滚流程对你有用,欢迎点 Star。

Available Tools

9 tools
apply_planA
Destructive

CHANGES FILES (可回滚 / reversible). Moves the plan's items into quarantine on the same volume. confirm_code must be the code the user typed. Space is only freed after purge_quarantine.

Inputs: plan_id (required), confirm_code (required).

inspect_hardwareA
Read-only

Read-only. Temperatures, power and per-app energy from siltop when installed (macOS).

Inputs: no named parameters.

inspect_memoryB
Read-only

Read-only. Memory pressure, swap, processes grouped by AI tool, and dev processes left running in deleted git worktrees. Does not kill anything.

Inputs: top.

inspect_storageB
Read-only

Read-only. Largest items under the given folders (default: the allowed cleanup roots).

Inputs: top, roots.

list_quarantineB
Read-only

Read-only. Applied, rolled back and purged plans with sizes.

Inputs: no named parameters.

plan_cleanupA
Read-only

Read-only on target files; writes plan metadata locally. Turn candidates into a stored plan. items: [{"path": "/abs/path", "reason": "why it is safe", "risk": "low|medium|high"}]. Show the user every item, the total size and the confirm_code, and ask them to reply with the code. Never apply without the user typing it.

Inputs: items (required).

purge_quarantineA
Destructive

不可回滚 / NOT REVERSIBLE when confirm_code is given. Without it: dry run listing batches older than keep_days and a confirm_code. Show the list to the user; only pass the code they typed.

Inputs: keep_days, confirm_code.

recoverA
Destructive

CHANGES FILES (可回滚 / restores interrupted moves). Finishes an apply or rollback that was interrupted, by restoring items.

Inputs: no named parameters.

rollbackB
Destructive

CHANGES FILES (可回滚 / restores quarantined files). Moves every item of an applied plan back to where it was.

Inputs: plan_id (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 9 tools

    Disambiguation4/5

    The three inspect_* tools are cleanly separated by resource (memory, storage, hardware), and the plan/apply/purge flow is explicit about which step mutates state. The only soft boundary is rollback vs. recover, both of which restore files, but the descriptions distinguish completed-plan rollback from repairing interrupted moves.

    Naming Consistency4/5

    Most names follow a verb_noun pattern (inspect_memory, plan_cleanup, apply_plan, list_quarantine, purge_quarantine), with consistent snake_case throughout. The bare verbs 'rollback' and 'recover' are the only deviations, and they remain unambiguous.

    Tool Count5/5

    Nine tools map exactly onto the disk-cleanup lifecycle: three inspectors, plan, apply, quarantine listing, purge, rollback, and recovery. No tool feels redundant or missing from the count perspective.

    Completeness4/5

    The surface covers the full inspect → plan → apply → quarantine → purge/rollback/recover lifecycle, including non-reversible and interrupted-operation paths. Minor gaps: there is no tool to list or discard a stored but unapplied plan, and cleanup roots appear to be configuration-only rather than inspectable/modifiable.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • 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
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables an AI assistant to measure macOS disk usage, investigate unfamiliar files and folders, identify cleanup candidates, and prepare numbered cleanup proposals that move approved items to the Trash only after server-side path checks.
      16 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to inspect local RAM, commit, page file, disk usage, top processes, disk scans, duplicate files, startup apps, recent changes, and reports. It also generates approval-gated plans for cleanup, file moves, and startup disabling without changing the PC.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to scan a Mac for reclaimable disk space and safely move selected items to the Trash, with dry-run defaults, protected paths, and confirmation before permanent deletion.
      12
      MIT