Skip to content

fix(agent-core): warn on MCP server shadowing#1515

Open
glmgbj233 wants to merge 1 commit into
MoonshotAI:mainfrom
glmgbj233:fix/mcp-shadow-warning
Open

fix(agent-core): warn on MCP server shadowing#1515
glmgbj233 wants to merge 1 commit into
MoonshotAI:mainfrom
glmgbj233:fix/mcp-shadow-warning

Conversation

@glmgbj233

Copy link
Copy Markdown

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 the github name.

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

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7883f23

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

1 participant