Skip to content
Agentmart
Submit a tool

Ohm MCP

AST-based Python refactoring MCP server with safe automated refactorings and rollback

Connector by Murugarajr · GitHub account verified by the MCP Registry

IndexedMITLocal (stdio)★ 2
Write a review

Install

Works with Claude Code, Codex, VS Code, Cursor, Windsurf, Claude Desktop. Read the repository before you give any tool access to your data.

npx agentmarket install connector/murugarajr-ohm-mcp

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

AST-based Python refactoring MCP server with safe automated refactorings and rollback

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this server can do and what it asks for, from its tool list and install config. Checked Oct 25, 2026.

Tools
16 read · 8 write · 1 delete · 5 not yet classified
Secrets
None asked for
Install scripts
Not scanned yet
Runs as
Node.js package

Tools by what they do 30

Read from the source code; the running server may list different tools.

Read 16 · Look things up without changing anything.

  • analyze_architecture
  • analyze_codebase
  • analyze_performance
  • analyze_tight_coupling
  • analyze_type_hints
  • analyze_wildcard_imports
  • detect_code_duplicates
  • detect_dead_code
  • explain_refactoring
  • extract_function_code
  • extract_method_ast
  • show_refactoring_history
Show 4 more tools
  • suggest_design_patterns
  • suggest_di_refactor
  • suggest_extractable_methods
  • suggest_tests

Write 8 · Create, change, send or run things.

  • apply_function_refactor
  • apply_refactoring
  • cleanup_old_backups
  • create_refactor_patch
  • generate_type_stub
  • refactor_imports
  • refactor_single_file_imports
  • rename_symbol

Delete 1 · Delete, drop, revoke or wipe things.

  • rollback_refactoring

Not yet classified 5 · We could not tell from the name and description.

  • generate_characterization_tests
  • generate_quality_report
  • generate_test_for_function
  • prioritize_by_coverage
  • propose_function_refactor

Files it touches

  • Any path the agent passes to its tools

Tools (30)

