Itential GAIT MCP
用于Itential FlowAI的GAIT(Git for AI Tracking)MCP服务器。
直接在IAG服务器上运行,每个代理都有本地存储。每个代理都有自己的独立子文件夹。
快速开始
# Clone and install
git clone
cd itential_gait_mcp
pip install -r requirements.txt
# Run the MCP server
export GAIT_STORAGE_ROOT=/opt/gait/agents
python gait_mcp.py
建筑
┌─────────────────────────────────────────┐
│ FlowAI │
│ └─ Calls MCP tools with agent_id │
└──────────────────┬──────────────────────┘
│ MCP Protocol
▼
┌─────────────────────────────────────────┐
│ IAG Server │
│ ├─ gait_mcp.py (this repo) │
│ └─ /opt/gait/agents/ │
│ ├─ agent-001/.gait/ │
│ ├─ agent-002/.gait/ │
│ └─ session-xyz/.gait/ │
└─────────────────────────────────────────┘
FlowAI JSON配置
每个工具都需要 agent_id -这决定了哪个子文件夹存储数据。
初始化GAIT(必要时自动创建)
{
"agent_id": "my-agent-session-123"
}
记录对话回合
{
"agent_id": "my-agent-session-123",
"user_text": "What is the status of interface Gi0/1?",
"assistant_text": "Interface GigabitEthernet0/1 is up with IP 192.168.1.1/24",
"artifacts": [
{
"path": "output/interface_status.json",
"content": "{\"interface\": \"Gi0/1\", \"status\": \"up\"}"
}
],
"note": "network-query"
}
获取对话历史记录
{
"agent_id": "my-agent-session-123",
"turns": 10
}
代理ID策略
| 策略 | 示例 | 用例 |
|---|
| 按流执行 | flow-{{execution_id}} | 每个流程运行都是隔离的 |
| 每节课 | session-{{session_id}} | 在会话中共享上下文 |
| 每个用户 | user-{{user_id}} | 用户特定的持久内存 |
| 每台设备 | device-{{hostname}} | 设备特定历史记录 |
可用工具
核心
| 工具 | 参数 | 说明 |
|---|
gait_init | agent_id | 为代理初始化GAIT |
gait_status | agent_id | 获取回购状态 |
gait_record_turn | agent_id, user_text, assistant_text, artifacts, note | 记录一个转弯 |
gait_log | agent_id, limit | 列出最近的提交 |
gait_show | agent_id, commit | 显示提交详细信息 |
gait_resume | agent_id, turns | 还原对话上下文 |
记忆
| 工具 | 参数 | 说明 |
|---|
gait_memory | agent_id | 列出固定项目 |
gait_pin | agent_id, commit, note | 固定承诺 |
gait_unpin | agent_id, index | 按索引取消订阅 |
gait_context | agent_id, full | 构建上下文包 |
分支机构和历史
| 工具 | 参数 | 说明 |
|---|
gait_branch | agent_id, name, from_commit | 创建分支 |
gait_checkout | agent_id, name | 交换机分支 |
gait_merge | agent_id, source, message | 合并分支 |
gait_revert | agent_id, target | 回溯历史 |
gait_squash | agent_id, last, message | 壁球承诺 |
环境变量
| 变量 | 默认值 | 描述 |
|---|
GAIT_STORAGE_ROOT | /opt/gait/agents | 基本存储目录 |
GAIT_MCP_HOST | 0.0.0.0 | 要绑定的主机 |
GAIT_MCP_PORT | 8000 | 要收听的端口 |
FlowAI工作流示例
1. Flow starts
└─ gait_init(agent_id="flow-12345")
2. User asks question
└─ gait_record_turn(agent_id="flow-12345", user_text="...", assistant_text="...")
3. Multiple turns happen...
4. Later, resume context
└─ gait_resume(agent_id="flow-12345", turns=10)
└─ Returns conversation history
5. Pin important context
└─ gait_pin(agent_id="flow-12345", note="important finding")
存储结构
/opt/gait/agents/
└── my-agent-session-123/
└── .gait/
├── HEAD # Current branch ref
├── objects/ # Content-addressed storage
│ ├── ab/
│ │ └── cdef1234... # Commit/turn objects
│ └── ...
└── refs/
├── heads/
│ └── main # Branch refs
└── memory/
└── main # Memory manifest refs
许可证
GPL-3.0