fastmcp.cli.install.shared
Shared utilities for install commands.
Functions
validate_server_name
quote_windows_batch_argument
.cmd or .bat file.
The result reaches the program that the batch file launches as the
original literal string. This follows the batch file argument quoting in
Rust’s standard library: arguments are wrapped in double quotes so cmd.exe
treats &, |, <, >, ^, parentheses and similar characters as
text, including when the batch file expands them again through %*.
Embedded quotes are doubled, which both cmd.exe and the Microsoft C
runtime read as a literal quote. Each % is rewritten so cmd.exe does not
expand environment variables. Delayed ! expansion is disabled by the
command processor options in windows_batch_command_line.
Raises:
ValueError: If the argument contains a line break. cmd.exe ends the command at a line break, so it cannot be passed literally.
windows_batch_command_line
command[0] is the batch file path and the remaining items are its
arguments. The returned string is passed verbatim to CreateProcess with
cmd.exe as the executable. Command extensions are enabled for the %
handling, delayed expansion and AutoRun commands are disabled, and /s
makes cmd.exe remove exactly the outer pair of quotes.
Raises:
ValueError: If the batch file path or an argument cannot be passed.
run_cli_command
.cmd or .bat file always runs through cmd.exe, which
would otherwise interpret operators and % expansions in the arguments.
For those files the command line is built with
windows_batch_command_line. Other executables, and every executable on
other platforms, receive the argument list directly.
Raises:
subprocess.CalledProcessError: If the command exits with an error.ValueError: If an argument cannot be passed to a batch file.
parse_env_var
process_common_args
open_deeplink
url: The deeplink URL to open.expected_scheme: The URL scheme to validate (e.g. “cursor”, “goose”).
- True if the command succeeded, False otherwise.

