Skip to content

Conversation

@renvins
Copy link
Contributor

@renvins renvins commented Nov 3, 2025

This pull request introduces a configurable timeout parameter for the StdioConnector and StdioConnectionManager to address issues with hardcoded process termination timeouts for stdio-based servers.

Previously, the timeout for terminating a stdio server process was not configurable through the StdioConnector, which could lead to premature process termination if a server required a longer-than-default time to shut down gracefully.

This change exposes the timeout setting in the StdioConnector, allowing developers to specify a custom duration to wait for the server process to exit. The provided timeout value is then used to override the global PROCESS_TERMINATION_TIMEOUT in the underlying mcp client library for the scope of the connection.

Changes Made

  • Added a timeout parameter to StdioConnector with a default value imported from mcp.client.stdio.PROCESS_TERMINATION_TIMEOUT.
  • Propagated the timeout parameter from StdioConnector to StdioConnectionManager.
  • In StdioConnectionManager, the timeout is used to dynamically set the mcp.client.stdio.PROCESS_TERMINATION_TIMEOUT value, making the timeout configurable per connection.

This fix is a try to solve hardcoding... Fixes #404

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

❌ API Documentation Out of Date

The API documentation needs to be regenerated. Please run the following commands:

cd docs
python generate_docs.py ../libraries/python/mcp_use python/api-reference docs.json

Then commit the changes:

git add docs/
git commit -m "docs: update API documentation"
Modified files
 M docs/python/api-reference/mcp_use_client_connectors_stdio.mdx
 M docs/python/api-reference/mcp_use_client_task_managers_stdio.mdx

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.

Unable to set timeout for connection to MCP Server

2 participants