-
Notifications
You must be signed in to change notification settings - Fork 85
fix: infer HTTP for URL-only Codex MCP imports #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -440,10 +440,18 @@ pub fn import_from_codex(config: &mut MultiAppConfig) -> Result<usize, AppError> | |
| continue; | ||
| }; | ||
|
|
||
| // type 缺省为 stdio | ||
| // Codex 的远程 MCP 可以只写 `url`,不显式提供 `type`。 | ||
| // 这种情况下应按 HTTP 服务器导入,而不是回退到 stdio。 | ||
| let typ = entry_tbl | ||
| .get("type") | ||
| .and_then(|v| v.as_str()) | ||
| .or_else(|| { | ||
| entry_tbl | ||
| .get("url") | ||
| .and_then(|v| v.as_str()) | ||
| .filter(|url| !url.trim().is_empty()) | ||
| .map(|_| "http") | ||
| }) | ||
| .unwrap_or("stdio"); | ||
|
Comment on lines
+443
to
455
|
||
|
|
||
| // 构建 JSON 规范 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new inference uses
.get("type").and_then(|v| v.as_str()).or_else(...), which will inferhttpnot only whentypeis absent, but also whentypeis present but not a string (e.g.type = 1). That diverges from the PR intent (“type is absent”) and can silently import misconfigured entries. Consider checkingentry_tbl.contains_key("type")first (or filtering out non-string/empty values as a validation error) so inference only happens when the key is truly missing.