
Aider MCP Server

2025.04.24
0
PythonAI 编程辅助代码生成开发效率
Aider MCP Server 是一个基于 Machine Cognition Protocol (MCP) 的服务,利用 Aider 提供 AI 编程能力。它通过标准化的 API 提供代码生成、模型选择等功能,旨在通过离散的任务分配和模型特定能力来降低开发成本并提高代码可靠性。
View on GitHub
Overview
基本能力
产品定位
Aider MCP Server 是一个 AI 编程辅助工具,旨在通过标准化的 API 提供高效的代码生成和编辑能力。
核心功能
- AI 代码生成:使用 Aider 进行一次性编码任务,如添加、修复或增强代码。
- 模型选择:查询可用模型以选择最适合任务的模型。
- 灵活配置:可自定义 Aider 会话的设置。
- 多传输支持:支持 Server-Sent Events (SSE) 或 stdio 传输方式。
适用场景
- 开发者在需要快速生成或修改代码时使用。
- 需要集成 AI 编程能力的开发环境。
- 多模型选择的 AI 编程任务。
工具列表
- ai_code:运行 Aider 执行编码任务。
- 参数:
ai_coding_prompt
(AI 编码提示)、relative_editable_files
(可编辑文件列表)、relative_readonly_files
(只读文件列表,可选)、settings
(Aider 会话设置,可选)。 - get_models:列出可用的 Aider 模型,支持按子字符串过滤。
- 参数:
substring
(过滤子字符串)。
常见问题解答
- 依赖问题:确保 Python 3.10+ 和 uv 或 pip 已安装。
- API 密钥:根据使用的模型(如 OpenAI、Anthropic、Google Gemini)配置相应的 API 密钥。
- 传输模式:支持 SSE 和 stdio 两种模式,根据需求配置。
使用教程
使用依赖
- Python:3.10 或更高版本。
- 包管理器:推荐使用 uv 或 pip。
- API 密钥:根据使用的模型配置 OpenAI、Anthropic 或 Google Gemini 的 API 密钥。
安装教程
- 克隆仓库:
bash git clone https://github.com/your-username/aider-mcp.git cd aider-mcp
- 安装包:
bash uv venv uv pip install -e .
- 运行测试:
bash uv run pytest
调试方式
- 启动服务器(SSE 模式):
bash uv run python -m aider_mcp_server
- 使用自定义设置启动:
bash uv run python -m aider_mcp_server --editor-model "gemini/gemini-2.5-pro-exp-03-25" --cwd "/path/to/project"
- 检查输出:
Starting server with transport: sse Using SSE transport on 0.0.0.0:8050