# Sweep MCP

> Sweep MCP is an open-source MCP server for developer tools. Let an agent clear node_modules and other junk folders, only inside roots you allow. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted, Linux, macOS, Windows
- **Website:** https://les-k.github.io/field-notes.html
- **Repository:** https://github.com/les-k/sweep-mcp
- **MCP Registry name:** io.github.les-k/sweep-mcp
- **Categories:** developer tools, security
- **Listing updated:** 2026-11-16

## About

Sweep MCP exposes the sweep cleanup utility to an agent so it can find and reclaim folders such as node_modules, .venv, target and __pycache__. The README spends most of its length on the guard rails: a root allowlist fixed at startup that the agent cannot change, with every request refused if no roots are configured; paths resolved before the containment check so ../ and symlink escapes fail; and deletion by random ticket id only, never by path.

Dry run is the default, and a real delete needs the exact confirmation string "delete". Each find is re-checked against the live filesystem just before deletion, confirming it is still contained, still a directory, not a link and still has its marker file. Tool descriptions are static strings so directory names cannot inject instructions.

The README is candid about limits: a root set to / will be honoured, a legitimate client gets what it asks for, an agent talked into deleting a real folder is not stopped, and a small race window remains between check and delete. It runs over stdio from a PyPI package.

## Features

- **Root allowlist:** Only folders you name at startup can be scanned or deleted.
- **Delete by ticket id:** Reclaim accepts random ids from a scan, never raw paths.
- **Dry run by default:** Deletion needs the exact confirmation string.
- **Pre-delete revalidation:** Checks containment, type, symlinks and marker files again before removal.
- **Static tool descriptions:** Filesystem content cannot reach the model as instructions.
- **Documented limits:** The README lists what the guards do not cover.

## Good for

- Reclaim disk space from old node_modules folders
- Clean virtual environments and build targets across projects
- Give an agent a bounded delete capability
- Study guard-rail patterns for destructive MCP tools

## Install

### Claude Code (Terminal)

```sh
claude mcp add sweep-mcp -- uvx sweep-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "sweep-mcp": {
      "command": "uvx",
      "args": [
        "sweep-mcp"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "sweep-mcp": {
      "command": "uvx",
      "args": [
        "sweep-mcp"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "sweep-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "sweep-mcp"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "sweep-mcp": {
      "command": "uvx",
      "args": [
        "sweep-mcp"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "sweep-mcp": {
      "command": "uvx",
      "args": [
        "sweep-mcp"
      ]
    }
  }
}
```

## Tools

- `reclaim`: Delete previously found directories by ticket id, as a dry run unless confirmed.

## FAQ

### Can the agent delete any path?

No. It can only act on ids from its own scan inside the configured roots.

### Does it delete immediately?

No, dry run is the default and deletion requires confirm="delete".

### What if I set the root to /?

It will work through your filesystem; the allowlist is only as safe as your configuration.

### Is there any known weakness?

Yes, a short race window between the final check and the delete remains, as the README states.

### Is Sweep MCP free?

Yes. Sweep MCP is open source, so you can use and self-host it for free.

### How do I add Sweep MCP to Claude Code?

Run this command in your terminal: claude mcp add sweep-mcp -- uvx sweep-mcp

### What are the best alternatives to Sweep MCP?

The closest alternatives to Sweep MCP are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/sweep-mcp
