Aider MCP 서버 - 실험적
AI 코딩 작업을 Aider에 오프로드하여 개발 효율성과 유연성을 향상시키는 모델 컨텍스트 프로토콜 서버입니다.
개요
이 서버를 통해 Claude Code는 AI 코딩 작업을 최고의 오픈소스 AI 코딩 어시스턴트인 Aider에 위임할 수 있습니다. 특정 코딩 작업을 Aider에 위임함으로써 비용을 절감하고, 코딩 모델을 제어하며, Claude Code를 더욱 체계적으로 운영하여 코드 검토 및 수정 작업을 수행할 수 있습니다.
Related MCP server: MCP Unified Server
설정
저장소를 복제합니다.
지엑스피1
종속성 설치:
uv sync환경 파일을 만듭니다.
cp .env.sample .envAider에서 사용하려는 모델에 필요한 API 키를 갖도록
.env파일에서 API 키를 구성하세요(또는 mcpServers "env" 섹션을 사용하세요):
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.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 서버는 다음과 같은 기능을 제공합니다.
AI 코딩 작업을 Aider에 오프로드합니다 .
프롬프트와 파일 경로를 사용합니다.
Aider를 사용하여 요청된 변경 사항을 구현합니다.
성공 또는 실패를 반환합니다.
사용 가능한 모델 목록 :
하위 문자열과 일치하는 모델 목록을 제공합니다.
지원되는 모델을 검색하는 데 유용합니다.
사용 가능한 도구
이 MCP 서버는 다음 도구를 제공합니다.
1. aider_ai_code
이 도구를 사용하면 제공된 프롬프트와 지정된 파일을 기반으로 AI 코딩 작업을 수행하기 위해 Aider를 실행할 수 있습니다.
매개변수:
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 toolsrc/aider_mcp_server: 주요 애플리케이션 코드가 들어 있습니다.atoms: 기본 구성 요소를 담습니다. 원자는 순수 함수 또는 최소한의 종속성을 가진 간단한 클래스로 설계되었습니다.tools: 여기의 각 파일은 특정 MCP 도구(aider_ai_code,list_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디렉토리의 구조를 반영하는 테스트를 포함하고 있으며, 각 구성 요소(특히 Atom)가 예상대로 작동하는지 확인합니다.