Skip to content

Add adapter_kwargs parameter to MCPClient #1528

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

Merged

Conversation

LucasDltg
Copy link
Contributor

No description provided.

Copy link
Member

@albertvillanova albertvillanova left a comment

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
Contributor Author

Sounds good to me. I have updated the PR.

@LucasDltg LucasDltg reopened this Jul 7, 2025
Copy link
Member

@albertvillanova albertvillanova left a comment

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.

@@ -79,6 +79,7 @@ class MCPClient:
def __init__(
self,
server_parameters: "StdioServerParameters" | dict[str, Any] | list["StdioServerParameters" | dict[str, Any]],
adapter_kwargs: dict[str, Any]
Copy link
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?

Copy link
Member

@albertvillanova albertvillanova left a comment

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
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