Can Claude Code, Cursor or Codex check and clean my Mac's disk?
Yes. An AI coding assistant can look at what fills your disk and clear space, and a disk cleanup MCP server gives it tools made for that job instead of raw shell commands. This page covers what such a server lets an agent do, how to connect one to Claude Code, Cursor or Codex, and how it keeps you in charge of what gets removed.
The short answer: connect a disk cleanup MCP server to your assistant, then ask in plain words, for example "What's filling my disk?". The agent reads the disk's status, scans, and suggests what to remove. Before anything moves it shows you a preview, items that may hold your data also need your click in the app, and everything goes to the Trash, where it can be put back.
What is an MCP server, and what can an agent do with it?
MCP (Model Context Protocol) is an open standard that lets an AI assistant call tools another program offers. Claude Code, Claude Desktop, Cursor, Codex, Gemini CLI, Windsurf and VS Code with Copilot all support it. With a disk cleanup server, an agent can:
- read free space and the last scan's results instantly, or start a new scan;
- list cleanup suggestions, each marked safe (rebuilds itself) or review (may be your data);
- show the biggest folders and large files;
- move what you agree to to the Trash, and undo it.
Why not just let the agent run du and rm?
Without an MCP server, an agent has only the shell. du -sh ~/Library/Caches/* works for sizes, but it's slow across a whole home folder. rm -rf skips the Trash, so there's no undo. And the agent decides from folder names alone what is cache and what is your work, then runs the command itself, often without a preview you can read at a glance.
A cleanup server answers those questions with fixed rules: which folders rebuild themselves, which may hold your data, and what is never offered (keychains, Mail, Messages, Photos, SSH keys, .env files, password managers). The agent can only move items the server itself suggested, and only to the Trash.
How do I connect it to Claude Code, Cursor or Codex?
- Open AI Agents in Bytewell's sidebar. No scan is needed.
- Click Connect next to your assistant. A backup of its config file is kept.
- Restart the assistant, or start a new session, to see the tools.
From Terminal, the same thing:
/Applications/Bytewell.app/Contents/Helpers/bytewell clients
/Applications/Bytewell.app/Contents/Helpers/bytewell connect claude-code
The names are claude-code, claude-desktop, cursor, codex, gemini, windsurf and vscode; disconnect removes it again. For Claude Code by hand:
claude mcp add --scope user bytewell -- /Applications/Bytewell.app/Contents/Helpers/bytewell mcp
Is there a Claude Code plugin?
Yes. In Claude Code, run:
/plugin marketplace add callmecelebi/bytewell-claude-code
/plugin install bytewell@bytewell
The plugin connects the same server and adds a skill for freeing up disk space. It needs the app in Applications. If you already connected Claude Code from the AI Agents page, remove one of the two so the tools don't show up twice.
What can I ask the agent?
- "What's filling my disk?"
- "Find caches I can safely delete and move them to the Trash."
- "Are there stale projects with big node_modules?"
- "Which of my local AI models haven't I used in months?"
- "Why is System Data so big?"
- "Put back what you just moved."
Things that belong to another tool, like Ollama models or Docker images, come back as a command for you to run (ollama rm, for example) rather than a deletion.
How does it stop an agent from deleting the wrong thing?
- Preview first. Moving to the Trash takes two calls: the first returns a preview and a token, which the agent shows you. Only after you agree does it confirm, with that token, valid for 10 minutes and good for one move.
- Your click for anything that may be your data. Review items and app removals wait for your approval in the app, with Touch ID or your password. The agent can't approve them, and nothing it writes or runs can.
- The Trash, with Undo. Nothing is deleted permanently. The app's Activity lists what agents moved, and you can undo there or ask the agent to.
- Refusals. Personal data and items you marked to keep are refused, whatever the agent asks.
Related: Claude Code, Codex and Cursor disk usage: what's safe to clean, How do I clean up git worktrees on my Mac?, Is it safe to delete cache files on my Mac?