# cleaninstall-node

> cleaninstall-node is an open-source MCP server for developer tools. Diagnoses broken Node.js installs and applies the smallest fix, with an MCP server for AI. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, macOS, Linux, Windows, VS Code, API
- **Website:** https://cleaninstall-node.ahusan.dev
- **Repository:** https://github.com/ahusan/cleaninstall-node
- **MCP Registry name:** io.github.ahusan/cleaninstall-node
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-27

## About

Deleting node_modules and the lockfile is the usual response to a broken install, but most breakages have one specific cause. This CLI inspects the Node version, lockfile sync, dependency ranges, native addons and package manager, then proposes the least disruptive repair. Paste or pipe an error message and it explains what that error means for the project in question.

A git hook flags dependency changes right after a pull, branch switch or rebase, and stays silent when node_modules already matches. Cleanup is workspace-aware for monorepos, shows sizes before anything is removed, and keeps lockfiles unless told otherwise. It supports npm, pnpm, yarn, bun and Deno.

It is aimed at Node developers who work in monorepos or on shared branches, and at teams that use AI coding agents which would otherwise wipe dependencies by reflex. The MCP server exposes read-only diagnosis tools and gated fix tools that require a shown plan first.

## Features

- **Targeted install diagnosis:** Checks Node version, lockfile sync, dependency ranges, native modules and installer, and suggests the smallest fix.
- **Error explanation:** Pipe a failing command's output in and get what the error means for the current project.
- **Post-pull git hook:** Warns or runs an install or rebuild after a checkout, merge or rebase changes dependency files.
- **Safe workspace cleanup:** Finds workspaces, lists items with sizes, asks once, and keeps lockfiles by default.
- **MCP server for agents:** Read-only diagnosis tools and fix tools that require a previously shown plan ID.
- **Agent guard hook:** Blocks Claude Code Bash commands that delete node_modules or lockfiles.

## Good for

- Recover a project after git pull leaves node_modules out of sync with the lockfile
- Rebuild a single native module after switching Node versions or sharing node_modules with Docker
- Give an AI coding agent a safe way to fix install errors without deleting the lockfile
- Run a CI-friendly install health check that exits with code 1 on errors
- Clean build output and caches across a pnpm or npm monorepo before a fresh install

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add cleaninstall-node -- npx -y cleaninstall-node
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

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

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add cleaninstall-node -- npx -y cleaninstall-node
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.cleaninstall-node]
command = "npx"
args = ["-y", "cleaninstall-node"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user cleaninstall-node npx -- -y cleaninstall-node

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

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

```json
{
  "mcpServers": {
    "cleaninstall-node": {
      "command": "npx",
      "args": [
        "-y",
        "cleaninstall-node"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 1 of 5 tools reads data; 4 names don't say. From the server's own tool labels and tool names; not verified by us.

- `explain_error` (name suggests: reads): Explains an error message for the project and returns a fix plan.
- `diagnose`: Runs the full doctor health check and returns a fix plan.
- `apply_fix`: Runs the plan: targeted rebuild, install, or clean reinstall. Does not touch lockfiles.
- `plan_clean`: Lists what a cleanup would delete, with sizes.
- `clean`: Deletes what plan_clean listed; can reinstall.

## FAQ

### Does cleaninstall-node delete my lockfile?

No. Lockfiles are kept by default and are only removed when you pass --lockfiles or set removeLockfiles in config.

### Which package managers are supported?

The content lists npm, pnpm, yarn, bun and Deno, with the package manager detected from the packageManager field or the lockfile.

### What Node version is required?

Node.js 20 or newer.

### How do I connect cleaninstall-node to an AI agent?

Add it as an MCP server with npx -y cleaninstall-node mcp, using the setup commands for Claude Code, Cursor, VS Code or Claude Desktop.

### Is cleaninstall-node free?

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

### How do I add cleaninstall-node to Claude Code?

Run this command in your terminal: claude mcp add cleaninstall-node -- npx -y cleaninstall-node

### What are the best alternatives to cleaninstall-node?

The closest alternatives to cleaninstall-node are MCP Dependency Doctor, e18e, KarmaDue, npm why (who installs this package) and Freshdeps MCP.

## Where this comes from

- Description: written from the project's README, the project's website and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [MCP Dependency Doctor](https://ai-powered.com/mcp/mcp-dependency-doctor): MCP Dependency Doctor is an open-source MCP server for developer tools.
- [e18e](https://ai-powered.com/mcp/e18e): e18e is an open-source MCP server for developer tools.
- [KarmaDue](https://ai-powered.com/mcp/karmadue): KarmaDue is a free MCP server for security.
- [npm why (who installs this package)](https://ai-powered.com/mcp/npm-why-who-installs-this-package): npm why (who installs this package) is an open-source MCP server for developer tools.
- [Freshdeps MCP](https://ai-powered.com/mcp/freshdeps-mcp): Freshdeps MCP is a free MCP server for developer tools.
- [pinright](https://ai-powered.com/mcp/pinright): pinright is an open-source MCP server for developer tools.
- [Npm](https://ai-powered.com/mcp/npm): Npm is an open-source MCP server for developer tools.
- [Npm MCP](https://ai-powered.com/mcp/npm-mcp): Npm MCP is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/cleaninstall-node
