Safe Fix MCP logo

Safe Fix MCP

Finds high-confidence unused imports and proposes test-gated branches and pull requests without merging changes.

Install Safe Fix MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "safe-fix-mcp": {
      "command": "uvx",
      "args": [
        "safe-fix-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx safe-fix-mcp

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 6d ago.

Overview

The safe-fix-mcp MCP server scans Python repositories for dead code and dependency issues, then identifies a narrow class of imports that can be removed automatically. Its read-only scan uses Vulture and Deptry, while the removal workflow checks the working tree, creates a branch, edits only qualifying imports, and runs the repository's full pytest suite. A passing change is committed, pushed, and submitted through GitHub CLI when available; failures leave the repository unchanged. Reach for it when you want reviewable dead-code cleanup rather than direct deletion.

Use cases

  • Scan a Python repository for dead code
  • Review unused-import findings before cleanup
  • Propose a tested branch for safe import removal
  • Create a GitHub pull request after tests pass

Key features

  • Vulture dead-code scanning
  • Deptry dependency analysis
  • High-confidence single-name import removal
  • Full pytest gating before commits
  • Branch and pull-request workflow
  • Dirty-tree protection

Tools2

What Safe Fix MCP lets your agent do. Expand a tool for its parameters.

Self-reported~1 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

10/10 checks healthy over the last 62d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 12d ago via OSV.dev · safe-fix-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
Last commit2mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed2Callable tools this server registers over MCP.

How Safe Fix MCP works

What safe-fix-mcp MCP server does

The safe-fix-mcp MCP server examines Python repositories for possible dead code and dependency problems. It separates findings that can be acted on automatically from findings that should remain for human review. Unused functions, classes, and dependencies are reported only. Automatic removal is limited to unused imports with at least 90% Vulture confidence when the import is the only name on its line.

The workflow is intentionally review-oriented. It never merges a pull request, and it does not edit a repository with uncommitted changes. This makes safe-fix-mcp MCP server suitable for teams that want a proposed change and normal code review to remain part of cleanup.

How it works

The scan_dead_code tool accepts a repository path and a minimum confidence threshold, defaulting to the current directory and 60. It runs Vulture for dead-code detection and Deptry for dependency issues, then returns readable findings without modifying files.

The propose_removal_pr tool applies the restricted cleanup path. It first rejects a dirty working tree, selects only qualifying single-name unused imports, and skips lines such as from package import first, second, where deleting the whole line could remove a still-used name. It creates a Git branch, removes the selected imports, and runs the target repository's full test suite with its real pytest command.

Only a successful test run permits a commit and push. If GitHub CLI is installed and authenticated, the tool also attempts gh pr create. Without a usable gh, the branch can still be committed and pushed, while the returned error indicates that the pull request must be opened manually. A failed test run does not commit or push the attempted edit.

Setup and configuration

Install the package from PyPI with pip install safe-fix-mcp, or install a source checkout in editable mode with pip install -e .. The server can be started as safe-fix-mcp or with python -m safe_fix_mcp.server. A client configuration can launch the command through standard MCP stdio, including the documented Claude Code command.

Python 3.10 or newer and Git on PATH are required. GitHub CLI is additionally required and must be authenticated if the workflow should create a pull request. The package includes a skill for Claude that explains the two-tool workflow; run safe-fix-mcp-install-skill from the project root to write it under .claude/skills/safe-fix-mcp/SKILL.md.

Tools and capabilities

  • scan_dead_code(repo_path=".", min_confidence=60): read-only Vulture and Deptry analysis.
  • propose_removal_pr(repo_path="."): guarded import removal, testing, branch creation, push, and optional pull-request creation.
  • z and gh: exposed MCP tools listed by the package.

Limitations and notes

The automatic path does not remove functions, classes, or dependencies. It also does not remove multi-name import lines. Pull-request creation depends on an installed, authenticated GitHub CLI, although branch publication can still happen without it. Vulture may report the MCP tool functions as unused because their runtime callers are supplied by the decorator and MCP framework rather than direct source-level calls.

The safe-fix-mcp MCP server includes a subprocess verification script that communicates with the packaged server through a real MCP client session. Run python scripts/verify_real_client.py as a smoke test after changes.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Safe Fix MCP

safe-fix-mcp is an MCP server that connects to a Python repository through Git, Vulture, Deptry, pytest, and optionally GitHub CLI. Its main tools scan for dead code and dependency issues, then propose a branch and pull request for high-confidence unused single-name imports after the repository's full test suite passes.

Install it with `pip install safe-fix-mcp`, then launch `safe-fix-mcp` from your MCP client configuration. Python 3.10 or newer and Git on `PATH` are required; authenticated GitHub CLI is needed only for automatic pull-request creation.

Yes, safe-fix-mcp works with Claude Code through the documented `claude mcp add safe-fix-mcp -- safe-fix-mcp` command. Its package also includes an optional skill installer that writes guidance into the current project's `.claude/skills` directory.

It removes only unused imports with at least 90% Vulture confidence when each candidate is the sole name on its import line. Unused functions, classes, dependencies, and multi-name import lines remain report-only.

The change is not committed or pushed when the repository's full test suite fails. The workflow is gated on a real pytest run, so the repository is left as it was before the attempted removal.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewSafe Fix MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/safe-fix-mcp?style=directory)](https://allmcps.com/mcp/safe-fix-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/safe-fix-mcp"><img src="https://allmcps.com/api/badge/safe-fix-mcp?style=directory" alt="Safe Fix MCP on AllMCPs" /></a>