MCP server for diskclean.sh — agent-driven Mac disk cleanup
Project description
diskclean-mcp
MCP server that wraps diskclean.sh, letting agents like Claude Desktop, Claude Code, or any MCP client scan and clean a Mac's reclaimable disk space — with safety guardrails baked in.
Tools exposed
| Tool | Returns | Notes |
|---|---|---|
scan_disk() |
{ disk, items: [...] } |
Read-only. Items include stable id, size, risk level, path. |
clean_items(ids, mode, confirm_risky) |
{ results, summary } |
Destructive. Defaults to Trash; risky items gated by flag. |
disk_status() |
{ total, used, available } |
Cheap, no full scan. Good for before/after checks. |
Quick start (uvx, once published)
uvx diskclean-mcp
Not yet on PyPI — for now, use the dev install below.
Add to Claude Desktop
{
"mcpServers": {
"diskclean": {
"command": "uvx",
"args": ["diskclean-mcp"]
}
}
}
Add to Claude Code
claude mcp add diskclean -- uvx diskclean-mcp
Dev install (from this repo)
cd mcp/
uv venv
uv pip install -e .
diskclean-mcp # runs on stdio — test with an MCP inspector
To register the local server with Claude Code:
claude mcp add diskclean -- uv --directory /absolute/path/to/repo/mcp run diskclean-mcp
For Claude Desktop, in claude_desktop_config.json:
{
"mcpServers": {
"diskclean": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/repo/mcp", "run", "diskclean-mcp"]
}
}
}
Safety model (how an agent should use this)
- Scan first. Call
scan_disk()and present a summary to the user (totals by risk level, biggest items). Never auto-clean. - Get explicit consent before calling
clean_items(). Quote item names and sizes. - Default to Trash.
mode="trash"is recoverable. Only passmode="delete"if the user explicitly says so. - Risky items need double opt-in. Items with
risk="risky"(browsers, WhatsApp, Downloads, Android SDK) are skipped unless you passconfirm_risky=True. Don't pass this flag without the user confirming. - Sudo-required items will fail in non-interactive mode. Surface their
commandfield so the user can run them manually. - Verify after. Call
disk_status()after cleanup to confirm space was freed. Trash items still occupy space until the Trash is emptied.
Configuration
| Env var | Purpose |
|---|---|
DISKCLEAN_SCRIPT |
Override the path to diskclean.sh (otherwise auto-discovered: bundled in wheel, or sibling of mcp/ in dev). |
How it works
The server is a thin wrapper around diskclean.sh:
agent → MCP tool call → server.py → bash diskclean.sh --json | --execute → JSON → agent
All scanning logic lives in the bash script (single source of truth). The Python layer handles MCP protocol, argument validation, and safety messaging. Adding a new scan category means editing diskclean.sh only — the MCP server picks it up automatically via the dynamic item list.
License
MIT — same as the parent project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diskclean_mcp-0.1.0.tar.gz.
File metadata
- Download URL: diskclean_mcp-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e5ede62da3eb2c0149855bb449d55595b1fc50fc9a428581f2721507ee049dd
|
|
| MD5 |
0b032736e99a89e3f0769f08ec0678d3
|
|
| BLAKE2b-256 |
c3612d8ac7bb228305bbb34fd7e5521309913768ac46662ac60ad41c57145d90
|
File details
Details for the file diskclean_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: diskclean_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b07cd97290de437029949f1aa44190668bc9f4e2c7692a729b672528c204733c
|
|
| MD5 |
4e8ac8d0d895c6e50644dc8013b63d04
|
|
| BLAKE2b-256 |
b04a39d6d41a7fea761348e17e503b74a94b7aaf40a5000752f07934dcf717b1
|