Skip to content

Craftpipe/deadcode-mcp

deadcode-mcp

Dead code detection superpowers for AI coding agents — find unused exports, unreferenced functions, orphaned files, and circular dependencies across any JavaScript/TypeScript project.

Note on analysis accuracy: All analysis is performed via regex and AST-based static analysis. This approach works well for the majority of codebases but may have limitations with dynamic imports (import() expressions resolved at runtime), complex re-export patterns (e.g. barrel files with wildcard re-exports), or code that is accessed through reflection. Results should be treated as a helpful guide rather than a guaranteed exhaustive list.

Installation

Quick Start

npx deadcode-mcp

Global Installation

npm install -g deadcode-mcp

MCP Client Configuration

Claude Desktop

Add to claude_desktop_config.json (usually at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "deadcode-mcp": {
      "command": "npx",
      "args": ["-y", "deadcode-mcp"]
    }
  }
}

Cursor

Open Cursor → Settings → MCP (or edit ~/.cursor/mcp.json) and add:

{
  "mcpServers": {
    "deadcode-mcp": {
      "command": "npx",
      "args": ["-y", "deadcode-mcp"]
    }
  }
}

Restart Cursor after saving. The tools will appear in the Composer's tool picker.

Cline (VS Code extension)

Open the Cline sidebar → click the MCP Servers icon → Edit MCP Settings, then add:

{
  "mcpServers": {
    "deadcode-mcp": {
      "command": "npx",
      "args": ["-y", "deadcode-mcp"]
    }
  }
}

Save the file — Cline will connect automatically.

Windsurf

Add to your Windsurf MCP configuration file:

{
  "mcpServers": {
    "deadcode-mcp": {
      "command": "npx",
      "args": ["-y", "deadcode-mcp"]
    }
  }
}

With a Pro license

If you have a PRO_LICENSE key, pass it as an environment variable:

{
  "mcpServers": {
    "deadcode-mcp": {
      "command": "npx",
      "args": ["-y", "deadcode-mcp"],
      "env": {
        "PRO_LICENSE": "your-license-key-here"
      }
    }
  }
}

Tools

find_unused_exports

Identifies exported functions, classes, and variables that are never imported elsewhere in the codebase.

Parameters:

  • directory (string, required) — root directory to scan
  • include_types (boolean, optional) — also report unused TypeScript type/interface exports (default: false)

Example:

Find all unused exports in src/

find_unreferenced_files

Detects orphaned files that aren't imported or required by any other module.

Parameters:

  • directory (string, required) — root directory to scan

Example:

Show me unreferenced files in the project

find_unused_functions

Locates functions and methods that are defined but never called.

Parameters:

  • directory (string, required) — root directory to scan

Example:

Find unused functions in src/utils/

detect_circular_dependencies

Identifies circular dependency chains that can cause module resolution issues.

Parameters:

  • directory (string, required) — root directory to scan

Example:

Detect circular dependencies in src/

get_file_dependencies

Shows all imports and exports for a specific file.

Parameters:

  • file_path (string, required) — path to the file to analyse

Example:

Show dependencies for src/utils/helpers.ts

summarize_codebase_health

Runs all checks and returns a consolidated health report with severity scores.

Parameters:

  • directory (string, required) — root directory to scan

Example:

Give me a full codebase health report

list_premium_features

Lists the premium tools available with a Pro license. Call this tool to discover what additional capabilities are unlocked.

Example:

What premium features are available?

Premium Features

A Pro license unlocks three additional tools:

Tool Description
batch_process_directory Run all checks in one call and receive a consolidated report
configure_analysis_options Persist per-project ignore patterns and severity thresholds
extra_insights Advanced heuristics: barrel-file dead entries, dead type aliases, test-only references

Get a license at https://craftpipe.gumroad.com and set it via the PRO_LICENSE environment variable (see configuration examples above).

Limitations

  • Dynamic imports resolved at runtime are not tracked.
  • Wildcard re-exports (export * from '...') may cause false positives.
  • Reflection / eval-based access to exports cannot be detected.
  • Results are a helpful guide — always review before deleting code.

License

MIT © Craftpipe

About

An MCP server that gives AI coding agents dead code detection superpowers — find unused exports, unreferenced functions, orphaned files, and circular dependencies across any JavaScript/TypeScript project. Agents can clean up codebases without manual auditing.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors