Skip to content
Conduit

mcp server

Mago-MCP

MCP server that gives AI assistants Mago's PHP linter, formatter, and static analyser.

hussainbiedouh/Mago-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": {
    "hussainbiedouh-mago-mcp": {
      "command": "uvx",
      "args": [
        "mago-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 28, 2026

Mago MCP Server

An MCP server that gives AI assistants Mago, the PHP linter, formatter and static analyser, as callable tools.

Tools

ToolWhat it runs
mago_lintmago lint on a PHP file or directory
mago_formatmago format on a PHP file or directory
mago_analyzemago analyze on a PHP file or directory

mago_lint

ArgumentTypeDefaultDescription
pathstringrequiredPHP file or directory to lint
fixbooleanfalseTry to fix the issues that were found

mago_format

ArgumentTypeDefaultDescription
pathstringrequiredPHP file or directory to format
checkbooleanfalseReport whether formatting is needed, change nothing
diffbooleanfalseShow the differences that would be made

mago_analyze

ArgumentTypeDefaultDescription
pathstringrequiredPHP file or directory to analyse

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

Requirements

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

Install Mago from its releases page, or with Cargo:

cargo install mago

Install

git clone https://github.com/hussainbiedouh/Mago-MCP.git
cd Mago-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": {
      "mago-mcp": {
        "type": "local",
        "command": [
          "C:\\path\\to\\Mago-MCP\\.venv\\Scripts\\python.exe",
          "-m",
          "mago_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 mago to run

The server looks for the executable in this order:

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

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

Development

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

pip install ruff
ruff check .

License

MIT

↑↓ navigate openesc close