Homebrew MCP server

Exposes Homebrew package management commands as individual tools for installing, uninstalling, searching, upgrading, and maintaining macOS development environments through direct brew command execution.
Back to servers
Setup instructions
Provider
Alex Jeannier
Release date
May 29, 2025
Stats
12 stars

The Homebrew MCP server provides an interface for AI assistants to interact with your macOS Homebrew package manager using the Model Context Protocol. It enables AI tools like Claude Desktop to execute Homebrew commands on your behalf.

Installation

Prerequisites

  • macOS with Homebrew installed
  • Python 3.13
  • The uv dependency manager

Basic Setup

  1. Clone the repository:

    git clone https://github.com/jeannier/homebrew-mcp
    cd homebrew-mcp
    
  2. Install uv if not already installed:

    brew install uv
    
  3. Create a virtual environment and install dependencies:

    uv venv
    source .venv/bin/activate
    uv pip install -r requirements.txt
    

Claude Desktop Integration

  1. Install Claude Desktop (if not already installed):

    brew install --cask claude
    
  2. Configure Claude Desktop to use the MCP server:

    • Edit or create the configuration file at: ~/Library/Application Support/Claude/claude_desktop.json
    • Add the following configuration (replace /path/to/your/project/ with the absolute path to your cloned repository):
    {
      "mcpServers": {
        "homebrew-mcp": {
          "command": "uv",
          "args": [
            "run",
            "--directory",
            "/path/to/your/project/",
            "homebrew_mcp.py"
          ],
          "type": "stdio"
        }
      }
    }
    
  3. Restart Claude Desktop

Cursor Integration

  1. Install Cursor (if not already installed):

    brew install --cask cursor
    
  2. Add the tool to Cursor by clicking the "Add to Cursor" button on the repository page, or manually configure it by editing the ~/.cursor/mcp.json file.

  3. Restart Cursor for the changes to take effect.

Usage

Available Homebrew Commands

The MCP server supports the following Homebrew commands:

  • Package Management:

    • install - Install a package
    • uninstall - Remove a package
    • upgrade - Upgrade packages
    • cleanup - Remove old versions
  • Information & Discovery:

    • list - Show installed packages
    • search - Find packages
    • info - Display package information
    • outdated - Show outdated packages
    • deps - Display dependencies
  • System Health & Updates:

    • doctor - Check for problems
    • update - Update Homebrew
  • Tap & Source Management:

    • tap - Add a tap repository
    • untap - Remove a tap
  • Version Management:

    • pin - Pin package version
    • unpin - Unpin package version
  • Service Management:

    • services - Manage services

Example Prompts

You can use the following example prompts with Claude Desktop or another MCP client:

  • "Provide a summary of all installed packages"
  • "Check which packages are installed, and provide suggestions for other packages to install"
  • "Are there any problems with my homebrew setup? And how can I fix them?"
  • "Show me information about the python 3.13 package"
  • "Install the wget package"

Monitoring Logs

To watch the server logs in real-time with pretty-printed JSON:

tail -f homebrew_mcp.log | jq .

Testing the Integration

For testing purposes, you can run the server directly:

uv run python homebrew_mcp.py

The server will silently listen for MCP requests. You can confirm it's running by checking the homebrew_mcp.log file.

To test with Claude API directly (requires an Anthropic API key), use the included test script:

uv run python test_claude_homebrew_mcp.py

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "homebrew-mcp" '{"command":"uv","args":["run","--directory","/path/to/your/project/","homebrew_mcp.py"],"type":"stdio"}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "homebrew-mcp": {
            "command": "uv",
            "args": [
                "run",
                "--directory",
                "/path/to/your/project/",
                "homebrew_mcp.py"
            ],
            "type": "stdio"
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "homebrew-mcp": {
            "command": "uv",
            "args": [
                "run",
                "--directory",
                "/path/to/your/project/",
                "homebrew_mcp.py"
            ],
            "type": "stdio"
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later