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.
uv
dependency managerClone the repository:
git clone https://github.com/jeannier/homebrew-mcp
cd homebrew-mcp
Install uv
if not already installed:
brew install uv
Create a virtual environment and install dependencies:
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
Install Claude Desktop (if not already installed):
brew install --cask claude
Configure Claude Desktop to use the MCP server:
~/Library/Application Support/Claude/claude_desktop.json
/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"
}
}
}
Restart Claude Desktop
Install Cursor (if not already installed):
brew install --cask cursor
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.
Restart Cursor for the changes to take effect.
The MCP server supports the following Homebrew commands:
Package Management:
install
- Install a packageuninstall
- Remove a packageupgrade
- Upgrade packagescleanup
- Remove old versionsInformation & Discovery:
list
- Show installed packagessearch
- Find packagesinfo
- Display package informationoutdated
- Show outdated packagesdeps
- Display dependenciesSystem Health & Updates:
doctor
- Check for problemsupdate
- Update HomebrewTap & Source Management:
tap
- Add a tap repositoryuntap
- Remove a tapVersion Management:
pin
- Pin package versionunpin
- Unpin package versionService Management:
services
- Manage servicesYou can use the following example prompts with Claude Desktop or another MCP client:
To watch the server logs in real-time with pretty-printed JSON:
tail -f homebrew_mcp.log | jq .
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
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.
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.
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"
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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