# safe-fix-mcp [Health: Active]

**Category:** 🔄 Version Control  
**Repository:** https://github.com/pamela-0/safe-fix-mcp  
**GitHub Stars:** 1  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/safe-fix-mcp

## Description
Finds real dead code and proposes a safe, test-gated branch+PR to remove it.

## Tools
Capabilities this server exposes over MCP:

- **z**
- **gh**

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

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

## Documentation

## 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.

_Full upstream README: https://allmcps.com/mcp/safe-fix-mcp/readme_

