disler aider mcp server

disler aider mcp server avatar

by disler

Minimal MCP Server for Aider

What is disler aider mcp server

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

  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 (or use the mcpServers "env" section) to have the api key needed for the model you want to use in aider:
GEMINI_API_KEY=your_gemini_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
...see .env.sample for more
  1. 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.
{
  "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>",
        ...see .env.sample for more
      }
    }
  }
}

Testing

Tests run with gemini-2.5-pro-exp-03-25

To run all tests:

uv run pytest

To run specific tests:

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

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

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

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>"

Add with gemini-2.5-pro-preview-03-25

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>"

Add with 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>"

Add with llama4-maverick-instruct-basic

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>"

Usage

This MCP server provides the following functionalities:

  1. Offload AI coding tasks to Aider:

    • Takes a prompt and file paths
    • Uses Aider to implement the requested changes
    • Returns success or failure
  2. List available models:

    • Provides a list of models matching a substring
    • Useful for discovering supported 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:

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

Result:

{
  "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"
  }
}

Returns:

  • A simple dict: {success, diff}
    • success: boolean - Whether the operation was successful.
    • diff: string - The diff of the changes made to the file.

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:

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

Result:

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

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
    • Tools: Specific capabilities (AI coding, listing models)
    • Utils: Constants and helper functions
    • Data Types: Type definitions using Pydantic

All components are thoroughly tested for reliability.

Codebase Structure

The project is organized into the following main directories and files:

.
โ”œโ”€โ”€ ai_docs                   # Documentation related to AI models and examples
โ”‚   โ”œโ”€โ”€ just-prompt-example-mcp-server.xml
โ”‚   โ””โ”€โ”€ programmable-aider-documentation.md
โ”œโ”€โ”€ pyproject.toml            # Project metadata and dependencies
โ”œโ”€โ”€ README.md                 # This file
โ”œโ”€โ”€ specs                     # Specification documents
โ”‚   โ””โ”€โ”€ init-aider-mcp-exp.md
โ”œโ”€โ”€ src                       # Source code directory
โ”‚   โ””โ”€โ”€ aider_mcp_server      # Main package for the server
โ”‚       โ”œโ”€โ”€ __init__.py       # Package initializer
โ”‚       โ”œโ”€โ”€ __main__.py       # Main entry point for the server executable
โ”‚       โ”œโ”€โ”€ atoms             # Core, reusable components (pure functions)
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ data_types.py # Pydantic models for data structures
โ”‚       โ”‚   โ”œโ”€โ”€ logging.py    # Custom logging setup
โ”‚       โ”‚   โ”œโ”€โ”€ tools         # Individual tool implementations
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ aider_ai_code.py # Logic for the aider_ai_code tool
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ aider_list_models.py # Logic for the list_models tool
โ”‚       โ”‚   โ””โ”€โ”€ utils.py      # Utility functions and constants (like default models)
โ”‚       โ”œโ”€โ”€ server.py         # MCP server logic, tool registration, request handling
โ”‚       โ””โ”€โ”€ tests             # Unit and integration tests
โ”‚           โ”œโ”€โ”€ __init__.py
โ”‚           โ””โ”€โ”€ atoms         # Tests for the atoms layer
โ”‚               โ”œโ”€โ”€ __init__.py
โ”‚               โ”œโ”€โ”€ test_logging.py # Tests for logging
โ”‚               โ””โ”€โ”€ tools     # Tests for the tools
โ”‚                   โ”œโ”€โ”€ __init__.py
โ”‚                   โ”œโ”€โ”€ test_aider_ai_code.py # Tests for AI coding tool
โ”‚                   โ””โ”€โ”€ test_aider_list_models.py # Tests for model listing tool
  • src/aider_mcp_server: Contains the main application code.
    • atoms: Holds the fundamental building blocks. These are designed to be pure functions or simple classes with minimal dependencies.
      • tools: Each file here implements the core logic for a specific MCP tool (aider_ai_code, list_models).
      • utils.py: Contains shared constants like default model names.
      • data_types.py: Defines Pydantic models for request/response structures, ensuring data validation.
      • logging.py: Sets up a consistent logging format for console and file output.
    • server.py: Orchestrates the MCP server. It initializes the server, registers the tools defined in the atoms/tools directory, handles incoming requests, routes them to the appropriate tool logic, and sends back responses according to the MCP protocol.
    • __main__.py: Provides the command-line interface entry point (aider-mcp-server), parsing arguments like --editor-model and starting the server defined in server.py.
    • tests: Contains tests mirroring the structure of the src directory, ensuring that each component (especially atoms) works as expected.

Leave a Comment

Frequently Asked Questions

What is MCP?

MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.

What are MCP Servers?

MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.

How do MCP Servers work?

MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.

Are MCP Servers secure?

Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.

Related MCP Servers

chrisdoc hevy mcp avatar

chrisdoc hevy mcp

mcp
sylphlab pdf reader mcp avatar

sylphlab pdf reader mcp

An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.

pdf-parsetypescriptnodejs
aashari mcp server atlassian bitbucket avatar

aashari mcp server atlassian bitbucket

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.

atlassianrepositorymcp
aashari mcp server atlassian confluence avatar

aashari mcp server atlassian confluence

Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.

atlassianmcpconfluence
prisma prisma avatar

prisma prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

cockroachdbgomcp
Zzzccs123 mcp sentry avatar

Zzzccs123 mcp sentry

mcp sentry for typescript sdk

mcptypescript
zhuzhoulin dify mcp server avatar

zhuzhoulin dify mcp server

mcp
zhongmingyuan mcp my mac avatar

zhongmingyuan mcp my mac

mcp
zhixiaoqiang desktop image manager mcp avatar

zhixiaoqiang desktop image manager mcp

MCP ๆœๅŠกๅ™จ๏ผŒ็”จไบŽ็ฎก็†ๆกŒ้ขๅ›พ็‰‡ใ€ๆŸฅ็œ‹่ฏฆๆƒ…ใ€ๅŽ‹็ผฉใ€็งปๅŠจ็ญ‰๏ผˆๅฎŒๅ…จ่ฎฉTraeๅฎž็Žฐ๏ผ‰

mcp
zhixiaoqiang antd components mcp avatar

zhixiaoqiang antd components mcp

An MCP service for Ant Design components query | ไธ€ไธชๅ‡ๅฐ‘ Ant Design ็ป„ไปถไปฃ็ ็”Ÿๆˆๅนป่ง‰็š„ MCP ๆœๅŠก๏ผŒๅŒ…ๅซ็ณป็ปŸๆ็คบ่ฏใ€็ป„ไปถๆ–‡ๆกฃใ€API ๆ–‡ๆกฃใ€ไปฃ็ ็คบไพ‹ๅ’Œๆ›ดๆ–ฐๆ—ฅๅฟ—ๆŸฅ่ฏข

designantdapi

Submit Your MCP Server

Share your MCP server with the community

Submit Now