Ohm MCP Server

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

Local serverstdioPython

What is the Ohm MCP server?

Most developer tooling work still happens through a UI a human drives. Ohm MCP server moves it into the conversation instead. AST-based Python refactoring MCP server with safe automated refactorings and rollback.

The short version

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

The tools it exposes

The server publishes 14 tools. What each one is for:

  • analyze_codebase — Comprehensive code analysis
  • propose_function_refactor — Function-level refactor planning
  • explain_refactoring — Explain refactoring patterns
  • create_refactor_patch — Generate unified diff patches
  • analyze_architecture — Detect God Objects, SOLID violations
  • suggest_design_patterns — Recommend patterns (Strategy, Factory, Observer)
  • analyze_tight_coupling — Find coupling issues
  • suggest_di_refactor — Generate DI code
  • extract_method_ast — Extract code into function
  • suggest_extractable_methods — Find extractable blocks
  • detect_dead_code — Find unused code
  • refactor_imports — Update imports project-wide

What it needs from you

Configuration is passed through the environment: PYTHONUNBUFFERED. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

Getting it running

The server ships on npm as ohm-mcp, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

How it compares

This sits in the developer tooling group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Ohm's toolset — analyze_codebase, propose_function_refactor, explain_refactoring and 11 more — is a fair guide to whether it matches your workflow. It is maintained by Murugarajr; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Ohm.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
analyze_codebaseComprehensive code analysis
propose_function_refactorFunction-level refactor planning
explain_refactoringExplain refactoring patterns
create_refactor_patchGenerate unified diff patches
analyze_architectureDetect God Objects, SOLID violations
suggest_design_patternsRecommend patterns (Strategy, Factory, Observer)
analyze_tight_couplingFind coupling issues
suggest_di_refactorGenerate DI code
extract_method_astExtract code into function
suggest_extractable_methodsFind extractable blocks
detect_dead_codeFind unused code
refactor_importsUpdate imports project-wide
refactor_single_file_importsRefactor imports in one file
analyze_wildcard_importsFind wildcard imports

How to install the Ohm MCP server

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

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
PYTHONUNBUFFEREDConfiguration value read at startup.Optional

Example prompts to try

  • Use Ohm to analyze codebase.
  • Use Ohm to propose function refactor.
  • Use Ohm to explain refactoring.

Frequently asked questions

It connects Ohm to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (analyze_codebase, propose_function_refactor, explain_refactoring, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Ohm directly.