Skip to content
Back to search

aider-mcp-server

Minimal MCP Server for Aider

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/disler--aider-mcp-server/badge.svg)](/listings/disler--aider-mcp-server)

HTML

<a href="/listings/disler--aider-mcp-server"><img src="/api/listings/disler--aider-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

0. Clone the repository:

git clone https://github.com/disler/aider-mcp-server.git

1. Install dependencies:

uv sync

2. Create your environment file:

cp .env.sample .env

3. 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

4. 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
      }
    }
  }
}

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 277 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Aider MCP Server - Experimental
  2. > Model context protocol server for offloading AI coding work to Aider, enhancing development efficiency and flexibility.
  3. ## Overview
  4. 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.
  5. ## Setup
  6. 0. Clone the repository:
  7. ```bash
  8. git clone https://github.com/disler/aider-mcp-server.git
  9. ```
  10. 1. Install dependencies:
  11. ```bash
  12. uv sync
  13. ```
  14. 2. Create your environment file:
  15. ```bash
  16. cp .env.sample .env
  17. ```
  18. 3. 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:
  19. ```
  20. GEMINI_API_KEY=your_gemini_api_key_here
  21. OPENAI_API_KEY=your_openai_api_key_here
  22. ANTHROPIC_API_KEY=your_anthropic_api_key_here
  23. ...see .env.sample for more
  24. ```
  25. 4. 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.
  26. ```json
  27. {
  28. "mcpServers": {
  29. "aider-mcp-server": {
  30. "type": "stdio",
  31. "command": "uv",
  32. "args": [
  33. "--directory",
  34. "<path to this project>",
  35. "run",
  36. "aider-mcp-server",
  37. "--editor-model",
  38. "gpt-4o",
  39. "--current-working-dir",
  40. "<path to your project>"
  41. ],
  42. "env": {
  43. "GEMINI_API_KEY": "<your gemini api key>",
  44. "OPENAI_API_KEY": "<your openai api key>",
  45. "ANTHROPIC_API_KEY": "<your anthropic api key>",
  46. ...see .env.sample for more
  47. }
  48. }
  49. }
  50. }
  51. ```
  52. ## Testing
  53. > Tests run with gemini-2.5-pro-exp-03-25
  54. To run all tests:
  55. ```bash
  56. uv run pytest
  57. ```
  58. To run specific tests:
  59. ```bash
  60. # Test listing models
  61. uv run pytest src/aider_mcp_server/tests/atoms/tools/test_aider_list_models.py
  62. # Test AI coding
  63. uv run pytest src/aider_mcp_server/tests/atoms/tools/test_aider_ai_code.py
  64. ```
  65. 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.
  66. ## Add this MCP server to Claude Code
  67. ### Add with `gemini-2.5-pro-exp-03-25`
  68. ```bash
  69. claude mcp add aider-mcp-server -s local \
  70. -- \
  71. uv --directory "<path to the aider mcp server project>" \
  72. run aider-mcp-server \
  73. --editor-model "gemini/gemini-2.5-pro-exp-03-25" \
  74. --current-working-dir "<path to your project>"
  75. ```
  76. ### Add with `gemini-2.5-pro-preview-03-25`
  77. ```bash
  78. claude mcp add aider-mcp-server -s local \
  79. -- \
  80. uv --directory "<path to the aider mcp server project>" \
  81. run aider-mcp-server \
  82. --editor-model "gemini/gemini-2.5-pro-preview-03-25" \
  83. --current-working-dir "<path to your project>"
  84. ```
  85. ### Add with `quasar-alpha`
  86. ```bash
  87. claude mcp add aider-mcp-server -s local \
  88. -- \
  89. uv --directory "<path to the aider mcp server project>" \
  90. run aider-mcp-server \
  91. --editor-model "openrouter/openrouter/quasar-alpha" \
  92. --current-working-dir "<path to your project>"
  93. ```
  94. ### Add with `llama4-maverick-instruct-basic`
  95. ```bash
  96. claude mcp add aider-mcp-server -s local \
  97. -- \
  98. uv --directory "<path to the aider mcp server project>" \
  99. run aider-mcp-server \
  100. --editor-model "fireworks_ai/accounts/fireworks/models/llama4-maverick-instruct-basic" \
  101. --current-working-dir "<path to your project>"
  102. ```
  103. ## Usage
  104. This MCP server provides the following functionalities:
  105. 1. **Offload AI coding tasks to Aider**:
  106. - Takes a prompt and file paths
  107. - Uses Aider to implement the requested changes
  108. - Returns success or failure
  109. 2. **List available models**:
  110. - Provides a list of models matching a substring
  111. - Useful for discovering supported models
  112. ## Available Tools
  113. This MCP server exposes the following tools:
  114. ### 1. `aider_ai_code`
  115. This tool allows you to run Aider to perform AI coding tasks based on a provided prompt and specified files.
  116. **Parameters:**
  117. - `ai_coding_prompt` (string, required): The natural language instruction for the AI coding task.
  118. - `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.
  119. - `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 `[]`.
  120. - `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.
  121. - `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`.
  122. **Example Usage (within an MCP request):**
  123. Claude Code Prompt:
  124. ```
  125. Use the Aider AI Code tool to: Refactor the calculate_sum function in calculator.py to handle potential TypeError exceptions.
  126. ```
  127. Result:
  128. ```json
  129. {
  130. "name": "aider_ai_code",
  131. "parameters": {
  132. "ai_coding_prompt": "Refactor the calculate_sum function in calculator.py to handle potential TypeError exceptions.",
  133. "relative_editable_files": ["src/calculator.py"],
  134. "relative_readonly_files": ["docs/requirements.txt"],
  135. "model": "openai/gpt-4o"
  136. }
  137. }
  138. ```
  139. **Returns:**
  140. - A simple dict: {success, diff}
  141. - `success`: boolean - Whether the operation was successful.
  142. - `diff`: string - The diff of the changes made to the file.
  143. ### 2. `list_models`
  144. This tool lists available AI models supported by Aider that match a given substring.
  145. **Parameters:**
  146. - `substring` (string, required): The substring to search for within the names of available models.
  147. **Example Usage (within an MCP request):**
  148. Claude Code Prompt:
  149. ```
  150. Use the Aider List Models tool to: List models that contain the substring "gemini".
  151. ```
  152. Result:
  153. ```json
  154. {
  155. "name": "list_models",
  156. "parameters": {
  157. "substring": "gemini"
  158. }
  159. }
  160. ```
  161. **Returns:**
  162. - 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"]`
  163. ## Architecture
  164. The server is structured as follows:
  165. - **Server layer**: Handles MCP protocol communication
  166. - **Atoms layer**: Individual, pure functional components
  167. - **Tools**: Specific capabilities (AI coding, listing models)
  168. - **Utils**: Constants and helper functions
  169. - **Data Types**: Type definitions using Pydantic
  170. All components are thoroughly tested for reliability.
  171. ## Codebase Structure
  172. The project is organized into the following main directories and files:
  173. ```
  174. .
  175. ├── ai_docs # Documentation related to AI models and examples
  176. │ ├── just-prompt-example-mcp-server.xml
  177. │ └── programmable-aider-documentation.md
  178. ├── pyproject.toml # Project metadata and dependencies
  179. ├── README.md # This file
  180. ├── specs # Specification documents
  181. │ └── init-aider-mcp-exp.md
  182. ├── src # Source code directory
  183. │ └── aider_mcp_server # Main package for the server
  184. │ ├── __init__.py # Package initializer
  185. │ ├── __main__.py # Main entry point for the server executable
  186. │ ├── atoms # Core, reusable components (pure functions)
  187. │ │ ├── __init__.py
  188. │ │ ├── data_types.py # Pydantic models for data structures
  189. │ │ ├── logging.py # Custom logging setup
  190. │ │ ├── tools # Individual tool implementations
  191. │ │ │ ├── __init__.py
  192. │ │ │ ├── aider_ai_code.py # Logic for the aider_ai_code tool
  193. │ │ │ └── aider_list_models.py # Logic for the list_models tool
  194. │ │ └── utils.py # Utility functions and constants (like default models)
  195. │ ├── server.py # MCP server logic, tool registration, request handling
  196. │ └── tests # Unit and integration tests
  197. │ ├── __init__.py
  198. │ └── atoms # Tests for the atoms layer
  199. │ ├── __init__.py
  200. │ ├── test_logging.py # Tests for logging
  201. │ └── tools # Tests for the tools
  202. │ ├── __init__.py
  203. │ ├── test_aider_ai_code.py # Tests for AI coding tool
  204. │ └── test_aider_list_models.py # Tests for model listing tool
  205. ```
  206. - **`src/aider_mcp_server`**: Contains the main application code.
  207. - **`atoms`**: Holds the fundamental building blocks. These are designed to be pure functions or simple classes with minimal dependencies.
  208. - **`tools`**: Each file here implements the core logic for a specific MCP tool (`aider_ai_code`, `list_models`).
  209. - **`utils.py`**: Contains shared constants like default model names.
  210. - **`data_types.py`**: Defines Pydantic models for request/response structures, ensuring data validation.
  211. - **`logging.py`**: Sets up a consistent logging format for console and file output.
  212. - **`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.
  213. - **`__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`.
  214. - **`tests`**: Contains tests mirroring the structure of the `src` directory, ensuring that each component (especially atoms) works as expected.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.