Skip to content

fix: normalize local MCP command string+args (fixes #3372) - #3373

Closed
shahtirth07 wants to merge 1 commit into
different-ai:devfrom
shahtirth07:fix/mcp-string-command-settings-crash-3372
Closed

shahtirth07 wants to merge 1 commit into
different-ai:devfrom
shahtirth07:fix/mcp-string-command-settings-crash-3372

Conversation

@shahtirth07

Copy link
Copy Markdown

Summary

  • Normalizes local MCP command (Claude Code-style string + separate args) into a proper string[] inside parseMcpServersFromContent, and adds a defensive Array.isArray guard at the crashing call site in settings-route.tsx.

Why

  • Settings rendered a blank/white page whenever a local MCP server config used string-form command + args. parseMcpServersFromContent cast raw parsed JSON straight to McpServerConfig without validating that command was actually an array, even though the type declares command?: string[]. Downstream code in the Settings useMemo then called .some() on that value and threw, unmounting the route.

Issue

Scope

  • apps/app/src/app/mcp.ts: normalize command/args into string[] at the parse boundary — this is the shared parser for both config.project and config.global MCP sources, so the fix covers every consumer, not just Settings
  • apps/app/src/react-app/shell/settings-route.tsx: guard the .some() call with Array.isArray as defense-in-depth
  • apps/app/tests/mcp.test.ts (new): covers string+args, array-form, and string-only command

Out of scope

  • Did not touch the equivalent mcpCommandFromConfig already present server-side in apps/server/src/cloud-plugins.ts — that one already normalizes correctly
  • Did not consolidate the now-several near-duplicate mcpCommandFromConfig-style implementations across the codebase into one shared util — worth a follow-up issue, not this fix

Testing

Ran

  • bun test tests/mcp.test.ts

Result

  • pass: 3 pass, 0 fail

CI status

  • pass:
  • code-related failures: none observed locally
  • external/env/auth blockers: none

Manual verification

  1. Configured a local MCP server in opencode.json using the exact string command + args repro from Settings page renders blank/white when a local MCP server uses string command (config.command?.some is not a function) #3372
  2. Launched the app, opened Settings — renders normally instead of going blank
  3. Confirmed an existing array-form MCP config still loads correctly (no regression)

Evidence

  • <attach a before/after screenshot or short screen recording of Settings loading with the repro config — worth doing since this is a visible UI crash fix>

Risk

  • Low — change is scoped to one parsing function and one call site; normalization is additive and falls back to [] on malformed input rather than throwing

Rollback

  • Revert this PR; no schema or migration changes involved

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.
@vercel

vercel Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, v0 Jul 31, 2026 4:02am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Jul 31, 2026 4:02am

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
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.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Contributor screen: passed

Commit 63458638ae · run

No hidden characters, dependency, database or obfuscation concerns.

Nothing else runs yet. A maintainer reviews the changes then comments /test to start the AI screen, the tests and the Warden security review.

@OmarMcAdam

Copy link
Copy Markdown
Member

closed due to age, please reopen and tag me if still valid

@OmarMcAdam OmarMcAdam closed this Oct 28, 2026

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – openwork-landing — 63458638 Deployed Jul 31, 2026 by vercel[bot]
Preview – openwork-diagnostics — 63458638 Deployed Jul 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings page renders blank/white when a local MCP server uses string command (config.command?.some is not a function)

2 participants