From 03c7502244fdfdbc92f863502f955f15e344c986 Mon Sep 17 00:00:00 2001 From: “wangming” <“wangming@antissoft.com”> Date: Fri, 27 Mar 2026 22:16:42 +0800 Subject: [PATCH] 添加新的skills --- Antis.Erp.Plat/.cursor/skills/mcp-db-auto-retry/SKILL.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+), 0 deletions(-) create mode 100644 Antis.Erp.Plat/.cursor/skills/mcp-db-auto-retry/SKILL.md diff --git a/Antis.Erp.Plat/.cursor/skills/mcp-db-auto-retry/SKILL.md b/Antis.Erp.Plat/.cursor/skills/mcp-db-auto-retry/SKILL.md new file mode 100644 index 0000000..7b9e764 --- /dev/null +++ b/Antis.Erp.Plat/.cursor/skills/mcp-db-auto-retry/SKILL.md @@ -0,0 +1,39 @@ +--- +name: mcp-db-auto-retry +description: Access MySQL through MCP with auto-retry workflow. Use when running database queries via MCP, especially if the DB MCP connection is closed, unavailable, or returns transport errors. +--- + +# MCP 数据库访问自动重试 + +## 适用场景 + +- 需要通过 MCP 访问 MySQL 数据库 +- 调用数据库 MCP 工具时报连接错误,例如: + - `Can't add new command when connection is in closed state` + - MCP server unavailable / timeout / transport error + +## 固定执行规则 + +当数据库 MCP 调用失败时,必须执行以下流程: + +1. **第一次失败后**:立即重试(视为第 1 次重启/恢复尝试) +2. **第二次失败后**:再次重试(第 2 次尝试) +3. **第三次失败后**:最后重试(第 3 次尝试) +4. **若 3 次仍失败**:停止自动重试,并明确告知用户: + - MCP 数据库连接未恢复 + - 请用户手动启动/恢复 MCP + - 用户确认后再继续数据库读取 + +## 执行细节 + +- 每次重试前,优先做一个轻量探测查询: + - `SELECT 1 AS ok` +- 探测成功后,再执行真实业务 SQL。 +- 重试过程中保留简短进度反馈(当前第几次)。 +- 不要无上限重试;上限严格为 **3 次**。 + +## 输出规范 + +- 成功时:说明“已恢复连接并继续查询”。 +- 失败 3 次时:说明“需要用户手动启动 MCP 后再继续”。 + -- libgit2 0.21.4