Repository navigation
fix: normalize local MCP command string+args (fixes #3372) - #3373
Closed
shahtirth07 wants to merge 1 commit into
Closed
shahtirth07 wants to merge 1 commit into
shahtirth07 wants to merge 1 commit into
Conversation
parseMcpServersFromContent cast raw config to McpServerConfig without normalizing command, so a string command + separate args crashed Settings downstream. Normalize at the parse boundary and guard the settings-route.tsx call site.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
|
Someone is attempting to deploy a commit to the Different AI Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Contributor screen: passedCommit No hidden characters, dependency, database or obfuscation concerns. Nothing else runs yet. A maintainer reviews the changes then comments |
Member
|
closed due to age, please reopen and tag me if still valid |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
command(Claude Code-style string + separateargs) into a properstring[]insideparseMcpServersFromContent, and adds a defensiveArray.isArrayguard at the crashing call site insettings-route.tsx.Why
command+args.parseMcpServersFromContentcast raw parsed JSON straight toMcpServerConfigwithout validating thatcommandwas actually an array, even though the type declarescommand?: string[]. Downstream code in the SettingsuseMemothen called.some()on that value and threw, unmounting the route.Issue
command(config.command?.some is not a function) #3372Scope
apps/app/src/app/mcp.ts: normalizecommand/argsintostring[]at the parse boundary — this is the shared parser for bothconfig.projectandconfig.globalMCP sources, so the fix covers every consumer, not just Settingsapps/app/src/react-app/shell/settings-route.tsx: guard the.some()call withArray.isArrayas defense-in-depthapps/app/tests/mcp.test.ts(new): covers string+args, array-form, and string-only commandOut of scope
mcpCommandFromConfigalready present server-side inapps/server/src/cloud-plugins.ts— that one already normalizes correctlymcpCommandFromConfig-style implementations across the codebase into one shared util — worth a follow-up issue, not this fixTesting
Ran
bun test tests/mcp.test.tsResult
CI status
Manual verification
opencode.jsonusing the exact stringcommand+argsrepro from Settings page renders blank/white when a local MCP server uses stringcommand(config.command?.some is not a function) #3372Evidence
Risk
[]on malformed input rather than throwingRollback