Skip to content

Add adapter_kwargs parameter to MCPClient - #1528

Merged
albertvillanova merged 5 commits into
huggingface:mainfrom
LucasDltg:Add-timeout-parameters-to-MCP
Jul 7, 2025
Merged

albertvillanova merged 5 commits into
huggingface:mainfrom
LucasDltg:Add-timeout-parameters-to-MCP

Conversation

@LucasDltg

Copy link
Copy Markdown
Contributor

No description provided.

@albertvillanova albertvillanova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the addition, @LucasDltg.

However, please note that the client_session_timeout_seconds was only introduced in mcpadapt-0.1.10, whereas we currently support mcpadapt>=0.1.8.

To maintain compatibility with older versions, maybe we could expose a more generic adapter_kwargs param instead and pass it through to MCPAdapt, so users can customize it depending on their installed version.

Let me know what you think.

@LucasDltg LucasDltg closed this Jul 7, 2025
@LucasDltg
LucasDltg deleted the Add-timeout-parameters-to-MCP branch July 7, 2025 09:36
@LucasDltg
LucasDltg restored the Add-timeout-parameters-to-MCP branch July 7, 2025 09:38
@LucasDltg

Copy link
Copy Markdown
Contributor Author

Sounds good to me. I have updated the PR.

@LucasDltg LucasDltg reopened this Jul 7, 2025

@albertvillanova albertvillanova left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the update!

Could you please add the new parameter to the docstring? Also, the parameter should be optional, so there are no breaking changes.

Comment thread src/smolagents/mcp_client.py Outdated
def __init__(
self,
server_parameters: "StdioServerParameters" | dict[str, Any] | list["StdioServerParameters" | dict[str, Any]],
adapter_kwargs: dict[str, Any]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You made this parameter required. Could you please make it optional?

@albertvillanova albertvillanova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Just added a minor quality code fix.

The CI test error is unrelated:

@albertvillanova albertvillanova changed the title feat: added timeout parameters for MCP Add adapter_kwargs parameter to MCPClient Jul 7, 2025
@albertvillanova
albertvillanova merged commit dfe5388 into huggingface:main Jul 7, 2025
maxwellfet928 pushed a commit to maxwellfet928/smolagents that referenced this pull request Jun 8, 2026
Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.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.

2 participants