Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
0f3d0c4
1
Parent(s): a1a5130
Update docstrings
Browse files
src/fastmcp/client/transports.py
CHANGED
|
@@ -101,6 +101,7 @@ class WSTransport(ClientTransport):
|
|
| 101 |
warnings.warn(
|
| 102 |
"WSTransport is a deprecated MCP transport and will be removed in a future version. Use StreamableHttpTransport instead.",
|
| 103 |
DeprecationWarning,
|
|
|
|
| 104 |
)
|
| 105 |
if isinstance(url, AnyUrl):
|
| 106 |
url = str(url)
|
|
@@ -248,6 +249,10 @@ class StdioTransport(ClientTransport):
|
|
| 248 |
args: The arguments to pass to the command
|
| 249 |
env: Environment variables to set for the subprocess
|
| 250 |
cwd: Current working directory for the subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
"""
|
| 252 |
self.command = command
|
| 253 |
self.args = args
|
|
@@ -356,6 +361,10 @@ class PythonStdioTransport(StdioTransport):
|
|
| 356 |
env: Environment variables to set for the subprocess
|
| 357 |
cwd: Current working directory for the subprocess
|
| 358 |
python_cmd: Python command to use (default: "python")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
"""
|
| 360 |
script_path = Path(script_path).resolve()
|
| 361 |
if not script_path.is_file():
|
|
@@ -425,6 +434,10 @@ class NodeStdioTransport(StdioTransport):
|
|
| 425 |
env: Environment variables to set for the subprocess
|
| 426 |
cwd: Current working directory for the subprocess
|
| 427 |
node_cmd: Node.js command to use (default: "node")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
"""
|
| 429 |
script_path = Path(script_path).resolve()
|
| 430 |
if not script_path.is_file():
|
|
@@ -467,6 +480,10 @@ class UvxStdioTransport(StdioTransport):
|
|
| 467 |
with_packages: Additional packages to include
|
| 468 |
from_package: Package to install the tool from
|
| 469 |
env_vars: Additional environment variables
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
"""
|
| 471 |
# Basic validation
|
| 472 |
if project_directory and not Path(project_directory).exists():
|
|
@@ -525,6 +542,10 @@ class NpxStdioTransport(StdioTransport):
|
|
| 525 |
project_directory: Project directory with package.json
|
| 526 |
env_vars: Additional environment variables
|
| 527 |
use_package_lock: Whether to use package-lock.json (--prefer-offline)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 528 |
"""
|
| 529 |
# verify npx is installed
|
| 530 |
if shutil.which("npx") is None:
|
|
|
|
| 101 |
warnings.warn(
|
| 102 |
"WSTransport is a deprecated MCP transport and will be removed in a future version. Use StreamableHttpTransport instead.",
|
| 103 |
DeprecationWarning,
|
| 104 |
+
stacklevel=2,
|
| 105 |
)
|
| 106 |
if isinstance(url, AnyUrl):
|
| 107 |
url = str(url)
|
|
|
|
| 249 |
args: The arguments to pass to the command
|
| 250 |
env: Environment variables to set for the subprocess
|
| 251 |
cwd: Current working directory for the subprocess
|
| 252 |
+
keep_alive: Whether to keep the subprocess alive between connections.
|
| 253 |
+
Defaults to True. When True, the subprocess remains active
|
| 254 |
+
after the connection context exits, allowing reuse in
|
| 255 |
+
subsequent connections.
|
| 256 |
"""
|
| 257 |
self.command = command
|
| 258 |
self.args = args
|
|
|
|
| 361 |
env: Environment variables to set for the subprocess
|
| 362 |
cwd: Current working directory for the subprocess
|
| 363 |
python_cmd: Python command to use (default: "python")
|
| 364 |
+
keep_alive: Whether to keep the subprocess alive between connections.
|
| 365 |
+
Defaults to True. When True, the subprocess remains active
|
| 366 |
+
after the connection context exits, allowing reuse in
|
| 367 |
+
subsequent connections.
|
| 368 |
"""
|
| 369 |
script_path = Path(script_path).resolve()
|
| 370 |
if not script_path.is_file():
|
|
|
|
| 434 |
env: Environment variables to set for the subprocess
|
| 435 |
cwd: Current working directory for the subprocess
|
| 436 |
node_cmd: Node.js command to use (default: "node")
|
| 437 |
+
keep_alive: Whether to keep the subprocess alive between connections.
|
| 438 |
+
Defaults to True. When True, the subprocess remains active
|
| 439 |
+
after the connection context exits, allowing reuse in
|
| 440 |
+
subsequent connections.
|
| 441 |
"""
|
| 442 |
script_path = Path(script_path).resolve()
|
| 443 |
if not script_path.is_file():
|
|
|
|
| 480 |
with_packages: Additional packages to include
|
| 481 |
from_package: Package to install the tool from
|
| 482 |
env_vars: Additional environment variables
|
| 483 |
+
keep_alive: Whether to keep the subprocess alive between connections.
|
| 484 |
+
Defaults to True. When True, the subprocess remains active
|
| 485 |
+
after the connection context exits, allowing reuse in
|
| 486 |
+
subsequent connections.
|
| 487 |
"""
|
| 488 |
# Basic validation
|
| 489 |
if project_directory and not Path(project_directory).exists():
|
|
|
|
| 542 |
project_directory: Project directory with package.json
|
| 543 |
env_vars: Additional environment variables
|
| 544 |
use_package_lock: Whether to use package-lock.json (--prefer-offline)
|
| 545 |
+
keep_alive: Whether to keep the subprocess alive between connections.
|
| 546 |
+
Defaults to True. When True, the subprocess remains active
|
| 547 |
+
after the connection context exits, allowing reuse in
|
| 548 |
+
subsequent connections.
|
| 549 |
"""
|
| 550 |
# verify npx is installed
|
| 551 |
if shutil.which("npx") is None:
|