Skip to content

Fix: Handle nested config dict in add_mcp_server to prevent KeyError: 'command' #3204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

mihirdeo16
Copy link

Description:

This PR addresses issue #3203 by adding support for a nested config dictionary when calling add_mcp_server.
To fix the issue, added a simple fallback to unwrap the nested config. This allows both nested and flat parameter formats to work without breaking existing usage. Tested locally with agent.json of input to confirm that the function now works as expected without throwing an error. I noticed currently, there doesn't seem to be one for this path under tests.

@Wauplin
Copy link
Contributor

Wauplin commented Jul 7, 2025

Hi @mihirdeo16 , thanks for suggesting this fix! As explained in #3203 (comment), the change is intentional and we don't want to support the use case where config is passed as a nested dictionary. Sorry for the inconvenience, we forgot to update the default example. I opened #3205 to fix that. I'll close this PR in favor of the other one. Hope that's fine with you! :)

@Wauplin Wauplin closed this Jul 7, 2025
@mihirdeo16
Copy link
Author

Yep no worries.

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