Skip to content
Conduit

mcp server

Ruff-MCP

MCP server that exposes Ruff's linter and formatter as tools, so AI assistants can lint and format Python in place.

hussainbiedouh/Ruff-MCPcommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

Before you start

  • uv (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "ruff-mcp": {
      "command": "uvx",
      "args": [
        "ruff-mcp"
      ]
    }
  }
}

same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12

Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs

README

synced Oct 26, 2026

Ruff MCP Server

An MCP server that gives AI assistants Ruff, the Python linter and formatter, as callable tools.

Tools

ToolWhat it runs
ruff_checkruff check on a file or directory
ruff_formatruff format on a file or directory
ruff_fixruff check --fix on a file or directory

ruff_check

ArgumentTypeDefaultDescription
pathstringrequiredFile or directory to check
fixbooleanfalseApply the fixes instead of only reporting them
output_formatstringconciseOne of concise, full, json, json-lines, junit, sarif

ruff_format

ArgumentTypeDefaultDescription
pathstringrequiredFile or directory to format
checkbooleanfalseReport whether formatting is needed, change nothing
diffbooleanfalseShow the diff instead of writing the changes

ruff_fix

ArgumentTypeDefaultDescription
pathstringrequiredFile or directory to fix
unsafebooleanfalseAlso apply the fixes Ruff marks as unsafe

The server also exposes a ruff://docs resource listing the available tools.

Requirements

  • Python 3.10 or newer
  • Ruff, either on your PATH or pointed at by the RUFF_EXE environment variable

Install Ruff with whichever of these suits you:

pip install ruff
winget install astral.Ruff                   # Windows
brew install ruff                            # macOS
curl -LsSf https://astral.sh/ruff/install.sh | sh   # Linux

Install

git clone https://github.com/hussainbiedouh/Ruff-MCP.git
cd Ruff-MCP

python -m venv .venv
.venv\Scripts\activate        # Windows
source .venv/bin/activate     # macOS and Linux

pip install -e .

Add it to your client

The server speaks stdio, which means the client starts it and stops it with the session. Ready-made snippets are in mcp-configs/, and each client expects a different key:

ClientConfig fileKey
OpenCode~/.config/opencode/opencode.jsoncmcp.servers
Claude Desktopclaude_desktop_config.jsonmcpServers
Cursor~/.cursor/mcp.jsonmcpServers
VS Code.vscode/mcp.jsonservers

For OpenCode:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "ruff-mcp": {
        "type": "local",
        "command": [
          "C:\\path\\to\\Ruff-MCP\\.venv\\Scripts\\python.exe",
          "-m",
          "ruff_mcp"
        ],
        "environment": {
          "PYTHONIOENCODING": "utf-8"
        }
      }
    }
  }
}

Point the command at the full path of the interpreter. The PATH a client inherits is not always the PATH in your shell, and python can resolve to a different install than the one you tested with.

The same file will not work across clients, because the key differs. mcp-client-config has the full table and what each failure mode looks like.

Choosing which ruff to run

The server looks for the executable in this order:

  1. the RUFF_EXE environment variable
  2. ruff or ruff.exe on PATH
  3. ~/.config/opencode/tools/ruff.exe

If none of them turn up an executable, the tool call comes back with an error telling you to install Ruff.

Development

There is no test suite yet. The check that matters is the linter:

pip install ruff
ruff check .

License

MIT

↑↓ navigate openesc close