http://182.42.153.28:18900/api/mcp/sse使用 scripts/agentflow.py 调用工具(已封装好 SSE/POST 逻辑):
bash
python scripts/agentflow.py <tool_name> [args...]
bash
python scripts/agentflow.py list_projects
python scripts/agentflow.py create_project "我的项目" "项目描述"
python scripts/agentflow.py get_project <projectId>
python scripts/agentflow.py update_project <projectId> <status>
python scripts/agentflow.py delete_project <projectId>
python scripts/agentflow.py get_project_status <projectId>
bash
python scripts/agentflow.py create_requirement <projectId> "需求标题" "P1" ["描述"]
python scripts/agentflow.py list_requirements <projectId>
python scripts/agentflow.py get_requirement <requirementId>
python scripts/agentflow.py update_requirement <requirementId> <field> <value>
python scripts/agentflow.py delete_requirement <requirementId>
bash
python scripts/agentflow.py create_task <requirementId> "任务标题" "P1" ["负责人"]
python scripts/agentflow.py list_tasks [requirementId]
python scripts/agentflow.py get_task <taskId>
python scripts/agentflow.py transition <taskId/requirementId> <fromStatus> <toStatus> ["操作人"] ["备注"]
python scripts/agentflow.py get_timeline <taskId>
bash
python scripts/agentflow.py upload_file <entityType> <entityId> <filepath>
entityType 说明:
project - 项目附件requirement - 需求附件task - 任务附件(最常用)⚠️ 上传附件时,
entityType必须根据目标实体选择对应的类型。 如果要给任务上传附件,entityType 填task,不是requirement!
上传流程:
get_upload_url 获取上传地址和字段bash
python scripts/agentflow.py search "关键词"
类别工具功能项目create_project创建项目项目get_project获取项目详情项目list_projects列出项目列表项目update_project更新项目状态项目get_project_status项目整体状态摘要项目delete_project删除项目需求create_requirement创建需求(关联到项目)需求get_requirement获取需求详情需求list_requirements列出需求列表需求update_requirement更新需求字段需求delete_requirement删除需求任务create_task创建任务(关联到需求)任务get_task获取任务详情任务list_tasks列出任务列表任务transition任务/需求状态流转任务get_timeline查看时间线文件get_upload_url获取文件上传地址和字段文件upload_file完整文件上传流程辅助search搜索项目/需求/任务辅助log_context / get_context / delete_context上下文数据管理
状态含义pending待处理in_review审核中in_progress进行中completed已完成paused已暂停cancelled已取消
当收到需求文档时,按以下步骤操作:
bash
# 创建项目
python scripts/agentflow.py create_project "项目名称" "项目描述"
# 创建需求(关联到项目)
python scripts/agentflow.py create_requirement <projectId> "需求标题" "P1"
将需求文档按维度拆解, 每个任务生成一个独立的 md 文件。
{任务ID}-{任务名称}.mddocuments/{项目名}/task_split/⚠️ 关键原则:每个任务单独创建,附件挂载到对应任务,不要聚集上传。
批量创建任务的脚本示例:
python
tasks = [
('T01', '后端框架搭建', 'P0', 2, '基于clouddream-server初始化项目...'),
('T02', '数据库设计', 'P0', 3, '设计10张核心表结构...'),
# ...更多任务
]
task_ids = {} # 用于记录 taskId 映射
for task_id, name, priority, days, desc in tasks:
title = f'{task_id}-{name}'
# 1. 创建任务,获取 taskId
result = call('create_task', {
'requirementId': REQ_ID,
'title': title,
'priority': priority,
'description': f'{desc} | {days}人天'
})
task_ids[task_id] = result['id']
# 2. 等待一小段时间
time.sleep(0.3)
# 3. 逐个上传附件到对应任务
for task_key, task_id in task_ids.items():
filepath = f'documents/{项目名}/task_split/{task_key}-{任务名}.md'
upload_file('task', task_id, filepath) # entityType='task'!
time.sleep(0.5)
bash
# 任务开始时
python scripts/agentflow.py transition <taskId> pending in_progress "执行人"
# 任务完成时
python scripts/agentflow.py transition <taskId> in_progress completed "执行人"
# 需求全部完成
python scripts/agentflow.py transition <requirementId> in_progress completed "执行人"
错误做法正确做法把所有任务文件上传到一个任务附件每个任务单独创建+上传到自己的附件entityType 填 requirement 上传任务附件entityType 填 task 上传任务附件上传到需求附件而不是任务附件任务文档 → 任务附件;需求文档 → 需求附件
每次接到需求文档时,必须自动同步到 AgentFlow:
阶段AgentFlow 操作状态值开始拆解create_project + create_requirement``pending逐步完成create_task + transition``in_progress全部完成requirement transition``completed
详见 MEMORY.md「需求开发流程 × AgentFlow 集成规范」章节。