mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 13:34:17 +02:00
Update SDK docs (#1236)
This commit is contained in:
parent
aa92491f9d
commit
d408dbc477
25 changed files with 541 additions and 358 deletions
|
|
@ -10,7 +10,7 @@ FastMCP run command implementation with enhanced type hints.
|
|||
|
||||
## Functions
|
||||
|
||||
### `is_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L18" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `is_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
is_url(path: str) -> bool
|
||||
|
|
@ -20,7 +20,7 @@ is_url(path: str) -> bool
|
|||
Check if a string is a URL.
|
||||
|
||||
|
||||
### `parse_file_path` <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>
|
||||
### `parse_file_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L27" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
parse_file_path(server_spec: str) -> tuple[Path, str | None]
|
||||
|
|
@ -36,7 +36,7 @@ Parse a file path that may include a server object specification.
|
|||
- Tuple of (file_path, server_object)
|
||||
|
||||
|
||||
### `import_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `import_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L58" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
import_server(file: Path, server_object: str | None = None) -> Any
|
||||
|
|
@ -53,7 +53,30 @@ Import a MCP server from a file.
|
|||
- The server object
|
||||
|
||||
|
||||
### `create_client_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L125" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `run_with_uv` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L128" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
run_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
|
||||
```
|
||||
|
||||
|
||||
Run a MCP server using uv run subprocess.
|
||||
|
||||
**Args:**
|
||||
- `server_spec`: Python file, object specification (file\:obj), or URL
|
||||
- `python_version`: Python version to use (e.g. "3.10")
|
||||
- `with_packages`: Additional packages to install
|
||||
- `with_requirements`: Requirements file to use
|
||||
- `project`: Run the command within the given project directory
|
||||
- `transport`: Transport protocol to use
|
||||
- `host`: Host to bind to when using http transport
|
||||
- `port`: Port to bind to when using http transport
|
||||
- `path`: Path to bind to when using http transport
|
||||
- `log_level`: Log level
|
||||
- `show_banner`: Whether to show the server banner
|
||||
|
||||
|
||||
### `create_client_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L206" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
create_client_server(url: str) -> Any
|
||||
|
|
@ -69,7 +92,17 @@ Create a FastMCP server from a client URL.
|
|||
- A FastMCP server instance
|
||||
|
||||
|
||||
### `import_server_with_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L145" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `create_mcp_config_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L226" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
create_mcp_config_server(mcp_config_path: Path) -> FastMCP[None]
|
||||
```
|
||||
|
||||
|
||||
Create a FastMCP server from a MCPConfig.
|
||||
|
||||
|
||||
### `import_server_with_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L237" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
import_server_with_args(file: Path, server_object: str | None = None, server_args: list[str] | None = None) -> Any
|
||||
|
|
@ -87,17 +120,17 @@ Import a server with optional command line arguments.
|
|||
- The imported server object
|
||||
|
||||
|
||||
### `run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L169" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L261" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
run_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) -> None
|
||||
run_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
|
||||
```
|
||||
|
||||
|
||||
Run a MCP server or connect to a remote one.
|
||||
|
||||
**Args:**
|
||||
- `server_spec`: Python file, object specification (file\:obj), or URL
|
||||
- `server_spec`: Python file, object specification (file\:obj), MCPConfig file, or URL
|
||||
- `transport`: Transport protocol to use
|
||||
- `host`: Host to bind to when using http transport
|
||||
- `port`: Port to bind to when using http transport
|
||||
|
|
@ -105,4 +138,5 @@ Run a MCP server or connect to a remote one.
|
|||
- `log_level`: Log level
|
||||
- `server_args`: Additional arguments to pass to the server
|
||||
- `show_banner`: Whether to show the server banner
|
||||
- `use_direct_import`: Whether to use direct import instead of subprocess
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue