Skip to content

Add Python Refactoring MCP Server#207

Merged
ipedrazas merged 1 commit intodocker:mainfrom
slamer59:add-python-refactoring-server
Sep 4, 2025
Merged

Add Python Refactoring MCP Server#207
ipedrazas merged 1 commit intodocker:mainfrom
slamer59:add-python-refactoring-server

Conversation

@slamer59
Copy link
Contributor

@slamer59 slamer59 commented Sep 4, 2025

This PR adds the Python Refactoring MCP Server to the Docker MCP Registry, providing educational refactoring assistance for Python developers using AI tools.

Server Overview

Key Features

🎓 Educational Approach: Provides step-by-step refactoring instructions without automatically modifying code
🛠️ Professional Tools: Uses industry-standard analysis tools (Rope, Radon, Vulture, Jedi, LibCST, Pyrefly)
🤖 AI Assistant Compatible: Works seamlessly with Claude, GPT, Cursor, Continue, and other AI coding assistants
📚 Learning Focused: Teaches refactoring patterns through guided practice and precise instructions
⚙️ Dual Mode Support: Both guide-only and apply-changes modes for different use cases
🎯 Precise Analysis: Identifies specific issues with exact line numbers and actionable recommendations

Analysis Capabilities

  • Functions over 20 lines (extract method opportunities)
  • High cyclomatic complexity (>10) using McCabe analysis
  • High cognitive complexity (>15) using Complexipy analysis
  • Functions with too many parameters (>5)
  • Dead/unused code detection via Vulture
  • Low maintainability index (<20) using Radon metrics
  • Type annotation problems detected by Pyrefly
  • Large files (>500 lines) with module splitting recommendations

Available MCP Tools

  • analyze_python_code - Comprehensive code analysis with guided suggestions
  • extract_function - Extract method refactoring assistance
  • quick_analyze - Fast analysis for immediate feedback
  • check_types_with_pyrefly - Advanced type checking and quality analysis

Docker Implementation

Dockerfile Created: Located at project root with Python 3.13-slim base
No Additional Configuration: Server works out-of-the-box with no environment variables needed
Container Ready: Optimized for containerized deployment with minimal footprint

Registry Benefits

This server will benefit from Docker MCP Registry's enhanced security features:

  • Cryptographic signatures for image integrity
  • Software Bill of Materials (SBOM) for transparency
  • Provenance tracking for supply chain security
  • Automatic security updates
  • Enterprise-grade trust and compliance

Installation Methods

Once published, users can access via:

  • Docker Desktop's MCP Toolkit
  • Docker Hub as mcp/mcp-python-refactoring
  • MCP catalog integration

Compliance Verification

✅ MIT License (allows consumption)
✅ Comprehensive documentation provided
✅ Working Dockerfile at repository root
✅ MCP standard compatibility verified
✅ Error handling and logging implemented
✅ Server configuration follows registry format

Target Audience

Perfect for:

  • Python developers learning refactoring best practices
  • AI assistant users seeking educational code improvement
  • Development teams establishing code quality standards
  • Educators teaching software engineering principles
  • Senior developers mentoring junior team members

This server fills a unique niche by focusing on education rather than automation, helping developers learn while maintaining full control over their code changes.

Educational Python refactoring assistant that provides guided suggestions for AI assistants.

Features:
- Step-by-step refactoring instructions without modifying code
- Comprehensive analysis using professional tools (Rope, Radon, Vulture, Jedi, LibCST, Pyrefly)
- Educational approach teaching refactoring patterns through guided practice
- Support for both guide-only and apply-changes modes
- Identifies long functions, high complexity, dead code, and type issues
- Provides precise line numbers and specific refactoring instructions
- Compatible with all AI assistants (Claude, GPT, Cursor, Continue, etc.)

Perfect for developers learning refactoring patterns while maintaining full control.
Acts as a refactoring mentor rather than an automated code modifier.

Repository: https://github.com/slamer59/mcp-python-refactoring
Category: development
License: MIT
@slamer59 slamer59 requested a review from a team as a code owner September 4, 2025 08:36
@ipedrazas ipedrazas merged commit c63b222 into docker:main Sep 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments