Skip to content

plugins: support flat MCP server map format in .mcp.json#302583

Merged
connor4312 merged 2 commits intomainfrom
connor4312/302576
Mar 18, 2026
Merged

plugins: support flat MCP server map format in .mcp.json#302583
connor4312 merged 2 commits intomainfrom
connor4312/302576

Conversation

@connor4312
Copy link
Member

  • The _parseMcpServerDefinitionMap method previously required a wrapper
    { mcpServers: { ... } } object. Some .mcp.json files use a flat
    format where server entries are at the top level without the mcpServers
    wrapper. This extracts a resolveMcpServersMap helper that accepts both
    formats, so plugins with either style are discovered correctly.
  • Adds tests for the new resolveMcpServersMap function.

Fixes #302576

(Commit message generated by Copilot)

- The _parseMcpServerDefinitionMap method previously required a wrapper
  `{ mcpServers: { ... } }` object. Some .mcp.json files use a flat
  format where server entries are at the top level without the mcpServers
  wrapper. This extracts a resolveMcpServersMap helper that accepts both
  formats, so plugins with either style are discovered correctly.
- Adds tests for the new resolveMcpServersMap function.

Fixes #302576

(Commit message generated by Copilot)
Copilot AI review requested due to automatic review settings March 17, 2026 22:11
@connor4312 connor4312 enabled auto-merge (squash) March 17, 2026 22:11
@vs-code-engineering vs-code-engineering bot added this to the 1.113.0 milestone Mar 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds compatibility for plugins whose .mcp.json files define MCP servers either in the legacy wrapped format ({ "mcpServers": { ... } }) or in a flat top-level map format, ensuring more third-party plugins are discovered correctly during agent plugin discovery.

Changes:

  • Introduce resolveMcpServersMap(raw) helper to accept both wrapped and flat .mcp.json server-map formats.
  • Update MCP server definition parsing to use the new helper.
  • Add unit tests covering wrapped vs flat server-map resolution behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts Adds resolveMcpServersMap and uses it in MCP server map parsing to accept both .mcp.json shapes.
src/vs/workbench/contrib/chat/test/common/plugins/resolveMcpServersMap.test.ts Adds tests for the new helper across wrapped/flat and basic invalid-input cases.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@connor4312 connor4312 merged commit 358fba6 into main Mar 18, 2026
30 of 31 checks passed
@connor4312 connor4312 deleted the connor4312/302576 branch March 18, 2026 03:16
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.

MCP server from context7 plugin does not load

3 participants