Add top-level mcps section for reusable MCP server definitions#1947
Merged
dgageot merged 1 commit intodocker:mainfrom Mar 6, 2026
Merged
Add top-level mcps section for reusable MCP server definitions#1947dgageot merged 1 commit intodocker:mainfrom
dgageot merged 1 commit intodocker:mainfrom
Conversation
55df367 to
812f7a7
Compare
rumpl
previously approved these changes
Mar 6, 2026
Introduce a top-level 'mcps' section in the agent config that allows defining MCP server configurations once and referencing them by name from agent toolsets. This eliminates duplication when multiple agents use the same MCP server. Agent toolsets reference definitions via 'ref: <name>'. Fields set on the toolset override the definition; env maps are merged with toolset values taking precedence on conflicts. Definitions are validated at parse time using the existing Toolset validation, rejecting nonsensical fields (e.g. shared, path) and invalid source combinations. Closes docker#1667 Assisted-By: cagent
812f7a7 to
164e679
Compare
Member
Author
|
/review |
There was a problem hiding this comment.
Review Summary
Assessment: 🔴 CRITICAL
Found 2 confirmed bugs in the MCP definition resolution logic:
- HIGH: The
applyMCPDefaultsfunction incorrectly clears thereffield for command-based definitions, losing the definition name - MEDIUM: The Remote struct merge logic only checks the URL field, which can cause Header values to be lost during override operations
Both issues are in newly added code and affect the core functionality of MCP definition resolution.
gtardif
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a top-level
mcpssection to the agent config for defining MCP server configurations once and referencing them by name from agent toolsets. This eliminates duplication when multiple agents use the same MCP server.Before
After
Override semantics
envmaps are merged (toolset values win on key conflicts)command,remote, andref(docker refs)Changes
MCPToolsettype (wrapsToolset, validates at parse time),MCPsfield onConfigdocker:prefix restriction fromToolset.validate()(now checked during MCP definition validation)resolveMCPDefinitions,validateMCPDefinition,applyMCPDefaultsresolveMCPDefinitionsinvalidateConfigmcpsproperty andMCPToolsetdefinitionCloses #1667