fix(mcp): preserve copilotcli multi-transport types (#1401) - #1410
Conversation
|
Reviewed PR #1410: Findings:
Security review:
|
|
Reviewed Overall: solid follow-up to the earlier review, and I did not find any security vulnerabilities or signs of malicious code. I do think there are still a few merge-blocking correctness/spec issues to address. Findings
Security review
|
|
Reviewed PR #1410 and found two issues worth fixing before merge. #1 [mid]
#2 [mid] Remote MCP configs no longer fail fast when the endpoint is missing
Security review: I did not find a concrete exploitable security issue in this diff, but this change does widen the trust boundary because Rulesync will now preserve external MCP endpoints and local executables for Copilot CLI. |
|
PR #1410 review #1 [mid] Copilot CLI MCP round-trip is no longer idempotent for transport-based servers
#2 [mid]
Security review: I did not find an additional standalone security issue beyond the compatibility and round-trip concerns above. |
dyoshikawa
left a comment
There was a problem hiding this comment.
Solid PR overall. The multi-transport support is well-implemented and the test coverage for the MCP changes is thorough. The gitignore multi-target refactor is clean too. A couple of things worth addressing inline — the JSDoc drift and the transport/type enum inconsistency are the main ones. No security concerns found.
| return "stdio"; | ||
| }; | ||
|
|
||
| /** |
There was a problem hiding this comment.
The top-level description still says "Adds type: stdio to each MCP server config if not present" but the function now resolves and sets the appropriate transport type (http, sse, local, or stdio). The @throws annotations were updated which is good, but the first line should reflect the broader behavior — something like "Resolves and sets the transport type for each MCP server config."
|
|
||
| export const McpServerSchema = z.looseObject({ | ||
| type: z.optional(z.enum(["stdio", "sse", "http"])), | ||
| type: z.optional(z.enum(["local", "stdio", "sse", "http"])), |
There was a problem hiding this comment.
"local" was added to the type enum here, but the transport enum on line 14 still only has ["stdio", "sse", "http"]. If someone writes transport: "local" instead of type: "local", resolveCopilotcliServerType will silently fall through to "stdio" since it only checks for "http" and "sse". Worth keeping these two enums in sync.
| ).rejects.toThrow('MCP server "no-command-server" is missing a command'); | ||
| }); | ||
|
|
||
| it("should throw error when stdio server has unknown fields but no command", async () => { |
There was a problem hiding this comment.
The test name says "unknown fields but no command" but the server config has url and headers which make it look like it should be an http server. The actual point is that without an explicit type/transport, it defaults to stdio and then fails on missing command — but the config is a bit misleading. Either simplify the config to just { unknown_field: "value" } or adjust the test name to clarify the defaulting behavior.
The transport enum was missing the "local" value that was already added to the type enum, which could cause silent fallback to stdio when transport: "local" was specified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ynamic type in error message - Add transport: local to resolveCopilotcliServerType so it no longer silently falls back to stdio - Use the resolved type variable in the missing-command error message instead of hardcoding stdio - Update JSDoc to reflect the function's actual behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@dyoshikawa-claw Thank you! |
What is the problem?
PR #1376 added Copilot CLI MCP support, but review findings (#1401) revealed issues:
addTypeFieldforced all servers totype: "stdio", but Copilot CLI also supports http, sse, and local transports (confirmed via official docs)if(global)branch ingetSettablePathsremoveTypeFieldstripped type unconditionallycopilotclitarget in rules-processortransportenum missing"local"(inconsistent withtypeenum)resolveCopilotcliServerTypedid not handletransport: "local"How did I fix it?
addTypeField: defaults missing type to "stdio", preserves explicit http/sse/local types, only validatescommandfor stdio/local servers, removes redundant type assertionsremoveTypeField: only strips type when it is "stdio"if(global)branchCopilotcliRuleand wiredcopilotcliinto rules-processor"local"totransportenum inMcpServerSchemafor consistency withtypeenumresolveCopilotcliServerTypeto handletransport: "local"${type}instead of hardcoded "stdio"How was this tested?
pnpm cicheckcleanCloses #1401