项目简介

AgileFlow 是一个用于 Claude Code 的敏捷/文档即代码系统,结合了 Scrum、看板、ADR 和文档即代码原则。其 Notion 集成部分利用 Model Context Protocol (MCP) 作为一个应用后端,为 LLM 客户端(如 Claude Code)提供标准化的 Notion 数据访问和操作能力。它允许用户在 Notion 中管理 Epics、Stories 和 ADRs,并与 AgileFlow 系统进行双向同步。

主要功能点

  • 通过标准化的 MCP 协议与 Claude Code 等 LLM 客户端通信,作为应用后端提供上下文服务。
  • 托管和管理 Notion 中的项目数据(Epics、Stories、ADRs)作为可访问的资源。
  • 提供工具用于创建、更新和同步 Notion 数据库中的敏捷工件。
  • 实现 AgileFlow 系统与 Notion 数据库之间项目数据的双向同步。
  • 通过 '.mcp.json' 配置文件向客户端声明服务器能力,包括可用的资源和工具。

安装步骤

  1. 安装 AgileFlow 插件: 在 Claude Code 客户端中运行以下命令安装 AgileFlow 插件:
    /plugin marketplace add xloxn69/AgileFlow
    /plugin install AgileFlow
  2. 初始化系统并启用 Notion 集成: 运行系统初始化命令。在初始化过程中,系统会提示你是否启用 Notion 集成,请选择启用。
    /setup-system
  3. 创建 Notion 集成并获取 Token: 访问 https://www.notion.so/my-integrations 创建一个新的 Notion 集成。创建后,复制其 Integration Token(通常以 'secret_' 开头)。
  4. 配置 Notion Token: 在你的项目根目录下的 '.env' 文件中添加获取到的 Notion Token:
    echo "NOTION_TOKEN=secret_你的Notion集成Token" >> .env
    请务必注意 '.env' 文件应被 Git 忽略,切勿提交到代码仓库中。
  5. 复制 MCP 配置模板: AgileFlow 仓库中包含了一个 MCP 配置模板。你需要将其复制到活动配置中,供 Claude Code 客户端使用:
    cp .mcp.json.example .mcp.json
  6. 重启 Claude Code: 完成上述配置后,请重启 Claude Code 客户端,以便加载 AgileFlow 插件的 MCP 服务器组件。
  7. 创建 Notion 数据库: 运行以下命令,AgileFlow 将在你的 Notion 工作区中创建用于 Epics, Stories, ADRs 的数据库:
    /notion-export MODE=setup
  8. 开始同步: 运行以下命令,即可启动 AgileFlow 与 Notion 数据库之间的数据同步:
    /notion-export

服务器配置 (供 MCP 客户端参考)

AgileFlow 的 MCP 服务器作为 Claude Code 插件的一部分加载和运行,用户通常无需手动启动或配置其进程。MCP 客户端(如 Claude Code 自身)会读取仓库中生成的 '.mcp.json' 文件来获取服务器的连接信息和其提供的能力。以下是典型的 MCP 服务器配置结构示例,展示了客户端如何与服务器建立连接并了解其功能。

{
  "serverName": "AgileFlow Notion MCP Server",
  "serverDescription": "通过MCP协议,为AgileFlow提供Notion数据(Epics, Stories, ADRs)的访问和管理能力。",
  "protocol": "stdio",
  "command": "python",
  "args": ["-m", "agileflow.mcp_notion_server"],
  "capabilities": {
    "resources": [
      {
        "name": "epics",
        "description": "AgileFlow 中定义的 Epic,存储在 Notion 数据库中。"
      },
      {
        "name": "stories",
        "description": "AgileFlow 中定义的 User Story,存储在 Notion 数据库中。"
      },
      {
        "name": "adrs",
        "description": "架构决策记录 (Architecture Decision Records),存储在 Notion 数据库中。"
      }
    ],
    "tools": [
      {
        "name": "syncNotion",
        "description": "执行AgileFlow与Notion数据库之间的双向同步操作。"
      },
      {
        "name": "createNotionDatabases",
        "description": "在Notion中创建AgileFlow所需的Epics, Stories, ADRs数据库。"
      }
    ],
    "prompts": []
  }
}
  • 'serverName': MCP 服务器的友好名称。
  • 'serverDescription': 服务器功能和用途的简要描述。
  • 'protocol': MCP 服务器与客户端通信使用的协议,例如 'stdio' (标准输入/输出), 'sse' (Server-Sent Events), 'websocket' 等。
  • 'command': 客户端用于启动 MCP 服务器进程的命令行主命令。
  • 'args': 传递给 'command' 的参数列表,用于指定要执行的模块或脚本。
  • 'capabilities': 声明 MCP 服务器提供的功能:
    • 'resources': 服务器托管和管理的数据类型,这里是指 Notion 中关于 Epics, Stories, ADRs 的数据。
    • 'tools': 客户端可以调用以执行特定操作的外部功能,例如同步 Notion 数据或创建 Notion 数据库。
    • 'prompts': 服务器可以提供的预定义 Prompt 模板(如果支持)。

基本使用方法

安装并配置完成后,你可以在 Claude Code 环境中利用 AgileFlow 的命令与 Notion 进行交互:

  • 同步数据: 运行 '/notion-export' 命令即可启动 AgileFlow 与 Notion 数据库之间的双向同步。
  • 管理敏捷工件: 使用 '/epic-new', '/story-new', '/adr-new' 等 AgileFlow 命令在系统中创建和管理敏捷工件。这些更改将在同步时自动反映到 Notion 数据库中。同样,在 Notion 中对这些数据库内容的修改也会在同步时更新回 AgileFlow 系统。

信息

分类

开发者工具