Skip to content

refactor: shorten plugin MCP tool qualified names#1549

Open
blablabiu wants to merge 3 commits into
MoonshotAI:mainfrom
blablabiu:shorten-plugin-mcp-tool-names
Open

refactor: shorten plugin MCP tool qualified names#1549
blablabiu wants to merge 3 commits into
MoonshotAI:mainfrom
blablabiu:shorten-plugin-mcp-tool-names

Conversation

@blablabiu

Copy link
Copy Markdown

Related Issue

No related issue. Problem explained below.

Problem

Plugin-provided MCP tool names carry a long, mostly redundant prefix before the actual tool name, e.g. mcp__plugin-ifind-mcp_s__get_financial_statements. The literal plugin- tag and the server-name segment (often a meaningless single letter like _s since most plugins declare only one MCP server) are pure overhead. Combined with a long plugin id, this could also push the qualified name past the 64-character cap, triggering a hash-truncated, unreadable name (e.g. mcp__plugin-world_bank_open_data-mcp_s__world_bank_sear_2a768f76).

What changed

  • pluginMcpRuntimeName() in packages/agent-core/src/plugin/manager.ts now drops the literal plugin- prefix, and omits the server-name segment entirely when a plugin declares only one MCP server (the common case). It only keeps pluginId:serverName when a plugin declares 2+ MCP servers, which is still unambiguous since plugin ids are unique and cannot contain :.
  • Updated packages/agent-core/test/plugin/manager.test.ts and test/rpc/plugins-rpc.test.ts to match the new runtime-name format, and reworked the disambiguation test to use multi-server fixtures so it still exercises the : boundary.
  • Synced the official kimi-datasource plugin's SKILL.md (which hardcodes the qualified tool names it tells the model to call) and bumped its own version/changelog.

This is a breaking change: the wire-level tool name for every installed plugin's MCP tools changes, so any previously saved per-tool permission approval for a plugin tool needs to be re-granted after upgrading. A changeset (minor) is included describing this.

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.

Drop the redundant literal 'plugin-' prefix from plugin MCP server
runtime names, and omit the server-name segment entirely when a
plugin declares only one MCP server (the common case). This shortens
every plugin-provided MCP tool's qualified name, e.g.:

  mcp__plugin-ifind-mcp_s__get_financial_statements
  -> mcp__ifind-mcp__get_financial_statements

Breaking change: previously saved per-tool permission approvals for
plugin MCP tools will need to be re-granted after upgrading, since
the wire-level tool name changes.
@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1816eb4

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 Minor

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: d509abe11e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// single-server case). Only append ":serverName" when a plugin declares
// more than one MCP server — that keeps cross-plugin pairs unambiguous
// even when either half contains "-" (e.g. "a-b"+"c" vs "a"+"b-c").
return serverCount > 1 ? `${pluginId}:${serverName}` : pluginId;

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 a namespace for plugin MCP servers

When a single-server plugin id matches an existing user/caller MCP server name (for example both are github), this now returns the bare plugin id, and mergePluginMcpConfig() spreads plugin servers after base?.servers, so the plugin silently replaces the user's configured server for that session. The previous plugin-<id>:<server> key avoided collisions with non-plugin MCP servers; this needs either a reserved plugin namespace or explicit collision handling before omitting the server segment.

Useful? React with 👍 / 👎.

@pkg-pr-new

pkg-pr-new Bot commented Jul 11, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@d509abe
npx https://pkg.pr.new/@moonshot-ai/kimi-code@d509abe

commit: d509abe

@wbxl2000

Copy link
Copy Markdown
Collaborator

The direction of this PR makes sense, but there are two points to confirm:

  1. A plugin with a single MCP server now uses its bare pluginId. This may collide with a user-configured MCP server and silently override it. See the existing review comment.

  2. The tool name now depends on the number of servers declared by the plugin. For example, kimi-datasource uses mcp__kimi-datasource__* with one server. If a second server is added later, the existing tools become mcp__kimi-datasource_data__*, requiring another migration of hardcoded skill names, permission rules, and similar references.

Plugin version compatibility should also be considered. Plugins such as kimi-datasource include complete tool names in their SKILL.md. If the runtime and plugin are not upgraded together, the old and new names may not match.

Additional research:

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.

2 participants