@@ -10,7 +10,7 @@ FastMCP run command implementation with enhanced type hints.
1010
1111## Functions
1212
13- ### ` is_url ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L24 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
13+ ### ` is_url ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L25 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
1414
1515``` python
1616is_url(path: str ) -> bool
@@ -20,7 +20,7 @@ is_url(path: str) -> bool
2020Check if a string is a URL.
2121
2222
23- ### ` parse_file_path ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L30 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
23+ ### ` parse_file_path ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L31 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
2424
2525``` python
2626parse_file_path(server_spec: str ) -> tuple[Path, str | None ]
@@ -36,24 +36,24 @@ Parse a file path that may include a server object specification.
3636- Tuple of (file_path, server_object)
3737
3838
39- ### ` import_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L61 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
39+ ### ` import_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L62 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
4040
4141``` python
42- import_server(file : Path, server_object : str | None = None ) -> Any
42+ import_server(file : Path, server_or_factory : str | None = None ) -> Any
4343```
4444
4545
4646Import a MCP server from a file .
4747
4848** Args:**
4949- ` file ` : Path to the file
50- - ` server_object ` : Optional object name in format "module\: object" or just "object"
50+ - ` server_or_factory ` : Optional object name in format "module\: object" or just "object"
5151
5252** Returns:**
53- - The server object
53+ - The server object (or result of calling a factory function)
5454
5555
56- ### ` run_with_uv ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L131 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
56+ ### ` run_with_uv ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L179 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
5757
5858``` python
5959run_with_uv(server_spec: str , python_version: str | None = None , with_packages: list[str ] | None = None , with_requirements: Path | None = None , project: Path | None = None , transport: TransportType | None = None , host: str | None = None , port: int | None = None , path: str | None = None , log_level: LogLevelType | None = None , show_banner: bool = True ) -> None
@@ -76,7 +76,7 @@ Run a MCP server using uv run subprocess.
7676- ` show_banner ` : Whether to show the server banner
7777
7878
79- ### ` create_client_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L209 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
79+ ### ` create_client_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L257 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
8080
8181``` python
8282create_client_server(url: str ) -> Any
@@ -92,7 +92,7 @@ Create a FastMCP server from a client URL.
9292- A FastMCP server instance
9393
9494
95- ### ` create_mcp_config_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L229 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
95+ ### ` create_mcp_config_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L277 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
9696
9797``` python
9898create_mcp_config_server(mcp_config_path: Path) -> FastMCP[None ]
@@ -102,25 +102,25 @@ create_mcp_config_server(mcp_config_path: Path) -> FastMCP[None]
102102Create a FastMCP server from a MCPConfig.
103103
104104
105- ### ` import_server_with_args ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L240 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
105+ ### ` import_server_with_args ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L288 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
106106
107107``` python
108- import_server_with_args(file : Path, server_object : str | None = None , server_args: list[str ] | None = None ) -> Any
108+ import_server_with_args(file : Path, server_or_factory : str | None = None , server_args: list[str ] | None = None ) -> Any
109109```
110110
111111
112112Import a server with optional command line arguments .
113113
114114** Args:**
115115- ` file ` : Path to the server file
116- - ` server_object ` : Optional server object name
116+ - ` server_or_factory ` : Optional server object or factory function name
117117- ` server_args ` : Optional command line arguments to inject
118118
119119** Returns:**
120120- The imported server object
121121
122122
123- ### ` run_command ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L264 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
123+ ### ` run_command ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L314 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
124124
125125``` python
126126run_command(server_spec: str , transport: TransportType | None = None , host: str | None = None , port: int | None = None , path: str | None = None , log_level: LogLevelType | None = None , server_args: list[str ] | None = None , show_banner: bool = True , use_direct_import: bool = False ) -> None
@@ -141,7 +141,7 @@ Run a MCP server or connect to a remote one.
141141- ` use_direct_import ` : Whether to use direct import instead of subprocess
142142
143143
144- ### ` run_v1_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L329 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
144+ ### ` run_v1_server ` <sup ><a href = " https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L379 " target = " _blank" ><Icon icon = " github" style = " width: 14px; height: 14px;" /></a ></sup >
145145
146146``` python
147147run_v1_server(server: FastMCP1x, host: str | None = None , port: int | None = None , transport: TransportType | None = None ) -> None
0 commit comments