Aider MCP Server offloads AI coding tasks to Aider's specialized implementation, reducing costs and enhancing developmen...
Created byApr 22, 2025
Aider MCP Server - Experimental
Model context protocol server for offloading AI coding work to Aider, enhancing development efficiency and flexibility.
Overview
This server allows Claude Code to offload AI coding tasks to Aider, the best open source AI coding assistant. By delegating certain coding tasks to Aider, we can reduce costs, gain control over our coding model and operate Claude Code in a more orchestrative way to review and revise code.
Setup
Clone the repository:
Install dependencies:
Create your environment file:
Configure your API keys in the .env file (or use the mcpServers "env" section) to have the api key needed for the model you want to use in aider:
Copy and fill out the the .mcp.json into the root of your project and update the --directory to point to this project's root directory and the --current-working-dir to point to the root of your project.
Testing
Tests run with gemini-2.5-pro-exp-03-25
To run all tests:
To run specific tests:
Note: The AI coding tests require a valid API key for the Gemini model. Make sure to set it in your .env file before running the tests.
Add this MCP server to Claude Code
Add with `gemini-2.5-pro-exp-03-25`
Add with `gemini-2.5-pro-preview-03-25`
Add with `quasar-alpha`
Add with `llama4-maverick-instruct-basic`
Usage
This MCP server provides the following functionalities:
Offload AI coding tasks to Aider:
List available models:
Available Tools
This MCP server exposes the following tools:
1. `aider_ai_code`
This tool allows you to run Aider to perform AI coding tasks based on a provided prompt and specified files.
Parameters:
ai_coding_prompt (string, required): The natural language instruction for the AI coding task.
relative_editable_files (list of strings, required): A list of file paths (relative to the current_working_dir) that Aider is allowed to modify. If a file doesn't exist, it will be created.
relative_readonly_files (list of strings, optional): A list of file paths (relative to the current_working_dir) that Aider can read for context but cannot modify. Defaults to an empty list [].
model (string, optional): The primary AI model Aider should use for generating code. Defaults to "gemini/gemini-2.5-pro-exp-03-25". You can use the list_models tool to find other available models.
editor_model (string, optional): The AI model Aider should use for editing/refining code, particularly when using architect mode. If not provided, the primary model might be used depending on Aider's internal logic. Defaults to None.
Example Usage (within an MCP request):
Claude Code Prompt:
Result:
Returns:
A simple dict: {success, diff}
2. `list_models`
This tool lists available AI models supported by Aider that match a given substring.
Parameters:
substring (string, required): The substring to search for within the names of available models.
Example Usage (within an MCP request):
Claude Code Prompt:
Result:
Returns:
A list of model name strings that match the provided substring. Example: ["gemini/gemini-1.5-flash", "gemini/gemini-1.5-pro", "gemini/gemini-pro"]
Architecture
The server is structured as follows:
Server layer: Handles MCP protocol communication
Atoms layer: Individual, pure functional components
All components are thoroughly tested for reliability.
Codebase Structure
The project is organized into the following main directories and files:
`src/aider_mcp_server`: Contains the main application code.
Aider MCP Server - Experimental
Model context protocol server for offloading AI coding work to Aider, enhancing development efficiency and flexibility.
Overview
This server allows Claude Code to offload AI coding tasks to Aider, the best open source AI coding assistant. By delegating certain coding tasks to Aider, we can reduce costs, gain control over our coding model and operate Claude Code in a more orchestrative way to review and revise code.
Setup
Clone the repository:
Install dependencies:
Create your environment file:
Configure your API keys in the .env file (or use the mcpServers "env" section) to have the api key needed for the model you want to use in aider:
Copy and fill out the the .mcp.json into the root of your project and update the --directory to point to this project's root directory and the --current-working-dir to point to the root of your project.
Testing
Tests run with gemini-2.5-pro-exp-03-25
To run all tests:
To run specific tests:
Note: The AI coding tests require a valid API key for the Gemini model. Make sure to set it in your .env file before running the tests.
Add this MCP server to Claude Code
Add with `gemini-2.5-pro-exp-03-25`
Add with `gemini-2.5-pro-preview-03-25`
Add with `quasar-alpha`
Add with `llama4-maverick-instruct-basic`
Usage
This MCP server provides the following functionalities:
Offload AI coding tasks to Aider:
List available models:
Available Tools
This MCP server exposes the following tools:
1. `aider_ai_code`
This tool allows you to run Aider to perform AI coding tasks based on a provided prompt and specified files.
Parameters:
ai_coding_prompt (string, required): The natural language instruction for the AI coding task.
relative_editable_files (list of strings, required): A list of file paths (relative to the current_working_dir) that Aider is allowed to modify. If a file doesn't exist, it will be created.
relative_readonly_files (list of strings, optional): A list of file paths (relative to the current_working_dir) that Aider can read for context but cannot modify. Defaults to an empty list [].
model (string, optional): The primary AI model Aider should use for generating code. Defaults to "gemini/gemini-2.5-pro-exp-03-25". You can use the list_models tool to find other available models.
editor_model (string, optional): The AI model Aider should use for editing/refining code, particularly when using architect mode. If not provided, the primary model might be used depending on Aider's internal logic. Defaults to None.
Example Usage (within an MCP request):
Claude Code Prompt:
Result:
Returns:
A simple dict: {success, diff}
2. `list_models`
This tool lists available AI models supported by Aider that match a given substring.
Parameters:
substring (string, required): The substring to search for within the names of available models.
Example Usage (within an MCP request):
Claude Code Prompt:
Result:
Returns:
A list of model name strings that match the provided substring. Example: ["gemini/gemini-1.5-flash", "gemini/gemini-1.5-pro", "gemini/gemini-pro"]
Architecture
The server is structured as follows:
Server layer: Handles MCP protocol communication
Atoms layer: Individual, pure functional components
All components are thoroughly tested for reliability.
Codebase Structure
The project is organized into the following main directories and files:
`src/aider_mcp_server`: Contains the main application code.