项目简介

认知任务编排器(CTO)是一个AI驱动的开发平台,它利用Model Context Protocol (MCP) 工具,通过Claude智能体帮助用户自动化生成项目文档和实现代码。该平台通过GitHub Apps进行安全认证,并采用配置驱动的工作流,所有操作都作为Kubernetes任务运行,确保高可靠性和资源清理,最终结果自动通过GitHub PR提交。

主要功能点

  • 文档自动化生成: 针对您的Task Master项目自动创建全面的文档,包括任务描述、验收标准和智能体实施指南。
  • 代码自动化实现: 部署自主Claude智能体,根据Task Master定义的任务实现代码,并提交GitHub PR。
  • 项目任务摄取 (Intake): 处理新的项目需求,根据产品需求文档 (PRD) 和架构文件自动分解为可执行的Task Master任务。
  • 任务状态管理: 提供了查看正在运行和已完成的自动化任务,以及停止指定任务的功能。
  • 实时输入通道: 允许用户向正在运行的智能体任务发送实时消息。

安装步骤

  1. 准备环境:

    • 具备MCP支持的Cursor/Claude环境。
    • 已初始化Task Master的项目(包含'.taskmaster/'目录)。
    • 您的项目对应的GitHub仓库。
    • Kubernetes 1.19+ 和 Helm 3.2.0+。
    • 有效的GitHub个人访问令牌和Anthropic API Key。
  2. 添加Helm仓库:

    helm repo add 5dlabs https://5dlabs.github.io/cto
    helm repo update
  3. 安装自定义资源定义 (CRDs):

    kubectl apply -f https://raw.githubusercontent.com/5dlabs/cto/main/infra/charts/agent-platform/crds/platform-crds.yaml
  4. 安装Agent平台:

    helm install agent-platform 5dlabs/agent-platform --namespace agent-platform --create-namespace
  5. 设置Agent秘密信息: 运行以下脚本,按照提示输入GitHub App和Anthropic API Key相关信息。

    wget https://raw.githubusercontent.com/5dlabs/cto/main/infra/scripts/setup-agent-secrets.sh
    chmod +x setup-agent-secrets.sh
    ./setup-agent-secrets.sh --help
  6. 安装MCP服务器: 这是与Cursor/Claude集成的核心组件。

    curl --proto '=https' --tlsv1.2 -LsSf https://github.com/5dlabs/cto/releases/download/v0.2.0/tools-installer.sh | sh

    安装完成后,您可以通过运行 'cto-mcp --help' 来验证。

服务器配置 ('cto-config.json')

在您的项目根目录创建 'cto-config.json' 文件,用于配置智能体、模型和默认值。这个文件是MCP服务器加载配置的关键。

{
  "version": "1.0",
  "defaults": {
    "docs": {
      "model": "claude-opus-4-20250514",
      "githubApp": "5DLabs-Morgan",
      "includeCodebase": false,
      "sourceBranch": "main"
    },
    "code": {
      "model": "claude-opus-4-20250514", 
      "githubApp": "5DLabs-Rex",
      "continueSession": false,
      "workingDirectory": ".",
      "overwriteMemory": false,
      "docsRepository": "https://github.com/your-org/your-docs-repo",
      "docsProjectDirectory": "projects/your-project",
      "service": "your-service-name"
    },
    "intake": {
      "model": "claude-3-5-sonnet-20241022",
      "githubApp": "5DLabs-Blaze"
    }
  },
  "agents": {
    "morgan": "5DLabs-Morgan",
    "rex": "5DLabs-Rex", 
    "blaze": "5DLabs-Blaze",
    "cipher": "5DLabs-Cipher"
  }
}

MCP客户端配置 (Cursor MCP 集成)

为了让您的MCP客户端(例如Cursor)连接并使用CTO MCP服务器,您需要在项目目录中创建一个 '.cursor/mcp.json' 文件。

{
  "mcpServers": {
    "cto-mcp": {
      "command": "cto-mcp",
      "args": [],
      "env": {}
    }
  }
}
  • 'server name': 'cto-mcp' (MCP服务器的唯一标识符)。
  • 'command': 'cto-mcp' (启动MCP服务器可执行文件的命令)。
  • 'args': '[]' (MCP服务器启动时需要传递的参数列表,当前版本通常不需要额外参数)。
  • 'env': '{}' (MCP服务器运行时的环境变量,如果需要可在此处配置)。

完成配置后,重启Cursor以加载MCP服务器,然后您就可以在LLM客户端中调用 'docs()'、'task()' 等函数了。

基本使用方法

  1. 配置项目: 确保 'cto-config.json' 和 '.cursor/mcp.json' 文件已正确设置在您的项目根目录。

  2. 重启LLM客户端: 重新启动Cursor或Claude环境以加载MCP服务器和配置。

  3. 调用MCP工具: 您现在可以直接在LLM客户端中调用以下MCP工具:

    • 生成文档 ('docs'): 用于分析Task Master项目并生成全面文档。

      // 使用配置默认值的最小调用
      docs({
        working_directory: "projects/my-app"
      });
      
      // 覆盖特定参数
      docs({
        working_directory: "projects/my-app",
        agent: "morgan",
        model: "claude-3-5-sonnet-20241022"
      });
    • 实现代码 ('task'): 部署Claude智能体以实现Task Master项目中的特定任务。

      // 使用配置默认值的最小调用
      task({
        task_id: 5,
        repository: "https://github.com/myorg/my-project"
      });
      
      // 继续处理部分完成或失败的任务
      task({
        task_id: 5,
        repository: "https://github.com/myorg/my-project",
        continue_session: true
      });
    • 项目摄取 ('intake'): 处理新的项目需求,自动生成Task Master结构并提交PR。

      intake({
        project_name: "new-project-example"
      });
    • 列出任务 ('jobs'): 列出所有正在运行的平台任务(CodeRun, DocsRun, Intake)。

      jobs({}); // 列出所有任务
      jobs({ include: ["code"] }); // 仅列出代码实现任务
    • 停止任务 ('stop_job'): 停止指定类型的正在运行的任务。

      stop_job({
        job_type: "code",
        name: "your-coderun-name"
      });
    • 发送输入 ('input'): 向正在运行的Claude任务发送实时用户消息。

      input({
        text: "Agent, please reconsider the error handling in main.rs.",
        job_type: "code",
        name: "your-coderun-name"
      });

信息

分类

AI与计算