代码代理服务

Archestra Coding Agent是一个结合了语义代码编辑和Git/GitHub操作的Docker化MCP服务器,适用于代码管理和协作开发。

  • by archestra-ai
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 archestra-ai/archestra-coding-agent

使用说明

Archestra编码代理

一个定制的MCP服务器,它结合了 Serena的 具有Git/GitHub操作的语义代码编辑功能,打包为Archestra基于K8s的MCP服务器运行时的Docker映像。

特性

Serena工具(语义代码操作)

项目和配置

  • activate_project -按名称或路径激活项目
  • check_onboarding_performed -检查项目入职培训是否已完成
  • onboarding -执行项目入职培训
  • get_current_config -打印当前代理配置
  • prepare_for_new_conversation -为新的对话做准备

符号操作

  • find_symbol -按名称路径模式检索符号/代码实体
  • find_referencing_symbols -查找对符号的引用
  • get_symbols_overview -获取文件中代码符号的高级概述
  • rename_symbol -在整个代码库中重命名符号
  • replace_symbol_body -替换符号的主体
  • insert_after_symbol -在符号定义后插入内容
  • insert_before_symbol -在符号定义之前插入内容

文件操作

  • create_text_file -写入新文件或覆盖现有文件
  • read_file -读取文件或其中的一部分
  • list_dir -列出文件和目录
  • find_file -查找与文件掩码匹配的文件
  • replace_content -替换文件中与模式匹配的内容
  • search_for_pattern -在代码库中灵活搜索模式

Shell 执行

  • execute_shell_command -执行shell命令并返回输出

内存管理

  • list_memories -列出可用记忆
  • read_memory -读取内存文件的内容
  • write_memory -将信息写入内存文件
  • edit_memory -编辑内存文件中的内容
  • delete_memory -删除内存文件

思维工具

  • think_about_collected_information -反思所收集信息的充分性
  • think_about_task_adherence -检查任务是否仍在正轨上
  • think_about_whether_you_are_done -反思任务完成情况

Git工具

  • git_clone -将Git存储库克隆到工作区
  • git_status -获取存储库的git状态
  • git_diff -显示未提交更改的差异
  • git_commit -阶段和提交更改
  • git_push -向远程推送提交
  • git_checkout_branch -创建新分支或切换到现有分支

GitHub工具

  • github_create_pr -在GitHub上创建pull请求
  • github_list_prs -列出存储库的拉取请求
  • github_get_issue -获取GitHub问题的详细信息

配置

环境变量

变量 必填 描述
GITHUB_TOKEN 是 API操作的GitHub个人访问令牌
WORKSPACE_DIR 否 克隆存储库的目录(默认: /workspace)

建筑

# Build the Docker image
make build

# Build and push to GCP Artifact Registry
make push

在Archestra的使用

  1. 将此MCP服务器添加到内部目录
  2. 使用分配的此服务器创建配置文件
  3. 配置 GITHUB_TOKEN 在服务器的环境变量中
  4. 开始编码!

本地测试

在本地构建和运行

# Build the Docker image
make build

# Run with a GitHub token
export GITHUB_TOKEN=your-token-here
make run

# Or run an interactive shell for debugging
make shell

测试MCP服务器

  1. 塑造形象: make build
  2. 启动容器:
    docker run -it --rm \
      -e GITHUB_TOKEN=$GITHUB_TOKEN \
      -v $(pwd)/workspace:/workspace \
      -p 9121:9121 \
      europe-west1-docker.pkg.dev/friendly-path-465518-r6/archestra-public/archestra-coding-agent:0.0.1
    
  3. 将MCP客户端连接到端口9121上的服务器

运行单元测试

# Install test dependencies
pip install -r requirements.txt pytest

# Run tests
make test

添加到Archestra内部目录

使用 catalog-entry.json 将此MCP服务器添加到内部目录的文件:

  1. 转到Archestra中的MCP目录页面
  2. 点击“添加内部服务器”
  3. 从导入配置 catalog-entry.json
  4. 或者使用API:
    curl -X POST http://localhost:9000/api/internal-mcp-catalog \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -d @catalog-entry.json
    

发展

# Install dependencies
pip install -r requirements.txt

# Run tests
pytest tests/ -v

建筑

┌─────────────────────────────────────────────────────────┐
│                    K8s Pod                              │
│  ┌─────────────────────────────────────────────────┐   │
│  │           archestra-coding-agent                 │   │
│  │  ┌─────────────┐  ┌─────────────────────────┐   │   │
│  │  │   Serena    │  │   Custom Git/GitHub     │   │   │
│  │  │  MCP Server │  │        Tools            │   │   │
│  │  └──────┬──────┘  └───────────┬─────────────┘   │   │
│  │         │                     │                  │   │
│  │         └─────────┬───────────┘                  │   │
│  │                   ▼                              │   │
│  │         ┌─────────────────┐                      │   │
│  │         │  /workspace     │                      │   │
│  │         │  (cloned repo)  │                      │   │
│  │         └─────────────────┘                      │   │
│  └─────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────┘