Skip to content

Fix MCP servers console crash when servers is not an array#585

Merged
crspeller merged 1 commit intomasterfrom
cursor/mcp-servers-map-error-138b
Apr 1, 2026
Merged

Fix MCP servers console crash when servers is not an array#585
crspeller merged 1 commit intomasterfrom
cursor/mcp-servers-map-error-138b

Conversation

@crspeller
Copy link
Copy Markdown
Member

@crspeller crspeller commented Apr 1, 2026

Summary

Fixes a System Console MCP panel crash caused by calling .map() on a non-array mcp.servers value.

  • Normalize mcpConfig.servers once with Array.isArray(...) ? ... : []
  • Reuse the normalized value for tool prefetch fingerprinting and config rendering
  • Prevent runtime TypeError: ...map is not a function when malformed/legacy config data is present

Ticket Link

NONE

Screenshots

Manual UI screenshots/video were not produced in this environment because the local containerized System Console test stack could not be brought to a fully runnable state for browser validation.

Release Note

Fixed a System Console MCP settings crash when malformed legacy MCP server config data made `mcp.servers` non-array.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced MCP server configuration handling to ensure consistent behavior when processing server data, preventing potential issues with improperly formatted configurations.

Co-authored-by: Christopher Speller <crspeller@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

🤖 LLM Evaluation Results

OpenAI

⚠️ Overall: 18/19 tests passed (94.7%)

Provider Total Passed Failed Pass Rate
⚠️ OPENAI 19 18 1 94.7%

❌ Failed Evaluations

Show 1 failures

OPENAI

1. TestReactEval/[openai]_react_cat_message

  • Score: 0.00
  • Rubric: The word/emoji is a cat emoji or a heart/love emoji
  • Reason: The output is the text string "heart_eyes_cat", not an actual cat emoji (e.g., 😺/🐱) or a heart/love emoji (e.g., ❤️/😍). Therefore it does not satisfy the rubric.

Anthropic

⚠️ Overall: 17/19 tests passed (89.5%)

Provider Total Passed Failed Pass Rate
⚠️ ANTHROPIC 19 17 2 89.5%

❌ Failed Evaluations

Show 2 failures

ANTHROPIC

1. TestReactEval/[anthropic]_react_cat_message

  • Score: 0.00
  • Rubric: The word/emoji is a cat emoji or a heart/love emoji
  • Reason: The output is the text string "heart_eyes_cat", not an actual cat emoji (e.g., 😺) or a heart/love emoji (e.g., ❤️). Therefore it does not meet the rubric.

2. TestChannelSummarization/[anthropic]_channel_summarization_developers_webapp_channel

  • Score: 0.00
  • Rubric: mentions claudio and harrison discussing exactly what should be tracked for code coverage
  • Reason: The output mentions @claudio.costa adding code coverage tracking and notes @harrison raised a concern about snapshot tests inflating coverage metrics, but it does not describe them discussing exactly what should be tracked for code coverage (i.e., the specific scope/definition of what to track).

This comment was automatically generated by the eval CI pipeline.

@crspeller crspeller marked this pull request as ready for review April 1, 2026 16:26
@crspeller crspeller requested a review from nickmisasi April 1, 2026 16:26
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review: No issues found

This PR is a minimal, frontend-only defensive fix in the system console admin panel. It hoists an existing Array.isArray(mcpConfig?.servers) guard into a shared normalizedServers variable to prevent a crash when the config data has an unexpected shape (e.g., object/map instead of array).

No new endpoints, data flows, permission changes, or server-side logic are introduced. The validation logic is identical to the prior code — just deduplicated. No security concerns.

Open in Web View Automation 

Sent by Cursor Automation: Find vulnerabilities

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 67eb6be9-94ef-4122-bffb-a0a3650bb964

📥 Commits

Reviewing files that changed from the base of the PR and between fc37217 and 666e381.

📒 Files selected for processing (1)
  • webapp/src/components/system_console/mcp_servers.tsx

📝 Walkthrough

Walkthrough

The change introduces a normalized servers array to centralize handling of potentially non-array mcpConfig.servers values, ensuring consistent behavior across configFingerprint and the rendered config construction.

Changes

Cohort / File(s) Summary
MCP Servers Configuration Normalization
webapp/src/components/system_console/mcp_servers.tsx
Introduced normalizedServers variable to handle non-array mcpConfig.servers values, replacing duplicate inline array expressions in both configFingerprint and config construction.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested labels

Setup Cloud Test Server

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix in the changeset: normalizing mcpConfig.servers to prevent a crash when it is not an array, which directly addresses the TypeError issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/mcp-servers-map-error-138b

Comment @coderabbitai help to get the list of available commands and usage tips.

@crspeller crspeller merged commit 605e0db into master Apr 1, 2026
36 checks passed
@crspeller crspeller deleted the cursor/mcp-servers-map-error-138b branch April 1, 2026 16:49
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.

3 participants