Read from the source code; the running server may differ. Descriptions are the server’s own words; hidden characters are shown as [U+…].

  • analyze_architecture

    Analyze architecture-level issues: God Objects, Circular Dependencies, SOLID violations. Args: code: Single file code (for file-level analysis) file_path: Path to the file project_root_param: Root directory (for project-level analysis) module_paths: List of Python files to analyze (for project-level) Returns: JSON with god_objects, circular_deps, solid_violations, metrics

  • analyze_codebase

    Comprehensive code analysis for refactoring opportunities. Args: code: The source code to analyze file_path: Path to the file for contex include_analysis: Include detailed issue analysis include_plan: Include refactoring plan Returns: JSON formatted analysis with issues and refactoring plan

  • analyze_performance

    Identify performance hotspots and inefficient patterns. Detects: - Nested loops (O(n²) and worse complexity) - Quadratic list operations (membership tests in loops) - Repeated function calls (missing caching) - Loop-invariant code (should move outside loop) - Mutable default arguments (memory leaks) - Inefficient string concatenation - Unnecessary deep copies - Missing generator usage Provides optimization suggestions with before/after examples. Args: code: Source code to analyze file_path: File path for context Returns: { "total_issues": int, "issues_by_type": {...…

  • analyze_tight_coupling

    Detect tight coupling and suggest dependency injection. Identifies: - Global variable usage in functions - Hard-coded class instantiation - Singleton patterns - Static method dependencies Provides concrete DI refactoring examples for each issue. Args: code: Source code to analyze file_path: File path for context Returns: { "total_issues": int, "issues_by_type": {...}, "detailed_issues": [ { "type": str, "severity": str, "description": str, "problem": str, "recommendation": str, "refactor_examp…

  • analyze_type_hints

    Analyze type hint coverage and suggest missing annotations. Provides: - Coverage percentage and grade - List of functions missing type hints - Suggested type annotations (inferred from usage) - Migration plan with priorities Args: code: Source code to analyze file_path: File path for contex Returns: JSON with coverage metrics, suggestions, and migration plan

  • analyze_wildcard_imports

    Find wildcard imports (from module import *) and suggest explicit replacements. Analyzes which names are actually used and suggests: from module import * → from module import name1, name2, name3 Args: code: Source code to analyze file_path: File path for context Returns: { "wildcard_imports": [...], "suggestions": [ { "old": "from module import *", "new": "from module import x, y, z", "used_names": [...] } ] }

  • apply_function_refactor

    Apply a single-function refactor patch.

  • apply_refactoring

    Automatically apply refactoring with safety checks. Features: - Creates automatic backup before changes - Applies refactoring - Runs tests to validate changes - Automatically rolls back if tests fail - Logs all operations for audit trail Args: refactoring_type: Type of refactoring - 'extract_method': Extract code into new function - 'refactor_imports': Update import statements file_path: Relative path to file (from project root) parameters: Refactoring-specific parameters For extract_method: {start_line, end_line, new_function_name} For refactor_im…

  • cleanup_old_backups

    Clean up old backup files. Args: keep_days: Keep backups from last N days Returns: { "success": bool, "message": str }

  • create_refactor_patch

    Generate unified diff patch for proposed refactoring. Args: original_code: Original source code refactored_code: Refactored version file_path: File path for patch contex Returns: Unified diff format patch

  • detect_code_duplicates

    Detect duplicate and similar code blocks (DRY violations). Uses both token-based and AST-based detection: - Exact duplicates: Identical code blocks - Near duplicates: Similar code (90%+ similarity) - Duplicate functions: Functions with same structure Args: project_root: Root directory of the project file_paths: Specific files to analyze (None = all Python files) min_lines: Minimum lines for a block to be considered (default: 6) similarity_threshold: Minimum similarity ratio 0.0-1.0 (default: 0.9) include_near_duplicates: Detect similar (not just exact) code include_fu…

  • detect_dead_code

    Detect dead code, unused imports, variables, and functions. Finds: - Unused imports - 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) Args: code: Source code to analyze file_path: File path for contex Returns: JSON with dead code issues categorized by type and severity

  • explain_refactoring

    Explain refactoring patterns and reasoning. Args: issue_type: Type of refactoring (e.g., 'extract_method', 'simplify_conditional') context: Additional context about the code Returns: Detailed explanation of the refactoring approach

  • extract_function_code

    Extract a single function's source code from a file.

  • extract_method_ast

    Extract lines [start_line, end_line] into a new function using AST. Automatically detects: - Required parameters (variables from outside the block) - Return values (variables used after the block) - Proper indentation and scoping Args: code: Full source code start_line: Starting line number (1-indexed) end_line: Ending line number (1-indexed, inclusive) new_function_name: Name for the extracted function file_path: File path for contex Returns: { "success": bool, "refactored_code": str, "new_function": str, "extracted_params": list, "retu…

Show 15 more tools
  • generate_characterization_tests

    Auto-generate characterization tests to capture current behavior. Generates pytest tests with: - Happy path test cases - Edge cases (empty inputs, None, zero, negative, etc.) - Test structure ready to run with pytes Use these tests BEFORE refactoring to ensure behavior is preserved. Args: code: Source code to generate tests for file_path: File path for contex Returns: { "test_file": str, "test_content": str (ready to save and run), "functions_tested": int, "test_cases_generated": in }

  • generate_quality_report

    Generate code quality dashboard report. Fast, lightweight report generation. Args: project_root: Root directory of the project output_format: 'html', 'markdown', 'json', or 'all' Returns: Report paths and basic metrics

  • generate_test_for_function

    Generate characterization tests for a specific function. Args: code: Source code containing the function function_name: Name of the function to tes file_path: File path for contex Returns: { "function": str, "test_content": str (ready to run), "test_cases": list, "test_case_count": in }

  • generate_type_stub

    Generate a .pyi type stub file for the given code. Creates a stub file with: - Function signatures with inferred types - Class structures - Proper imports from typing module Args: code: Source code to generate stub for file_path: File path for context (stub will be .pyi) Returns: { "stub_file": str, "stub_content": str, "message": str }

  • prioritize_by_coverage

    Prioritize refactoring based on test coverage and complexity. Calculates risk score for each function based on: - Cyclomatic complexity (higher = riskier) - Test coverage % (lower = riskier) - Lines of code (larger = riskier) Functions are categorized as high/medium/low risk. Args: code: Source code to analyze file_path: File path for context coverage_data_path: Path to .coverage or coverage.json file (optional) Returns: { "high_risk_functions": [...], "medium_risk_functions": [...], "low_risk_functions": [...], "recommendations": [...], "forma…

  • propose_function_refactor

    Propose refactor plan for a single function.

  • refactor_imports

    Safely refactor all imports when renaming/moving a module. Uses AST-based rewriting to handle: - Direct imports (import old_module) - From imports (from old_module import X) - Submodule imports (from old_module.sub import Y) - Import aliases (import old_module as alias) Args: project_root: Root directory of the project old_module: Old module path (e.g., 'myapp.old_name') new_module: New module path (e.g., 'myapp.new_name') file_paths: Optional list of specific files to process Returns: { "files_changed": int, "changes": [ { "file": str, …

  • refactor_single_file_imports

    Refactor imports in a single file. Args: code: Source code file_path: File path for context old_module: Old module path new_module: New module path Returns: { "changed": bool, "old_imports": [...], "new_imports": [...], "refactored_code": str }

  • rename_symbol

    Safely rename variables, functions, classes, or methods across the project. Features: - AST-based analysis (100% accurate) - Respects scope and context - Detects naming conflicts - Shows all occurrences before applying - Generates unified diffs - Updates docstrings and comments Args: project_root: Root directory of the project old_name: Current symbol name new_name: New symbol name (must be valid Python identifier) symbol_type: Type of symbol to rename - 'variable': Local/global variables - 'function': Function names - 'class': Class names - 'm…

  • rollback_refactoring

    Rollback a previously applied refactoring. Args: operation_id: ID of operation to rollback (from apply_refactoring result) Returns: { "success": bool, "files_restored": list, "message": str }

  • show_refactoring_history

    Show history of refactoring operations. Args: limit: Maximum number of operations to show Returns: { "history": [ { "operation_id": str, "timestamp": str, "operation_type": str, "files_affected": list, "status": str, "test_results": dict } ] }

  • suggest_design_patterns

    Analyze code and suggest applicable design patterns. Detects: - Strategy: Long if/elif chains - Factory: Repetitive object creation - Observer: Callback hell / tight coupling - Decorator: Cross-cutting concerns - Template Method: Similar algorithms with variations Args: code: Source code to analyze file_path: File path for contex Returns: JSON with pattern suggestions, examples, and refactoring guidance

  • suggest_di_refactor

    Generate dependency injection refactor for a specific class. Analyzes class dependencies and generates: - Refactored class with constructor injection - List of identified dependencies - Before/after code comparison Args: code: Source code containing the class class_name: Name of the class to refactor file_path: File path for context Returns: { "dependencies_identified": [...], "current_code": str, "refactored_code": str (with DI), "changes": [...] }

  • suggest_extractable_methods

    Identify cohesive code blocks that should be extracted into methods. Uses cohesion analysis to find blocks with: - High internal cohesion (related operations) - Clear input/output boundaries - Reasonable size (3-10 lines) Args: code: Source code to analyze file_path: File path for contex Returns: JSON with extractable blocks, cohesion scores, and line ranges

  • suggest_tests

    Suggest test cases for refactoring validation. Returns: Test strategy and example code

Signals

Stars
2
Forks
0
Open issues
0
Weekly downloads
34
Last commit
Jan 24, 2026 (9 months ago)
Last release
Jan 24, 2026 (9 months ago)
Last package publish
Jan 24, 2026 (9 months ago)

From GitHub (fetched Oct 24, 2026) and the package registry.

Details

Registry name
io.github.Murugarajr/ohm-mcp
Version
1.0.1
Auth
No auth
Packages
npm ohm-mcppypi ohm-mcp
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026
Cite this page

Ohm MCP. Agent Mart. https://agentmart.dev/connectors/murugarajr-ohm-mcp (last updated 2026-10-24)