dev-manager-tauri/.blueprint/modules/mcp-config-inject.md
lanrtop c598c9b05b feat: add BlueprintPromptModal for blueprint management and sync functionality
- Implemented BlueprintPromptModal component to handle blueprint prompt generation and rule synchronization.
- Added BlueprintStatusBadge to display the current status of blueprints in ProjectCard.
- Integrated blueprint status fetching and synchronization in ProjectCard.
- Enhanced SettingsPage with a new section for MCP service configuration and batch sync for blueprint rules.
- Updated commands to include new blueprint-related functionalities and types.
- Changed application name from "Dev Manager" to "炼境" in various components.
2026-04-04 10:47:27 +09:00

41 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MCP 配置注入
产品组成员变更时,炼境自动向对应项目的 `.claude/settings.json` 注入或移除 MCP 服务器配置,实现热插拔。
## 决策记录
- 使用 `lian-jing:group-{group_id}` 命名空间前缀标记炼境写入的 key与用户自有配置严格隔离
- 炼境只操作自己命名空间下的 key其余配置永远不动
- 加入/退出操作由炼境 UI 驱动,炼境必然在线,无需异步清理机制
- 注入前做 JSON 有效性校验,文件损坏时不覆盖,在 UI 提示用户
## 任务卡
### ✅ 加入产品组时注入配置
- status: done
- complexity: M
- files: src-tauri/src/mcp_inject.rs, src-tauri/src/commands/groups.rs
- depends: mcp-server
- acceptance:
- 项目加入产品组后,其 win_path 或 wsl_path 对应的 `.claude/settings.json` 被写入以下条目
- key 格式:`lian-jing:group-{group_id}`
- value`{ "type": "http", "url": "http://localhost:{port}/mcp/group/{group_id}" }`
- 文件不存在时自动创建;文件已存在时合并写入,不影响其他 key
- 文件 JSON 损坏时 eprintln 记录,不影响成员关系 DB 写入
### ✅ 退出产品组时清除配置
- status: done
- complexity: S
- files: src-tauri/src/mcp_inject.rs, src-tauri/src/commands/groups.rs
- depends: mcp-config-inject注入
- acceptance:
- 项目退出产品组后,`lian-jing:group-{group_id}` 这一 key 被精确删除
- 其他 key包括其他产品组的 key、用户自有配置完全不受影响
- 在 DB 删除前先执行清除remove_project_mcp 需要 project_workspaces 查路径)
### ✅ 端口变更时重新注入所有配置
- status: done
- complexity: S
- files: src-tauri/src/mcp_inject.rs, src-tauri/src/commands/settings.rs
- acceptance: update_settings 检测到 mcp_port key 变更后自动调用 reinject_all_mcp遍历所有 project_group_map 记录重新写入 settings.json