Aider MCP server

Aider MCP Server offloads AI coding tasks to Aider's specialized implementation, reducing costs and enhancing development efficiency through natural language code changes and model selection.
Back to servers
Provider
Daniel Isler
Release date
Apr 07, 2025
Language
Python
Stats
185 stars

The Aider MCP Server allows Claude Code to delegate AI coding tasks to Aider, an open source AI coding assistant. This integration enables cost reduction and enhanced control over your coding workflow while leveraging Claude Code's capabilities.

Installation

Prerequisites

Before installing the Aider MCP Server, ensure you have:

  • Git installed on your system
  • Python with uv package manager

Setup Steps

  1. Clone the repository:
git clone https://github.com/disler/aider-mcp-server.git
  1. Install dependencies:
uv sync
  1. Create your environment file:
cp .env.sample .env
  1. Configure your API keys in the .env file with the necessary credentials for your preferred AI models:
GEMINI_API_KEY=your_gemini_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
  1. Create a .mcp.json file in the root of your project with the following configuration:
{
  "mcpServers": {
    "aider-mcp-server": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "--directory",
        "<path to this project>",
        "run",
        "aider-mcp-server",
        "--editor-model",
        "gpt-4o",
        "--current-working-dir",
        "<path to your project>"
      ],
      "env": {
        "GEMINI_API_KEY": "<your gemini api key>",
        "OPENAI_API_KEY": "<your openai api key>",
        "ANTHROPIC_API_KEY": "<your anthropic api key>"
      }
    }
  }
}

Integration with Claude Code

Add the MCP server to Claude Code by selecting an AI model that matches your needs:

For Gemini 2.5 Pro Experimental

claude mcp add aider-mcp-server -s local \
  -- \
  uv --directory "<path to the aider mcp server project>" \
  run aider-mcp-server \
  --editor-model "gemini/gemini-2.5-pro-exp-03-25" \
  --current-working-dir "<path to your project>"

For Gemini 2.5 Pro Preview

claude mcp add aider-mcp-server -s local \
  -- \
  uv --directory "<path to the aider mcp server project>" \
  run aider-mcp-server \
  --editor-model "gemini/gemini-2.5-pro-preview-03-25" \
  --current-working-dir "<path to your project>"

For Quasar Alpha

claude mcp add aider-mcp-server -s local \
  -- \
  uv --directory "<path to the aider mcp server project>" \
  run aider-mcp-server \
  --editor-model "openrouter/openrouter/quasar-alpha" \
  --current-working-dir "<path to your project>"

For Llama 4 Maverick

claude mcp add aider-mcp-server -s local \
  -- \
  uv --directory "<path to the aider mcp server project>" \
  run aider-mcp-server \
  --editor-model "fireworks_ai/accounts/fireworks/models/llama4-maverick-instruct-basic" \
  --current-working-dir "<path to your project>"

Using the MCP Server

The Aider MCP Server provides two main tools that you can use through Claude Code:

AI Code Generation Tool

The aider_ai_code tool allows you to implement code changes based on natural language prompts.

Parameters:

  • ai_coding_prompt (string, required): The instruction for the AI coding task
  • relative_editable_files (list of strings, required): Files that Aider can modify
  • relative_readonly_files (list of strings, optional): Files that provide context but won't be modified
  • model (string, optional): Primary AI model to use
  • editor_model (string, optional): Model for refining code

Example Usage:

When using Claude Code, you can prompt:

Use the Aider AI Code tool to: Refactor the calculate_sum function in calculator.py to handle potential TypeError exceptions.

This will generate a request like:

{
  "name": "aider_ai_code",
  "parameters": {
    "ai_coding_prompt": "Refactor the calculate_sum function in calculator.py to handle potential TypeError exceptions.",
    "relative_editable_files": ["src/calculator.py"],
    "relative_readonly_files": ["docs/requirements.txt"],
    "model": "openai/gpt-4o"
  }
}

The tool returns a dictionary with success status and a diff of the changes.

Model Listing Tool

The list_models tool helps you discover available AI models compatible with Aider.

Parameters:

  • substring (string, required): Search term for filtering available models

Example Usage:

Prompt Claude Code with:

Use the Aider List Models tool to: List models that contain the substring "gemini".

This generates:

{
  "name": "list_models",
  "parameters": {
    "substring": "gemini"
  }
}

The tool returns a list of model names matching your search, such as:

["gemini/gemini-1.5-flash", "gemini/gemini-1.5-pro", "gemini/gemini-pro"]

Testing the Server

To verify the server is working correctly, you can run the included tests:

uv run pytest

For specific test cases:

# Test model listing
uv run pytest src/aider_mcp_server/tests/atoms/tools/test_aider_list_models.py

# Test AI coding capabilities
uv run pytest src/aider_mcp_server/tests/atoms/tools/test_aider_ai_code.py

Note that AI coding tests require valid API keys configured in your .env file.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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