fix(agent-core): warn on MCP server shadowing#1515
Conversation
🦋 Changeset detectedLatest commit: 7883f23 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7883f23063
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...base?.servers, | ||
| ...callerServers, | ||
| }, | ||
| warnings: base?.warnings, |
There was a problem hiding this comment.
Preserve MCP diagnostics when plugin servers are enabled
This carries warnings through caller-server merging, but every session then calls mergePluginMcpConfig; when any plugin MCP server is enabled it returns a fresh { servers } object without warnings (packages/agent-core/src/rpc/core-impl.ts:997-1005). In that context—a user/project MCP name collision plus at least one enabled plugin MCP server—the new diagnostics are dropped before Session.loadMcpServers() reads them, so the promised shadowing warning is never logged.
Useful? React with 👍 / 👎.
Related Issue
No issue yet. This is a small MCP configuration hardening change.
Problem
Project-level MCP server definitions can use the same server name as user-level MCP servers. Since MCP tools and permission rules are matched by qualified tool name, rules such as
mcp__github__*may apply to whichever server definition is active for thegithubname.That can be surprising when a project-level definition overrides a user-level server with the same name.
What changed
Added diagnostics for project-level MCP server definitions that shadow user-level servers. When this happens, session startup logs a warning explaining that server-scoped MCP permission rules may apply to the project-defined server.
Also updated the MCP documentation in English and Chinese, added tests, and included a patch changeset.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.