Skip to content

feat(config, mcp)!: Implement nested inheritance for MCP config#218

Merged
JeanMertz merged 1 commit intomainfrom
fix-mcp-inheritance
Jul 23, 2025
Merged

feat(config, mcp)!: Implement nested inheritance for MCP config#218
JeanMertz merged 1 commit intomainfrom
fix-mcp-inheritance

Conversation

@JeanMertz
Copy link
Collaborator

The previous MCP configuration resolution was based on a simple, two-level inheritance model that was evaluated at runtime using getter methods. This approach was brittle and led to complex consumer code.

This commit refactors the configuration loading to use a more robust, multi-level inheritance model implemented within the with_fallback logic of the partial configuration structs. This centralizes resolution logic, making it more predictable and simplifying consuming code, as the final Config struct is always fully resolved.

Tool configurations now inherit settings through multiple layers of specificity, from a specific tool on a specific server to global tool settings on a global server.

BREAKING CHANGE: The inheritance and resolution logic for MCP server and tool configurations has been completely overhauled.

The previous model used a simple fallback from a specific server/tool configuration to a global (*) one. The new model implements a more complex, multi-level inheritance system that correctly merges configurations from different sources (e.g., user config and default config).

Users should review their configurations to ensure they are compatible with the new, more predictable inheritance rules. This may allow for simplification of existing configurations.

The previous MCP configuration resolution was based on a simple,
two-level inheritance model that was evaluated at runtime using getter
methods. This approach was brittle and led to complex consumer code.

This commit refactors the configuration loading to use a more robust,
multi-level inheritance model implemented within the `with_fallback`
logic of the partial configuration structs. This centralizes resolution
logic, making it more predictable and simplifying consuming code, as the
final `Config` struct is always fully resolved.

`Tool` configurations now inherit settings through multiple layers of
specificity, from a specific tool on a specific server to global tool
settings on a global server.

BREAKING CHANGE: The inheritance and resolution logic for MCP server and
tool configurations has been completely overhauled.

The previous model used a simple fallback from a specific server/tool
configuration to a global (*) one. The new model implements a more
complex, multi-level inheritance system that correctly merges
configurations from different sources (e.g., user config and default
config).

Users should review their configurations to ensure they are compatible
with the new, more predictable inheritance rules. This may allow for
simplification of existing configurations.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 63a035c into main Jul 23, 2025
13 checks passed
@JeanMertz JeanMertz deleted the fix-mcp-inheritance branch July 23, 2025 12:07
JeanMertz added a commit that referenced this pull request Jul 23, 2025
This commit refactors the tool execution configuration to enhance
security by defaulting to user confirmation before running a tool. The
global run policy is changed from `always` to `ask`.

To maintain a smooth user experience for safe, read-only operations,
servers like `embedded`, `bookworm`, and `kagi` are configured to run
their tools automatically.

However, potentially destructive file system tools like `fs_modify_file`
and `fs_create_file` are explicitly configured to require user
confirmation, overriding the server-level settings and aligning with the
new safer default. This change also simplifies the configuration file by
removing redundant entries, which are no longer needed since the recent
inheritance refactor merged in #218.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
JeanMertz added a commit that referenced this pull request Jul 23, 2025
)

This commit refactors the tool execution configuration to enhance
security by defaulting to user confirmation before running a tool. The
global run policy is changed from `always` to `ask`.

To maintain a smooth user experience for safe, read-only operations,
servers like `embedded`, `bookworm`, and `kagi` are configured to run
their tools automatically.

However, potentially destructive file system tools like `fs_modify_file`
and `fs_create_file` are explicitly configured to require user
confirmation, overriding the server-level settings and aligning with the
new safer default. This change also simplifies the configuration file by
removing redundant entries, which are no longer needed since the recent
inheritance refactor merged in #218.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
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