Repository navigation
feat(mcp): 支持用户个人凭证并优化配置交互 - #1153
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa91016b51
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| request.headers[header] = value | ||
| response = yield request |
There was a problem hiding this comment.
Prevent personal API keys from following cross-origin redirects
When an API-key MCP endpoint returns a redirect to another origin, the personal secret can be forwarded to that destination. personal_mcp_tools uses the SDK's default HTTP client, which follows redirects, but HTTPX processes those redirects inside a single auth-flow invocation, so the origin check above does not run again. HTTPX strips Authorization on cross-origin redirects but preserves custom headers such as X-API-Key. I reproduced this with the actual PersonalMCPAuth class and HTTPX MockTransport: both the configured endpoint and a second origin received the personal key after a 307 response. Disable redirects for personal connections or enforce the origin boundary on every redirected request before sending credentials.
Useful? React with 👍 / 👎.
变更说明
同一个 MCP 服务可以由每名用户分别填写 Bearer Token 或 API Key,工具发现、连接测试与 Agent 调用都使用该用户的凭证。管理员继续维护服务地址和接入方式;个人凭证操作收进右侧按钮组,共享身份的填写位置与文案更明确。
feature工程主张与 Owner
McpConnectionControls.vue统一拥有预览与详情页的凭证交互;保存与测试分开,测试结果直接体现在主按钮,替换和清除放在菜单。验证情况
CI 管理连接回归
ba433c25e的 CI 运行 已完成,20 个 CI job 全部成功,包含原先失败的 service、运行时契约和CI required;CodeQL 同样通过。个人凭证与运行身份
Schema 与已有 OAuth 兼容
oauth_config.py、业务 Schema、显式mcp_personal_credentialsmigration。凭证表单与操作层级
文档与提交边界
git diff --check;初始功能验证从 main 导出并仅叠加 MCP 的 32 个文件,独立执行前端及文档检查。实际执行的主要命令:
前端命令在宿主环境执行;浏览器命令在已打开 5173 验证页的 CLI session 中执行。独立快照复用相同依赖,关闭 pnpm 的自动安装检查,不改变依赖或锁文件。
简化 / 删除验收
不涉及独立能力删除。静态凭证复用既有连接表与运行时;预览和详情共用一个凭证交互组件。
独立语义 Review
CI 修复由全新 Grok 上下文审查三处增量、原有管理 API oracle、委托身份及个人 403 断言;结论为“可提交,必要项无”,未要求增加抽象或防御分支。Reviewer 未亲自重跑测试,本次修复快照未包含认证模式常量及通用错误解释器全文;实际回归结果独立记录在上方。
本机 Grok CLI 以全新上下文审查了原始需求、完整 MCP staged diff、32 个最终文件、适用规范及新增测试断言,重点检查必要性、现有能力复用、冗余逻辑和心智负担。结论:可提交;需先修复项:无;可选改进:无。本轮未增加抽象、配置或防御分支。
Reviewer 未亲自运行测试,未阅读快照外的通用
base.js、全局异常格式及初始化器全文;审查结论与实际测试证据分别记录。未验证范围与风险
事故反馈
未达到高影响逃逸事故门槛;相关失败场景作为功能负向用例覆盖。
界面变更
凭证区的主要操作为右侧“测试连接”按钮,成功后显示“连接正常”;替换/清除放在相邻菜单。管理员按凭证提供者选择接入方式,共享请求头直接填写;预览弹窗保留基础高度。浅色、深色和失败状态截图已在交付对话提供,仓库保留可复现的生产组件浏览器验证脚本与 fixture,不提交运行截图或真实凭证。
关联事项
无。
补充说明
business Schema 由 1 升到 2,只新增可空
api_key_header;运行一次:docker compose exec api uv run --no-sync python -m yuxi.migrations.mcp_personal_credentials docker compose restart api worker升级幂等,保留已有连接及共享配置。共享身份不会自动复制为个人凭证;管理员按服务自行选择接入方式。