关于 mcp-aider-executor
mcp-aider-executor 是面向 LLM Agent 的 stdio MCP 服务,可在后台启动 aider 执行代码编辑,并记录提示词,供后续查看进程、聊天历史和 Git 状态。
主要功能
- 01在后台运行 aider
- 02查看进程状态与聊天历史
- 03检查 Git 状态和近期提交
- 04管理分支、暂存和还原
- 05通过路径白名单限制操作
适用场景
- 01委派 aider 编辑代码,同时让 Agent 继续处理其他工作
- 02查看先前 aider 运行的进度
- 03编辑前检查或准备代码库
MCP 相关
向 MCP 客户端提供启动 aider,以及检查进度、提示词、文件、配置和 Git 状态的工具。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
项目信息
stdio MCP 服务,用于将 aider 作为分离的后台进程运行,
并提供基本的 git 工具和状态检查。这使大模型能够自由启动代码编辑进程,
并在之后检查 aider 聊天记录以了解进度,从而实现 Agent 群集行为。
同一目录中会创建 .aider.mcp.details.json 文件,其中包含进程 ID 和启动日期时间。
MCP 服务提供工具,供大模型 Agent 检查进程是否仍在运行,
以及查看 .aider.chat.history.md 中的更新。
通过 MCP 服务发送给 aider 的原始提示词也会记录在 .aider.mcp.prompt.txt 中。
快速开始
你可以直接使用 npx 运行服务,并传入端点 URL 和 API 密钥的环境变量。
请提供 --whitelist 参数和允许的 glob 路径,否则默认会拒绝所有操作。
{
"mcpServers": {
"mcp-aider-executor": {
"command": "npx",
"args": [
"-y",
"mcp-aider-executor",
"--whitelist",
"/home/user/my-project/**",
"--whitelist",
"/local/my-application/**"
],
"env": {
"AIDER_MODEL": "openai/gemma-4-E4B-it-IQ4_XS",
"OPENAI_API_BASE": "http://127.0.0.1:1337/v1",
"OPENAI_API_KEY": "your-key-here"
}
}
}
}
提示词
你可以直接告诉大模型使用 Aider,并为其提供工作目录。例如:
Use Aider to create a simple Python hello world console application in "/home/my-project"
如需使用其他 Aider 选项,应通过环境变量(MCP 设置 .json 中的 env)进行适当配置,
或让大模型在项目目录中为你创建 Aider YAML 配置文件。默认情况下,
服务会提供一些基本的 git 和文件工具,供大模型查看内容。如果你想使用单独的 MCP 服务来处理更高级的功能,
可以通过下方的选项禁用这些工具。
注意
出于安全考虑,MCP 服务不具备将 API 密钥写入配置 YAML 的功能。 请改用
env提供OPENAI_API_KEY等密钥。不要将其告知大模型。
选项
你可以在 npx 命令中添加这些参数。
-h, --help Display this message
--model <model> Default LLM main model override (i.e. always use this model no matter what)
--edit-format <format> Main model edit format override, regardless of config or LLM inference
--architect Always run in architect mode (--no-architect for never)
--editor-model <model> Default secondary editor model override for architect mode
--editor-edit-format <format> Editor model's edit format override
--no-add-message-notes Disables the adding of aider-specific notes to message prompts
--no-register-git-tools Disables registration of all git tools for this server
--no-allow-git-edits Disables only the git tools which modify the repo history
--no-register-file-tools Disables registration of wide file access tools for this server
--whitelist <path> Only allow operations within the glob path
环境前提条件
运行 MCP 服务的环境必须安装以下工具,并可在 shell 中通过可执行命令调用:
- node
- aider
- git
警告
如果你为
aider使用同一个本地端点,应将并行请求数设为 2, 否则聊天会话和后台aider进程会互相等待,导致卡住。如果你使用兼容 OpenAI 的本地端点,还应将
OPENAI_API_KEY环境变量设为非空值, 因为即使不使用 API 密钥,aider也需要该变量。为
aider指定本地端点的模型名称时,仍需添加openai/前缀。
可用的 MCP 工具
以下是大模型可以调用的 MCP 工具列表。
aider_check_git_log:检查近期提交。aider_check_git_status:调用git status --short,检查指定目录的状态。aider_check_last_prompt:返回上次 Aider 运行时的原始提示词。aider_check_progress:检查 Aider 聊天记录和后台进程状态。aider_checkout_git_branch:切换 git 分支;如果分支不存在,则创建新分支。aider_create_git_stash:暂存所有内容,以清空目录供 Aider 使用(git stash -u)。aider_git_revert:根据 git 提交哈希还原更改。aider_list_files:列出指定目录中的所有文件。aider_list_git_branches:返回指定目录中的 git 分支列表。aider_mcp_check_whitelist:检查此 Aider MCP 服务允许使用的 glob 路径。aider_message_prompt:通过给定的消息提示词启动后台aider进程。aider_read_config_yaml:返回目录中.aider.conf.yml的完整内容。aider_read_file_contents:读取指定文件路径的内容。aider_setup_config_yaml:在目录中创建.aider.conf.yml文件。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。