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.
npx deadcode-mcpnpm install -g deadcode-mcpAdd 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"]
}
}
}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.
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.
Add to your Windsurf MCP configuration file:
{
"mcpServers": {
"deadcode-mcp": {
"command": "npx",
"args": ["-y", "deadcode-mcp"]
}
}
}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"
}
}
}
}Identifies exported functions, classes, and variables that are never imported elsewhere in the codebase.
Parameters:
directory(string, required) — root directory to scaninclude_types(boolean, optional) — also report unused TypeScript type/interface exports (default:false)
Example:
Find all unused exports in src/
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
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/
Identifies circular dependency chains that can cause module resolution issues.
Parameters:
directory(string, required) — root directory to scan
Example:
Detect circular dependencies in src/
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
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
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?
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).
- 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.
MIT © Craftpipe