MCP_server_for_Automated_Refactoring

akv2011/MCP_server_for_Automated_Refactoring

3.2

If you are the rightful owner of MCP_server_for_Automated_Refactoring and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

TaskMaster is a Model Context Protocol (MCP) server designed to automate code refactoring, ensuring code quality and maintainability across various programming languages.

Tools
6
Resources
0
Prompts
0

TaskMaster MCP Server

🚀 Intelligent Automated Code Refactoring for AI Assistants

TaskMaster is a Model Context Protocol (MCP) server that provides automated code refactoring capabilities. It monitors codebases, identifies files exceeding complexity thresholds (e.g., 1500+ lines), and performs intelligent refactoring operations to maintain code quality and maintainability.

🎯 Key Features

  • 🔍 Automated Detection: Identifies files exceeding configurable thresholds (lines, complexity, functions)
  • 🤖 AI-Powered Suggestions: Generates intelligent refactoring strategies using GPT-4/Claude
  • 🛡️ Safe Execution: Automatic backups, test validation, and rollback support
  • 🗄️ Database Refactoring: Specialized handling for migrations, SQL files, and ORM models
  • 🌐 Multi-Language Support: Python, JavaScript, TypeScript, Java, C#, SQL
  • ⚡ Real-time Analysis: Fast code analysis with tree-sitter parsing

📋 Project Status

Current Phase: Development - Task 1 Complete ✅

See for the complete Product Requirements Document.

🏗️ Project Structure

MCP server weather data/
├── .github/              # GitHub workflows and instructions
├── .taskmaster/          # TaskMaster configuration and tasks
├── .vscode/              # VS Code configuration (mcp.json)
├── taskmaster-server/    # Main TaskMaster MCP server
│   ├── taskmaster/       # Core package
│   ├── tests/            # Test suite
│   ├── taskmaster.py     # Server entry point
│   ├── pyproject.toml    # Dependencies
│   └── README.md         # Server documentation
├── TASKMASTER_PRD.md     # Product Requirements Document
└── README.md             # This file

🚀 Quick Start

Prerequisites

  • Python 3.10+
  • Conda or similar package manager
  • OpenAI API key (for GPT-4 suggestions)
  • Anthropic API key (for Claude suggestions)

Installation

# Navigate to server directory
cd taskmaster-server

# Activate your Python environment
conda activate base

# Install dependencies
pip install -e .

# Run tests
python -m pytest tests/ -v

Configure MCP

Add TaskMaster to your .vscode/mcp.json:

{
  "servers": {
    "taskmaster": {
      "command": "python",
      "args": [
        "/path/to/taskmaster-server/taskmaster.py"
      ],
      "type": "stdio",
      "env": {
        "OPENAI_API_KEY": "your-openai-key",
        "ANTHROPIC_API_KEY": "your-anthropic-key"
      }
    }
  }
}

🛠️ Development Progress

Completed Tasks ✅

  1. Project Setup and Core Dependency Installation
    • Created project structure
    • Configured pyproject.toml with all dependencies
    • Set up testing framework
    • All tests passing (4/4)

In Progress 🚧

  1. Configuration Management System - Next up
  2. File Scanner and Directory Walker
  3. Multi-Language Parser (Tree-sitter)
  4. Code Metrics Calculation Engine

See .taskmaster/tasks/tasks.json for the complete task list.

🔧 Available MCP Tools (Coming Soon)

  • analyze_codebase - Scan and identify files requiring refactoring
  • suggest_refactoring - Generate AI-powered refactoring strategies
  • execute_refactoring - Apply approved refactoring safely
  • refactor_database - Specialized database migration handling
  • get_refactoring_status - Track ongoing operations
  • rollback_refactoring - Undo changes if needed

📊 Configuration

TaskMaster uses .taskmaster.json for project-specific configuration:

{
  "thresholds": {
    "maxLines": 1500,
    "maxFunctions": 50,
    "maxComplexity": 15,
    "maxClassSize": 500
  },
  "languages": ["python", "javascript", "typescript"],
  "excludePatterns": ["**/test/**", "**/vendor/**"],
  "safety": {
    "requireTests": true,
    "createBackups": true,
    "dryRunFirst": true
  }
}

🧪 Testing

# Run all tests
python -m pytest tests/ -v

# Run with coverage
python -m pytest tests/ --cov=taskmaster --cov-report=html

# Run specific test
python -m pytest tests/test_basic.py -v

📚 Documentation

  • - Complete PRD with features, architecture, and roadmap
  • - Detailed server documentation
  • - TaskMaster workflow guide

🤝 Contributing

This project uses TaskMaster AI for task management. To contribute:

  1. Review tasks: npx task-master-ai list
  2. Get next task: npx task-master-ai next
  3. Implement the task
  4. Run tests: python -m pytest
  5. Update task status: npx task-master-ai set-status --id=<id> --status=done

📄 License

MIT License

👤 Author

Arun Kumar


Built with FastMCP 🚀 | Powered by TaskMaster AI 🤖