safe-fix-mcp
safe-fix-mcp
Pythonリポジトリ内のデッドコードを検出し、自動削除しても実際に安全な唯一の種類の検出結果(単一の名前だけをインポートする行の未使用インポート)についてブランチ + PRを提案する、実際のMCPサーバーです。それ以外に検出されるもの(未使用の関数、クラス、未使用の依存関係)はレポートのみに留まります。マージは常に人間が行います。このツール自体が何かをマージすることは決してありません。
なぜこれが存在するのか
ほとんどの「デッドコード」ツールはレポートを出すだけで終わります。さらに踏み込むツールは、通常は安全策なしに削除します。これはどちらでもありません。削除後にターゲットリポジトリ自身の完全なテストスイートが実際に通ることを条件に、実際の、最小限の、レビュー可能なPRのドラフトを作成します。ヒューリスティックではなく、実際のpytestの実行です。スイートが失敗した場合は、何もコミットもプッシュもされず、リポジトリは開始時とまったく同じ状態のままになります。
Related MCP server: code-review-mcp-server
ツール
scan_dead_code(repo_path=".", min_confidence=60)
読み取り専用です。vulture(デッドコード)とdeptry(依存関係の問題)を実行し、人間が読める形式の検出結果リストを返します。何も変更しません。
propose_removal_pr(repo_path=".")
作業ツリーが汚れている場合は拒否します。未コミットの作業の上で編集することは決してありません。
単一の名前だけをインポートする行のうち、vultureの信頼度が90%以上の未使用インポートのみに絞り込みます(
from x import y, zはスキップされます。行全体を削除するとzも黙って削除されてしまうためです)。実際のブランチを作成し、条件に合うインポートを削除し、リポジトリの実際の完全なテストスイートを実行します。
実際に成功した場合のみ、コミット、プッシュ、そして
gh pr createによるPRのオープンを試みます。ghがインストールされていない、または認証されていない場合でも、ブランチは実際にコミット・プッシュされます。低下するのはPR作成だけであり、実際のエラーが返されるため、手動でPRを開くことができます。
インストール
pip install -e .MCPクライアントの設定に追加します(例: Claude Code):
claude mcp add safe-fix-mcp -- safe-fix-mcpまたは、ローカルテスト用に直接実行します:
python -m safe_fix_mcp.server要件
Python ≥ 3.10
PATHに
gitがあることpropose_removal_prで実際にPRを開きたい場合は、PATHにgh(GitHub CLI)があり、認証済みであること — これがない場合でも、ブランチは実際にプッシュされ、ツールが手動でPRを開くように指示します。
開発
pip install -e ".[dev]"
pytest既知の制限
vultureはscan_dead_code/propose_removal_pr自体を「未使用」とフラグ付けします。これは既知の誤検知の一種であり、実際のバグではありません。これらは実行時に@mcp.tool()デコレータによってディスパッチされ、ソース内のどこからも直接呼び出されないため、静的コールグラフ解析では実際の呼び出し元(MCPフレームワーク自体)を確認できないのです。
実際に検証する
scripts/verify_real_client.pyは、パッケージ化されたサーバーを実際のサブプロセスとして起動し、実際のmcp.client.ClientSessionを使って通信します。これは実際のMCPクライアントが使用するのと同じ経路です。変更後のスモークテストとして役立ちます:
python scripts/verify_real_client.pyThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBqualityCmaintenanceEnables comprehensive security vulnerability scanning and code quality analysis for Python applications. Provides detailed reports with scoring, actionable suggestions, and comparison tracking specifically designed for backend developers working with frameworks like Django, Flask, and FastAPI.51
- Alicense-qualityAmaintenanceEnables automated code review and GitHub PR commenting through MCP integration.439MIT
- Alicense-qualityDmaintenanceEnables AI-powered code review and improvement, including analysis, refactoring suggestions, and automatic test generation, with an optional agentic loop for iterative refinement.MIT
- Alicense-qualityCmaintenanceEnables automated Python code quality checks including linting, complexity analysis, typo detection, structure validation, duplicate detection, and test coverage, with integration into Cursor IDE and CLI.MIT
Related MCP Connectors
Screens public GitHub repos and PRs to generate risk maps, findings, and merge-readiness signals.
Autonomous dev team steered from chat: plain-English requests in, tested merged PRs out.
Generate SBOMs, scan vulnerabilities, and analyze dependencies from local projects or Git repos.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pamela-0/safe-fix-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server