fix: normalize mcpServers config key to mcp and transform external MCP formats#639
Conversation
…l MCP formats - Auto-normalize top-level `mcpServers` → `mcp` (used by Claude Code, Cursor, `.mcp.json`) - Transform external MCP server format: string `command` + `args` + `env` → array `command` + `environment` - Handle remote servers without explicit `type` field (infer from `url` presence) - Always delete `mcpServers` to prevent strict schema rejection (even when `mcp` exists) - Normalize typed entries that use external field names (`env`, string `command`) - Add 5 tests: string command, array command, both-keys conflict, remote server, typed entry normalization Closes #638 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 13 minutes and 43 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Empty `mcpServers` object
- Non-object `mcpServers` value (string)
- Null server entries removed during normalization
- Numeric/boolean args coerced to strings
- String `args` field wrapped in array
- Disabled server entry (`{ enabled: false }`)
- `environment` takes precedence over `env`
- `timeout` and `enabled` fields preserved
- Mixed local and remote servers
- Special characters in server names
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ed35235 to
4ca0b3f
Compare
What does this PR do?
Fixes the config validation error when users or LLMs write MCP server config using the
mcpServerskey (common in Claude Code, Cursor,.mcp.jsonformat). The strict config schema rejected this withUnrecognized key: "mcpServers", preventing the app from starting.This PR adds a
normalizeMcpConfigfunction that:mcpServers→mcpwith a warning logcommand+args+env→ arraycommand+environmenttypefield (infers fromurlpresence)mcpServersto prevent strict schema rejection (even whenmcpalready exists)env, stringcommand)Type of change
Issue for this PR
Closes #638 (reported in #619)
How did you verify your code works?
bun run script/upstream/analyze.ts --markers --base main --strict)Checklist
altimate_changemarkers to upstream-shared files🤖 Generated with Claude Code