From 441223f98cb8ea01b2c40d89ce0e2555ff58c2cc Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Wed, 28 May 2025 22:01:00 -0400 Subject: [PATCH] Update docstrings --- src/fastmcp/client/transports.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/fastmcp/client/transports.py b/src/fastmcp/client/transports.py index 1fa52bf1a..b1938e10c 100644 --- a/src/fastmcp/client/transports.py +++ b/src/fastmcp/client/transports.py @@ -101,6 +101,7 @@ class WSTransport(ClientTransport): warnings.warn( "WSTransport is a deprecated MCP transport and will be removed in a future version. Use StreamableHttpTransport instead.", DeprecationWarning, + stacklevel=2, ) if isinstance(url, AnyUrl): url = str(url) @@ -248,6 +249,10 @@ class StdioTransport(ClientTransport): args: The arguments to pass to the command env: Environment variables to set for the subprocess cwd: Current working directory for the subprocess + keep_alive: Whether to keep the subprocess alive between connections. + Defaults to True. When True, the subprocess remains active + after the connection context exits, allowing reuse in + subsequent connections. """ self.command = command self.args = args @@ -356,6 +361,10 @@ class PythonStdioTransport(StdioTransport): env: Environment variables to set for the subprocess cwd: Current working directory for the subprocess python_cmd: Python command to use (default: "python") + keep_alive: Whether to keep the subprocess alive between connections. + Defaults to True. When True, the subprocess remains active + after the connection context exits, allowing reuse in + subsequent connections. """ script_path = Path(script_path).resolve() if not script_path.is_file(): @@ -425,6 +434,10 @@ class NodeStdioTransport(StdioTransport): env: Environment variables to set for the subprocess cwd: Current working directory for the subprocess node_cmd: Node.js command to use (default: "node") + keep_alive: Whether to keep the subprocess alive between connections. + Defaults to True. When True, the subprocess remains active + after the connection context exits, allowing reuse in + subsequent connections. """ script_path = Path(script_path).resolve() if not script_path.is_file(): @@ -467,6 +480,10 @@ class UvxStdioTransport(StdioTransport): with_packages: Additional packages to include from_package: Package to install the tool from env_vars: Additional environment variables + keep_alive: Whether to keep the subprocess alive between connections. + Defaults to True. When True, the subprocess remains active + after the connection context exits, allowing reuse in + subsequent connections. """ # Basic validation if project_directory and not Path(project_directory).exists(): @@ -525,6 +542,10 @@ class NpxStdioTransport(StdioTransport): project_directory: Project directory with package.json env_vars: Additional environment variables use_package_lock: Whether to use package-lock.json (--prefer-offline) + keep_alive: Whether to keep the subprocess alive between connections. + Defaults to True. When True, the subprocess remains active + after the connection context exits, allowing reuse in + subsequent connections. """ # verify npx is installed if shutil.which("npx") is None: