Skip to main content
Glama
README.md
<div align="center">

<img src="https://raw.githubusercontent.com/murugarajr/ohm-mcp/main/image/ohm-mcp.png" alt="OHM-MCP" width="300">

# OHM-MCP

**AI-Powered Python Refactoring & Code Quality Assistant**

Works with **GitHub Copilot**, **Cursor IDE**, **Cline**, and any MCP-compatible AI assistant.

[![MCP Registry](https://img.shields.io/badge/MCP_Registry-Official-blue?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMyA3VjE3TDEyIDIyTDIxIDE3VjdMMTIgMloiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgZmlsbD0ibm9uZSIvPgo8L3N2Zz4=)](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.Murugarajr%2Fohm-mcp/versions/1.0.1)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![MCP](https://img.shields.io/badge/MCP-0.1.0+-green.svg)](https://modelcontextprotocol.io)
[![AST-Based](https://img.shields.io/badge/AST--Based-100%25-brightgreen.svg)]()
[![License](https://img.shields.io/badge/license-MIT-blue.svg)]()

</div>

---

## โœจ Core Capabilities

<table>
<tr>
<td width="50%">

### ๐Ÿ—๏ธ **Architecture**
- God Object Detection
- SOLID Violation Analysis
- Design Pattern Suggestions
- Dependency Injection Refactoring

### ๐Ÿ”ง **Code Quality**
- AST Extract Method (100% accurate)
- Dead Code Elimination
- Import Refactoring
- Symbol Renaming (project-wide)
- Duplication Detection

</td>
<td width="50%">

### ๐Ÿ“Š **Type Safety**
- Type Coverage Analysis
- Type Stub Generation
- Auto Test Generation

### โšก **Performance**
- O(nยฒ) Pattern Detection
- Hotspot Analysis
- Coverage-Driven Prioritization

### ๐Ÿค– **Automation**
- Auto-Apply with Rollback
- Operation History
- Quality Dashboard

</td>
</tr>
</table>

---

## ๐Ÿš€ Quick Start

### Installation

#### ๐Ÿ“ฆ **Recommended: NPM Method (Auto-installs dependencies)**

No installation required! Use NPX to run the latest version automatically:

```bash
npx -y ohm-mcp@latest
```

This is the easiest way to get started. Just add the configuration to your AI assistant (see [IDE Configuration](#ide-configuration) below).

**MCP Registry:** mcp-name: io.github.Murugarajr/ohm-mcp

#### ๐Ÿ **Alternative: PyPI Method (For local development)**

Use this method when you need to:
- Develop locally with the Python package
- Use a specific Python virtual environment
- Install from source for customization

**Install from PyPI:**
```bash
pip install ohm-mcp
```

**Install from source (for development):**
```bash
pip install -e .
```

### IDE Configuration

#### ๐Ÿ“ฆ **Option 1: NPX (Recommended - Auto-installs dependencies)**

<details>
<summary><b>๐Ÿ”ต GitHub Copilot (VS Code) with NPX</b></summary>

**After publishing to npm:**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["ohm-mcp@latest"]
    }
  }
}
```

**For local development:**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["--package", "/path/to/ohm-mcp-npm", "ohm-mcp"]
    }
  }
}
```

**Usage:**
- Open Copilot Chat
- Type `#` and select `ohm-mcp` tools
- Ask: "Analyze this file and suggest refactorings"

</details>

<details>
<summary><b>๐ŸŸฃ Cursor IDE with NPX</b></summary>

**Global (After publishing to npm):**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["-y", "ohm-mcp@latest"]
    }
  }
}
```

**For local development:**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["--package", "/path/to/ohm-mcp-npm", "ohm-mcp"]
    }
  }
}
```

**Usage:**
- Open Cursor Chat (Cmd+L / Ctrl+L)
- Tools are automatically available
- Ask: "Use ohm-mcp to detect dead code"

</details>

<details>
<summary><b>๐ŸŸข Cline (VS Code Extension) with NPX</b></summary>

**Global (After publishing to npm):**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["-y", "ohm-mcp@latest"]
    }
  }
}
```

**For local development:**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["--package", "/path/to/ohm-mcp-npm", "ohm-mcp"]
    }
  }
}
```

**Usage:**
- Open Cline panel
- Tools are available in agent context
- Ask: "Analyze type coverage and suggest improvements"

</details>

<details>
<summary><b>๐ŸŸ  Antigravity with NPX</b></summary>

**Global (After publishing to npm):**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["-y", "ohm-mcp@latest"],
      "env": {
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}
```

**Usage:**
- Tools are automatically available in Antigravity
- Ask: "Use ohm-mcp to analyze architecture"

</details>

<details>
<summary><b>๐Ÿ”ด Roo Code with NPX</b></summary>

**Global (After publishing to npm):**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["-y", "ohm-mcp@latest"]
    }
  }
}
```

**Usage:**
- Open Roo Code panel
- Tools are available in agent context
- Ask: "Use ohm-mcp to detect duplicates"

</details>

<details>
<summary><b>โšซ Codex VS Code with NPX</b></summary>

**Configuration (config.toml):**
```toml
[mcp_servers.ohm-mcp]
args = ["-y", "ohm-mcp@latest"]
command = "npx"
```

**Usage:**
- Open Codex panel
- Tools are automatically available
- Ask: "Use ohm-mcp to suggest design patterns"

</details>

<details>
<summary><b>๐ŸŸก Kilo Code with NPX (Local/Global)</b></summary>

**Local (For local development with virtual environment):**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "/Users/username/project/venv/bin/python",
      "args": ["-m", "ohm_mcp.server"],
      "disabled": false,
      "alwaysAllow": []
    }
  }
}
```

**Global (After publishing to npm):**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "npx",
      "args": ["-y", "ohm-mcp@latest"]
    }
  }
}
```

**Usage:**
- Open Kilo Code panel
- Tools are available in agent context
- Ask: "Use ohm-mcp for refactoring"

</details>

#### ๐Ÿ **Option 2: Direct Python (Manual setup)**

<details>
<summary><b>๐Ÿ”ต GitHub Copilot (VS Code) with Python</b></summary>

First install: `pip install ohm-mcp`

Then add to `.vscode/mcp.json`:
```json
{
  "servers": {
    "ohm-mcp": {
      "command": "python",
      "args": ["-m", "ohm_mcp.server"]
    }
  },
  "inputs": []
}
```

**Usage:**
- Open Copilot Chat
- Type `#` and select `ohm-mcp` tools
- Ask: "Analyze this file and suggest refactorings"

</details>

<details>
<summary><b>๐ŸŸฃ Cursor IDE with Python</b></summary>

First install: `pip install ohm-mcp`

Then add to Cursor's MCP settings file (`.cursorrules` or MCP config):
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "python",
      "args": ["-m", "ohm_mcp.server"]
    }
  },
  "inputs": []
}
```

**Example with virtual environment:**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "/Users/username/projects/venv/bin/python",
      "args": ["-m", "ohm_mcp.server"]
    }
  }
}
```

**Usage:**
- Open Cursor Chat (Cmd+L / Ctrl+L)
- Tools are automatically available
- Ask: "Use ohm-mcp to detect dead code"

</details>

<details>
<summary><b>๐ŸŸข Cline (VS Code Extension) with Python</b></summary>

First install: `pip install ohm-mcp`

Then add to Cline's MCP settings:
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "python",
      "args": ["-m", "ohm_mcp.server"]
    }
  }
}
```

**Example with virtual environment:**
```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "/Users/username/projects/venv/bin/python",
      "args": ["-m", "ohm_mcp.server"]
    }
  }
}
```

**Note:** Cline requires absolute paths for both `command` and `cwd`.

**Usage:**
- Open Cline panel
- Tools are available in agent context
- Ask: "Analyze type coverage and suggest improvements"

</details>

<details>
<summary><b>๐Ÿ”ง Other MCP-Compatible Clients</b></summary>

Any MCP-compatible client can use this server. General configuration:

```json
{
  "mcpServers": {
    "ohm-mcp": {
      "command": "<python-interpreter-path>",
      "args": ["<path-to-mcp_server.py>"],
      "cwd": "<project-directory>"
    }
  }
}
```

**Finding your Python path:**
```bash
# Unix/Mac
which python
# or
which python3

# Windows
where python
```

</details>

---

## ๐Ÿ’ก Quick Usage Examples

Once configured, simply reference tools in your AI assistant chat using the format: use `#ohm-mcp.tool_name` on the current file or `@file_name.py`

### **๐Ÿ—‘๏ธ Find Dead Code**
```
Use #ohm-mcp.detect_dead_code on @utils.py
```
This will detect:
- โœ… Unused imports (import statements never referenced)
- โœ… Unused variables (assigned but never read)
- โœ… Unreachable code (after return/raise/break/continue)
- โœ… Unused functions (defined but never called)
- โœ… Shadowed variables (inner scope hides outer scope variable)

### **๐Ÿ“‹ Code Duplication Detection**
```
Use #ohm-mcp.detect_code_duplicates to find duplicates in /path/to/project
```
Finds:
- โœ… Exact duplicates (100% identical code blocks)
- โœ… Near duplicates (90%+ similarity)
- โœ… Duplicate functions (same structure, different names)
- โœ… Provides refactoring suggestions to eliminate duplication

### **๐Ÿ—๏ธ Architecture Analysis**
```
Analyze architecture of @my_module.py using #ohm-mcp.analyze_architecture
```
Detects:
- โœ… God Objects (classes doing too much)
- โœ… SOLID principle violations
- โœ… Circular dependencies
- โœ… High coupling issues

### **โœ‚๏ธ Extract Method Refactoring**
```
Use #ohm-mcp.extract_method_ast to extract lines 45-60 from @handler.py into a new function called "process_request"
```
Automatically:
- โœ… Detects required parameters
- โœ… Identifies return values
- โœ… Generates refactored code
- โœ… Creates unified diff patch

### **๐Ÿ”„ Safe Symbol Renaming**
```
Use #ohm-mcp.rename_symbol to rename "old_function_name" to "new_function_name" in /path/to/project
```
Features:
- โœ… AST-based (100% accurate)
- โœ… Detects naming conflicts
- โœ… Shows all occurrences before applying
- โœ… Updates docstrings and comments

### **๐Ÿ“Š Type Coverage Analysis**
```
Analyze type hints in @module.py using #ohm-mcp.analyze_type_hints
```
Provides:
- โœ… Coverage percentage and grade
- โœ… Functions missing type hints
- โœ… Suggested type annotations
- โœ… Migration plan with priorities

### **โšก Performance Optimization**
```
Use #ohm-mcp.analyze_performance on @slow_module.py
```
Detects:
- โœ… Nested loops (O(nยฒ) complexity)
- โœ… Quadratic list operations
- โœ… Repeated function calls (missing caching)
- โœ… Mutable default arguments
- โœ… Inefficient string concatenation

### **๐Ÿงช Auto-Generate Tests**
```
Generate tests for @calculator.py using #ohm-mcp.generate_characterization_tests
```
Creates:
- โœ… Happy path test cases
- โœ… Edge cases (None, zero, negative, empty)
- โœ… Ready-to-run pytest code
- โœ… Preserves current behavior before refactoring

### **๐ŸŽจ Design Pattern Suggestions**
```
Suggest design patterns for @legacy_code.py using #ohm-mcp.suggest_design_patterns
```
Recommends:
- โœ… Strategy pattern for long if/elif chains
- โœ… Factory pattern for repetitive object creation
- โœ… Observer pattern for callback hell
- โœ… Decorator pattern for cross-cutting concerns

### **๐Ÿ”ง Import Refactoring**
```
Use #ohm-mcp.refactor_imports to update all files in /path/to/project from "old.module" to "new.module"
```
Handles:
- โœ… Direct imports (`import old.module`)
- โœ… From imports (`from old.module import X`)
- โœ… Submodule imports
- โœ… Import aliases

---

## ๐ŸŽฏ Key Tools (30 Total)

<details>
<summary><b>๐Ÿ“‹ General Analysis & Planning (4 tools)</b></summary>

| Tool | Purpose | Output |
|------|---------|--------|
| `analyze_codebase` | Comprehensive code analysis | Issues + refactoring plan |
| `propose_function_refactor` | Function-level refactor planning | Detailed refactor proposal |
| `explain_refactoring` | Explain refactoring patterns | Educational guidance |
| `create_refactor_patch` | Generate unified diff patches | Patch file |

</details>

<details>
<summary><b>๐Ÿ—๏ธ Architecture & Design (4 tools)</b></summary>

| Tool | Purpose | Output |
|------|---------|--------|
| `analyze_architecture` | Detect God Objects, SOLID violations | Detailed issue report |
| `suggest_design_patterns` | Recommend patterns (Strategy, Factory, Observer) | Pattern suggestions + examples |
| `analyze_tight_coupling` | Find coupling issues | DI recommendations |
| `suggest_di_refactor` | Generate DI code | Before/after refactor |

</details>

<details>
<summary><b>๐Ÿ”ง Code Quality & Refactoring (10 tools)</b></summary>

| Tool | Purpose | Key Feature |
|------|---------|-------------|
| `extract_method_ast` | Extract code into function | 100% AST-based accuracy |
| `suggest_extractable_methods` | Find extractable blocks | Cohesion scoring |
| `detect_dead_code` | Find unused code | 5 types of dead code |
| `refactor_imports` | Update imports project-wide | Safe module renaming |
| `refactor_single_file_imports` | Refactor imports in one file | Single file focus |
| `analyze_wildcard_imports` | Find wildcard imports | Explicit replacements |
| `rename_symbol` | Rename across codebase | Conflict detection |
| `detect_code_duplicates` | Find DRY violations | Exact + near duplicates |
| `extract_function_code` | Extract single function code | Code extraction utility |
| `apply_function_refactor` | Apply function-level refactor | Direct code modification |

**Example - Extract Method:**
```python
# Input: Lines 45-60
result = extract_method_ast(code, 45, 60, "calculate_total")

# Output: Refactored code + patch + auto-detected params/returns
```

</details>

<details>
<summary><b>๐Ÿ“Š Type Safety & Testing (5 tools)</b></summary>

| Tool | Purpose | Benefit |
|------|---------|---------|
| `analyze_type_hints` | Check type coverage | Migration plan |
| `generate_type_stub` | Create .pyi files | Gradual typing |
| `generate_characterization_tests` | Auto-generate tests | Safe refactoring |
| `generate_test_for_function` | Single function tests | Targeted testing |
| `suggest_tests` | Suggest test strategies | Test planning |

</details>

<details>
<summary><b>โšก Performance & Prioritization (2 tools)</b></summary>

| Tool | Purpose | Detects |
|------|---------|---------|
| `analyze_performance` | Find bottlenecks | Nested loops, mutable defaults, O(nยฒ) |
| `prioritize_by_coverage` | Risk-based prioritization | High-risk uncovered code |

</details>

<details>
<summary><b>๐Ÿค– Automated Execution & History (4 tools)</b></summary>

```mermaid
graph LR
    A[apply_refactoring] --> B{Dry Run?}
    B -->|Yes| C[Show Preview]
    B -->|No| D[Create Backup]
    D --> E[Apply Changes]
    E --> F{Run Tests}
    F -->|Pass| G[Success]
    F -->|Fail| H[Auto Rollback]
    H --> I[rollback_refactoring]
```

| Tool | Purpose |
|------|--------|
| `apply_refactoring` | Auto-apply refactoring with safety checks |
| `rollback_refactoring` | Rollback previous refactoring |
| `show_refactoring_history` | View refactoring audit trail |
| `cleanup_old_backups` | Clean up old backup files |

**Features:**
- โœ… Automatic backup before changes
- โœ… Test execution validation
- โœ… Auto-rollback on failure
- โœ… Full audit trail with history
- โœ… Automatic backup cleanup

</details>

<details>
<summary><b>๐Ÿ“ˆ Metrics & Reporting (1 tool)</b></summary>

**`generate_quality_report`** - Comprehensive dashboard in HTML/Markdown/JSON

**Output Preview:**

```
๐Ÿ“Š Health Score: 85/100 (Good)
๐Ÿ“ Files: 47 | Lines: 12,450 | Tech Debt: 23 pts

๐Ÿ“Š Type Coverage: 67%
๐Ÿ—‘๏ธ Dead Code: 8 imports, 12 variables, 3 functions
โšก Performance: 4 nested loops, 2 mutable defaults
๐Ÿ“‹ Duplication: 3 exact, 5 near-duplicates
```

**Visual Dashboard:**
- ๐ŸŽจ Circular health gauge
- ๐Ÿ“Š Color-coded metrics (๐ŸŸข๐ŸŸก๐Ÿ”ด)
- ๐Ÿ“ˆ Trend tracking ready
- ๐Ÿ”— CI/CD integration (JSON export)

</details>

---

## ๐Ÿ’ก Common Workflows

### 1๏ธโƒฃ **Safe Refactoring**
```bash
generate_characterization_tests โ†’ pytest โ†’ extract_method_ast โ†’ pytest
```

### 2๏ธโƒฃ **Eliminate Duplication**
```bash
detect_code_duplicates โ†’ review suggestions โ†’ extract_method_ast
```

### 3๏ธโƒฃ **Type Migration**
```bash
analyze_type_hints โ†’ follow migration plan โ†’ generate_type_stub
```

### 4๏ธโƒฃ **Performance Optimization**
```bash
analyze_performance โ†’ prioritize_by_coverage โ†’ apply fixes
```

### 5๏ธโƒฃ **Module Refactoring**
```bash
refactor_imports(old="myapp.old", new="myapp.new") โ†’ review patches
```

### 6๏ธโƒฃ **Symbol Renaming**
```bash
rename_symbol(old="calc", new="calculate", preview_only=True) โ†’ apply
```

### 7๏ธโƒฃ **Quality Tracking**
```bash
generate_quality_report(format="html") โ†’ open dashboard โ†’ track trends
```

---

## ๐ŸŽจ Visual Examples

### Quality Dashboard Preview

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿ” Code Quality Dashboard                  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                             โ”‚
โ”‚       โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ     ๐Ÿ“ Overview           โ”‚
โ”‚       โ”‚   85    โ”‚     Files: 47             โ”‚
โ”‚       โ”‚  /100   โ”‚     Lines: 12,450         โ”‚
โ”‚       โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ     Tech Debt: 23         โ”‚
โ”‚     Health Score                            โ”‚
โ”‚                                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ“Š Type Coverage       โšก Performance       โ”‚
โ”‚  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ 67%         ๐Ÿ”ด 4 nested loops   โ”‚
โ”‚  120/180 typed          ๐ŸŸก 2 mutable args   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ—‘๏ธ Dead Code           ๐Ÿ“‹ Duplication      โ”‚
โ”‚  8 imports              3 exact             โ”‚
โ”‚  12 variables           5 near              โ”‚
โ”‚  3 functions                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### Symbol Rename Preview

```diff
# Before
- def calc(x, y):
-     return x + y
- result = calc(5, 3)

# After
+ def calculate_sum(x, y):
+     return x + y
+ result = calculate_sum(5, 3)

โœ… 1 function renamed
โœ… 3 call sites updated
โœ… 0 conflicts detected
```

---

## ๐Ÿง  Design Principles

| Principle | Implementation |
|-----------|----------------|
| ๐Ÿงช **Test-First** | Auto-generate characterization tests before refactoring |
| โ†ฉ๏ธ **Reversible** | Every change = backup + rollback capability |
| ๐ŸŽฏ **AST-Driven** | 100% accurate (no regex) |
| ๐Ÿ“Š **Risk-Aware** | Coverage + complexity = prioritization |
| ๐Ÿ›๏ธ **SOLID** | Detect violations + concrete fixes |
| ๐Ÿšซ **No Blindness** | Analyze โ†’ Plan โ†’ Validate |

---

## ๐Ÿ”Œ IDE Compatibility

<table>
<tr>
<td align="center" width="100%">
<b>๐Ÿค– Any MCP Client</b><br>
โœ… Standard Protocol<br>
โœ… Easy Setup<br>
โœ… Works with all MCP-compatible AI assistants
</td>
</tr>
</table>

---


## ๐Ÿ“Š Comparison

| Feature | OHM MCP | Traditional Tools |
|---------|---------|-------------------|
| Accuracy | 100% AST | ~70% Regex |
| Safety | Auto backup/rollback | Manual |
| Testing | Auto-generates | Manual |
| Automation | Full | Suggestions only |
| Dashboard | HTML/JSON/MD | Text logs |
| IDE Support | Copilot/Cursor/Cline | Limited |

---

## ๐ŸŽฏ Use Cases

<table>
<tr>
<td><b>๐Ÿ‘จโ€๐Ÿ’ป Developers</b><br>โ€ข Refactor legacy code safely<br>โ€ข Find dead code<br>โ€ข Optimize performance</td>
<td><b>๐Ÿ‘ฅ Teams</b><br>โ€ข Track tech debt<br>โ€ข Enforce standards<br>โ€ข Design patterns</td>
<td><b>๐Ÿš€ CI/CD</b><br>โ€ข Quality gates<br>โ€ข Trend tracking<br>โ€ข Block bad PRs</td>
</tr>
</table>

---

## ๐Ÿ“ˆ Metrics

```
โœ… 30 MCP Tools
โœ… 40+ Static Checks
โœ… 100% AST Accuracy
โœ… Zero Regex Patterns
โœ… Automated Execution with Rollback
โœ… Beautiful Dashboards (HTML/JSON/MD)
โœ… Universal MCP Compatibility
โœ… Safe Refactoring with Auto-Backup
```

---

## ๐Ÿ› ๏ธ Troubleshooting

<details>
<summary><b>MCP Connection Issues</b></summary>

1. **Verify Python path:**
   ```bash
   which python  # Unix/Mac
   where python  # Windows
   ```

2. **Test MCP server directly:**
   ```bash
   python -m ohm_mcp.server
   ```

3. **Check logs:**
   - VS Code: Check Output panel
   - Cursor: Check Cursor logs
   - Cline: Check Cline settings panel

4. **Common issues:**
   - โŒ Relative paths in `command` โ†’ Use absolute paths
   - โŒ Missing virtual environment โ†’ Activate venv first
   - โŒ Wrong `cwd` for Cline โ†’ Must be absolute path

</details>

---

## ๐Ÿค Contributing

Run before submitting:
```bash
./static_analyser.sh  # Runs ruff, mypy, pylint, flake8
pytest                 # All tests must pass
```

---

## ๐Ÿ™ Credits

Built with [Model Context Protocol](https://modelcontextprotocol.io) โ€ข Python AST โ€ข Compatible with GitHub Copilot, Cursor IDE, Cline

---

<div align="center">

**Made with โค๏ธ for better code quality**

โญ **Star this repo** if it helps you write cleaner code!

[Documentation](https://www.ohm-mcp.dev) 

</div>