1 安装Serena
pip install uv
git clone https://github.com/oraios/serena.git
cd serena
uv run serena start-mcp-server --context codex --transport streamable-http --port 9121
2 安装Desktop-Commander
npx @wonderwhy-er/desktop-commander@latest setup
3 打开config.toml末尾添加
[mcp_servers.desktop-commander]
type = "stdio"
command = "cmd"
args = ["/c", "npx", "-y", "@wonderwhy-er/desktop-commander@latest","--no-onboarding"]
[mcp_servers.desktop-commander.env]
SystemRoot = 'C:\Windows'
[mcp_servers.Serena]
type = "http"
url = "http://127.0.0.1:9121/mcp"
4 在 AGENTS.md 添加
# Codex全局工作指南
## 回答风格:
- 回答必须使用中文
- 对总结、Plan、Task、以及长内容的输出,优先进行逻辑整理后使用美观的Table格式整齐输出;普通内容正常输出
## 工具使用:
1. 文件与代码检索:使用serena mcp来进行文件与代码的检索
2. 文件相关操作:对文件的创建、读取、编辑、删除等操作
- 优先使用apply_patch工具进行
- 读文件,apply_patch工具报错或出现问题的情况下使用desktop-commander mcp
- 任何情况下,禁止使用cmd、powershell或者python来进行文件相关操作