Makefile make MCP server

Integrates with make to enable execution of Makefile targets, automating build processes and development tasks for software projects.
Back to servers
Setup instructions
Provider
Joshua M. Dotson
Release date
Dec 17, 2024
Language
Python
Package
Stats
5.0K downloads
4 stars

The MCP Server Make provides a Model Context Protocol server that allows Large Language Models to safely execute make targets from any Makefile. This enables LLMs like Claude to run build commands, manage development tasks, and interact with your project's build system in a controlled manner.

Installation

Using uv (recommended)

uv pip install mcp-server-make

Using pip

pip install mcp-server-make

Basic Usage

Running the Server

To run the server with the default Makefile in your current directory:

uvx mcp-server-make

To specify a custom Makefile and working directory:

uvx mcp-server-make --make-path /path/to/Makefile --working-dir /path/to/working/dir

Configuring with Claude Desktop

To use with Claude Desktop, add the server to your Claude configuration file (claude_desktop_config.json):

{
  "mcpServers": {
    "make": {
      "command": "uvx",
      "args": [
        "mcp-server-make",
        "--make-path", "/absolute/path/to/Makefile",
        "--working-dir", "/absolute/path/to/working/dir"
      ]
    }
  }
}

Working with Make Targets

Since the server doesn't automatically discover available targets in your Makefile, here are some best practices for effective use:

Discovering Available Targets

Start by running the help target to see available commands:

Human: Please run make help to see what commands are available.

Common Make Targets

Most well-designed Makefiles include these standard targets:

  • make test - Run tests
  • make lint - Check code quality
  • make format - Format code
  • make build - Build the project
  • make clean - Clean build artifacts

Guiding the Model

For best results, explicitly tell the model about available targets:

Human: Our project has these make targets: test, lint, format, build, and clean.

Usage Examples

Running Tests and Code Formatting

Here's an example interaction showing how Claude can help with development tasks:

Human: Can you run our test suite and format any code that needs it?

Claude: I'll help run the tests and format the code:

1. First, let's format the code:
[Calling make tool with args {"target": "format"}]
2 files reformatted, 3 files left unchanged

2. Now let's run the tests:
[Calling make tool with args {"target": "test"}]
Running tests...
4 passed, 0 failed

All formatting and tests completed successfully. The code is now properly formatted and all tests are passing.

Available Tool

The server exposes a single tool:

  • make: Run a make target from the Makefile
    • Parameters:
      • target (string, required): Target name to execute

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 "make" '{"command":"uvx","args":["mcp-server-make","--make-path","/absolute/path/to/Makefile","--working-dir","/absolute/path/to/working/dir"]}'

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": {
        "make": {
            "command": "uvx",
            "args": [
                "mcp-server-make",
                "--make-path",
                "/absolute/path/to/Makefile",
                "--working-dir",
                "/absolute/path/to/working/dir"
            ]
        }
    }
}

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": {
        "make": {
            "command": "uvx",
            "args": [
                "mcp-server-make",
                "--make-path",
                "/absolute/path/to/Makefile",
                "--working-dir",
                "/absolute/path/to/working/dir"
            ]
        }
    }
}

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