Skip to content

fix(config, mcp): Configuration inheritance for servers and tools#216

Merged
JeanMertz merged 2 commits intomainfrom
server-tool-defaults-inheritance
Jul 21, 2025
Merged

fix(config, mcp): Configuration inheritance for servers and tools#216
JeanMertz merged 2 commits intomainfrom
server-tool-defaults-inheritance

Conversation

@JeanMertz
Copy link
Collaborator

@JeanMertz JeanMertz commented Jul 21, 2025

MCP server and tool configurations now properly merge specific settings with global defaults instead of using simple fallback behavior. When a specific server or tool configuration differs from the global defaults, only the differing fields are overridden while preserving other default values. This ensures that configurations like servers.embedded.tools.* with run=ask and servers.embedded.tools.github_issues with run=always work correctly, allowing the github_issues tool to run without prompting while other tools still ask for permission.

The get_server_with_defaults and get_tool_with_defaults methods now compare each configuration field individually against the defaults and construct new configuration objects that properly inherit from global settings. This replaces the previous approach which would entirely fall back to defaults when no exact match was found, ignoring partial overrides.

Fixes: #201

MCP server and tool configurations now properly merge specific settings
with global defaults instead of using simple fallback behavior. When a
specific server or tool configuration differs from the global defaults,
only the differing fields are overridden while preserving other default
values. This ensures that configurations like `servers.embedded.tools.*`
with `run=ask` and `servers.embedded.tools.github_issues` with
`run=always` work correctly, allowing the `github_issues` tool to run
without prompting while other tools still ask for permission.

The `get_server_with_defaults` and `get_tool_with_defaults` methods now
compare each configuration field individually against the defaults and
construct new configuration objects that properly inherit from global
settings. This replaces the previous approach which would entirely fall
back to defaults when no exact match was found, ignoring partial
overrides.

Fixes #201

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz
Copy link
Collaborator Author

NOTE: this still needs tests, which I'll get to tomorrow, before merging this PR.

@JeanMertz JeanMertz marked this pull request as draft July 21, 2025 13:05
@JeanMertz JeanMertz marked this pull request as ready for review July 21, 2025 20:49
@JeanMertz JeanMertz merged commit a0ed9a7 into main Jul 21, 2025
13 checks passed
@JeanMertz JeanMertz deleted the server-tool-defaults-inheritance branch July 21, 2025 20:53
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.

Tool configuration defaults not properly overridden by specific tool configurations

1 participant