Aider MCP Server

Aider MCP サーバー - 実験的

AI コーディング作業を Aider にオフロードし、開発の効率と柔軟性を向上させるモデル コンテキスト プロトコル サーバー。

概要

このサーバーにより、Claude CodeはAIコーディングタスクを最高のオープンソースAIコーディングアシスタントであるAiderにオフロードできます。特定のコーディングタスクをAiderに委託することで、コストを削減し、コーディングモデルをコントロールし、Claude Codeをより効率的に運用してコードのレビューと修正を行うことができます。

設定

  1. リポジトリをクローンします。
git clone https://github.com/disler/aider-mcp-server.git
  1. 依存関係をインストールします:
uv sync
  1. 環境ファイルを作成します。
cp .env.sample .env
  1. .envファイルで API キーを構成して (または mcpServers の "env" セクションを使用して)、aider で使用するモデルに必要な API キーを取得します。
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. .mcp.jsonプロジェクトのルートにコピーして入力し、 --directoryがこのプロジェクトのルート ディレクトリを指すように更新し、 --current-working-dirプロジェクトのルートを指すように更新します。
{ "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 } } } }

テスト

gemini-2.5-pro-exp-03-25で実行されたテスト

すべてのテストを実行するには:

uv run pytest

特定のテストを実行するには:

# 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

注: AIコーディングテストには、Geminiモデルの有効なAPIキーが必要です。テストを実行する前に、 .envファイルに必ず設定してください。

このMCPサーバーをClaude Codeに追加する

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

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

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

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

使用法

この MCP サーバーは次の機能を提供します。

  1. AIコーディングタスクをAiderにオフロードします
    • プロンプトとファイルパスを取得します
    • 要求された変更を実装するためにAiderを使用する
    • 成功または失敗を返します
  2. 利用可能なモデルの一覧:
    • 部分文字列に一致するモデルのリストを提供します
    • サポートされているモデルを見つけるのに役立ちます

利用可能なツール

この MCP サーバーは次のツールを公開します。

1. aider_ai_code

このツールを使用すると、Aider を実行して、提供されたプロンプトと指定されたファイルに基づいて AI コーディング タスクを実行できます。

パラメータ:

  • ai_coding_prompt (文字列、必須): AI コーディング タスクの自然言語の指示。
  • relative_editable_files (文字列のリスト、必須): Aider が変更できるファイルパスのリスト( current_working_dirからの相対パス)。ファイルが存在しない場合は作成されます。
  • relative_readonly_files (文字列のリスト、オプション): Aiderがコンテキストとして読み取ることができるファイルパスのリスト( current_working_dirからの相対パス)。デフォルトは空のリスト[]です。
  • model (文字列, オプション): Aiderがコード生成に使用する主要なAIモデル。デフォルトは"gemini/gemini-2.5-pro-exp-03-25"です。利用可能な他のモデルを見つけるには、 list_modelsツールを使用してください。
  • editor_model (文字列, オプション): Aiderがコードの編集/改良に使用するAIモデル。特にアーキテクトモード使用時に使用します。指定されていない場合は、Aiderの内部ロジックに応じてプライマリmodelが使用される場合があります。デフォルトはNoneです。

使用例 (MCP リクエスト内):

クロードコードプロンプト:

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

結果:

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

戻り値:

  • 単純な辞書: {success, diff}
    • success : boolean - 操作が成功したかどうか。
    • diff : 文字列 - ファイルに加えられた変更の差分。

2. list_models

このツールは、特定の部分文字列に一致する、Aider でサポートされている利用可能な AI モデルを一覧表示します。

パラメータ:

  • substring (文字列、必須): 使用可能なモデルの名前内で検索する部分文字列。

使用例 (MCP リクエスト内):

クロードコードプロンプト:

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

結果:

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

戻り値:

  • 指定された部分文字列に一致するモデル名文字列のリスト。例: ["gemini/gemini-1.5-flash", "gemini/gemini-1.5-pro", "gemini/gemini-pro"]

建築

サーバーは次のように構成されています。

  • サーバー層: MCPプロトコル通信を処理する
  • 原子層: 個々の純粋な機能コンポーネント
    • ツール: 特定の機能 (AI コーディング、モデルのリスト表示)
    • ユーティリティ: 定数とヘルパー関数
    • データ型: Pydantic を使用した型定義

すべてのコンポーネントは信頼性について徹底的にテストされています。

コードベースの構造

プロジェクトは、次の主要なディレクトリとファイルで構成されています。

. ├── 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 : メインアプリケーションコードが含まれています。
    • atoms : 基本的な構成要素を保持します。これらは、依存関係が最小限の純粋関数または単純なクラスとして設計されています。
      • tools : ここでの各ファイルは、特定の MCP ツール ( aider_ai_codelist_models ) のコアロジックを実装します。
      • utils.py : デフォルトのモデル名などの共有定数が含まれています。
      • data_types.py : リクエスト/レスポンス構造の Pydantic モデルを定義し、データ検証を保証します。
      • logging.py : コンソールとファイル出力の一貫したログ形式を設定します。
    • server.py : MCPサーバーのオーケストレーションを行います。サーバーの初期化、 atoms/toolsディレクトリに定義されたツールの登録、受信したリクエストの処理、適切なツールロジックへのルーティング、MCPプロトコルに従ったレスポンスの返信を行います。
    • __main__.py : コマンドライン インターフェイスのエントリ ポイント ( aider-mcp-server ) を提供し、 --editor-modelなどの引数を解析し、 server.pyで定義されたサーバーを起動します。
    • tests : srcディレクトリの構造を反映したテストが含まれており、各コンポーネント (特にアトム) が期待どおりに動作することを確認します。
-
security - not tested
-
license - not tested
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

Claude Code が AI コーディング タスクを Aider にオフロードできるようにすることで、コストが削減され、特定のコーディング タスクを処理するモデルをより細かく制御できるようになります。

  1. 概要
    1. 設定
      1. テスト
        1. このMCPサーバーをClaude Codeに追加する
          1. gemini-2.5-pro-exp-03-25で追加
          2. gemini-2.5-pro-preview-03-25で追加
          3. quasar-alphaを追加
          4. llama4-maverick-instruct-basicで追加
        2. 使用法
          1. 利用可能なツール
            1. 1. aider_ai_code
            2. 2. list_models
          2. 建築
            1. コードベースの構造

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                Provides code manipulation, execution, and version control capabilities. It allows AI assistants to read, write, and execute code while maintaining a history of changes.
                Last updated -
                8
                Python
                MIT License
              • -
                security
                A
                license
                -
                quality
                AI-powered assistant that connects Claude to video encoding workflows, translating cryptic errors into plain English and providing actionable solutions for troubleshooting encoding jobs.
                Last updated -
                1
                Python
                MIT License
              • -
                security
                A
                license
                -
                quality
                Enables AI agents and assistants like Goose or Claude to interact with VS Code through the Model Context Protocol.
                Last updated -
                14
                TypeScript
                Apache 2.0
                • Apple
              • -
                security
                F
                license
                -
                quality
                Connects Claude AI to QGIS through the Model Context Protocol, allowing Claude to directly interact with and control QGIS for tasks like project creation, layer manipulation, and code execution.
                Last updated -
                286
                Python
                • Apple

              View all related MCP servers

              ID: k1z18se9z3