aider-mcp-server
by: sengokudaikon
aider mcp server
📌Overview
Purpose: To provide a bridge for AI assistants like Claude to utilize Aider's file editing capabilities through the Model Context Protocol (MCP).
Overview: The Aider MCP Server facilitates seamless integration between AI clients and the Aider file editing system. By standardizing interactions via the MCP, users can harness functionalities such as creating and editing files, extracting code, and checking Git status, among others.
Key Features:
-
File Editing and Creation: Users can edit existing files and create new ones, leveraging Aider's advanced text manipulation capabilities.
-
Code Extraction: The server allows users to extract code blocks from markdown, preserving formatting and language markers.
-
Git Integration: Quick access to git status provides users with up-to-date information on their repository's state, including modified and untracked files.
-
Configuration Support: The MCP server supports Aider's configuration system, enabling customized settings through config files and environment variables.
-
Comprehensive Toolset: A suite of directory-based tools, including editing, file creation, and status checks, enhances the user experience and workflow efficiency.
Aider MCP Server
A Model Context Protocol (MCP) server that allows Claude and other MCP clients to connect to Aider for efficient file editing capabilities.
Overview
This MCP server bridges the gap between AI assistants like Claude and Aider's file editing capabilities. It provides a standardized interface through the Model Context Protocol, allowing Claude to:
- Edit existing files using Aider's capabilities
- Create new files with content
- Extract code blocks from markdown text
- Get git status information
- Check Aider installation status
- Access and use Aider's configuration system
Prerequisites
- Python 3.8 or higher
- Aider installed (
pip install aider-chat
) - An API key for OpenAI or Anthropic (depending on which model you want Aider to use)
- Git repository for file editing
Installation
You can install the Aider MCP server in several ways:
Using UV (Recommended)
If you have uv installed:
# Install uv if you don't have it
curl -fsSL https://astral.sh/uv/install.sh | bash
# Run directly with uvx (no installation required)
uvx aider-mcp
Using PIP
# Install the package
pip install aider-mcp
# Run the server
aider-mcp
Usage
The Aider MCP server runs in MCP protocol mode over stdio by default, designed for direct integration with MCP clients like Claude Desktop and Cursor IDE.
# Run directly with uvx (recommended)
uvx aider-mcp
# With repository path specified
uvx aider-mcp --repo-path=/path/to/your/repo
# With custom Aider executable path
uvx aider-mcp --aider-path=/path/to/aider
# With environment variables
REPO_PATH=/path/to/your/repo uvx aider-mcp
Command Line Options
Customize the server with environment variables or command-line arguments:
--aider-path
: Path to the Aider executable (default: "aider", searches PATH)--repo-path
: Path to the git repository (default: current directory)--config-file
: Path to a custom Aider config file--env-file
: Path to a custom .env file--verbose
,-v
: Enable verbose output
Client Configuration
Claude Desktop
Add this to your Claude Desktop configuration file:
{
"mcpServers": {
"aider-mcp": {
"command": "uvx",
"args": [
"aider-mcp",
"--repo-path", "/path/to/your/repo"
]
}
}
}
Cursor IDE
To integrate with Cursor IDE:
-
Open Cursor Settings
-
Navigate to Features > MCP Servers
-
Click Add new MCP server
-
Enter this configuration:
name: aider-mcp type: command command: uvx aider-mcp --repo-path=/path/to/your/repo
-
Ensure you're in Agent mode in the Composer to use MCP tools
Aider Configuration Support
Supports Aider's configuration system, allowing you to:
-
Use configuration from
.aider.conf.yml
files in:- Home directory
- Git repository root
- Current directory
- Custom path via
--config-file
-
Use environment variables from
.env
files in:- Home directory
- Git repository root
- Current directory
- Custom path via
--env-file
-
Pass custom Aider options when editing files through MCP tools.
Example Prompts for Claude
Once connected, you can use prompts like:
- Edit my
app.py
file to add error handling to the main function - Create a new file called
utils.py
with helper functions for date formatting - Show me the current git status of the repository
- Extract the Python code from this explanation and save it to a file
Available Tools
The MCP server provides these directory-based tools:
-
edit_files
: Make targeted code changes in a specified directory
Requires a directory path and detailed instructions.
Accepts all proposed changes automatically (--yes-always
).
Additional Aider options can be specified. -
create_files
: Create new files with content in a directory
Supports multiple files creation and optional git commit. -
git_status
: Get git status of a directory's repository
Quickly checks for modified, added, deleted, and untracked files. -
extract_code
: Extract code blocks from markdown or text
Optionally save extracted code blocks to files, preserving language info. -
aider_status
: Check Aider installation and environment status
Verifies installation, configuration, API keys, and environment variables. -
aider_config
: Get detailed Aider configuration information
Shows used config files, settings from all config layers, and environment variables.
Environment Variables
The server uses these environment variables (can also be set through .env
files):
AIDER_PATH
: Path to the Aider executableREPO_PATH
: Path to the git repositoryAIDER_CONFIG_FILE
: Path to custom Aider config fileAIDER_ENV_FILE
: Path to custom .env fileAIDER_MCP_VERBOSE
: Enable verbose loggingOPENAI_API_KEY
: OpenAI API key (for GPT-4 with Aider)ANTHROPIC_API_KEY
: Anthropic API key (for Claude with Aider)
Debugging
Use the MCP inspector to debug the server:
# Test with MCP inspector
npx @modelcontextprotocol/inspector uvx aider-mcp
# Test with specific repository path
npx @modelcontextprotocol/inspector uvx aider-mcp --repo-path=/path/to/your/repo
# If running from Python package
npx @modelcontextprotocol/inspector python -m aider_mcp
The inspector provides an interactive UI to:
- View available tools and their schemas
- Call tools with test parameters
- See responses and debug issues
Development
For local development:
git clone https://github.com/yourusername/aider-mcp-server.git
cd aider-mcp-server
pip install -e .
License
Unlicense