Spaces:
Running
Running
zzstoatzz commited on
Commit Β·
7f20f81
1
Parent(s): 4d79f55
regen api ref
Browse files- docs/python-sdk/fastmcp-cli-claude.mdx +2 -2
- docs/python-sdk/fastmcp-cli-cli.mdx +5 -5
- docs/python-sdk/fastmcp-cli-run.mdx +6 -6
- docs/python-sdk/fastmcp-client-auth-bearer.mdx +2 -2
- docs/python-sdk/fastmcp-client-auth-oauth.mdx +9 -9
- docs/python-sdk/fastmcp-client-client.mdx +6 -6
- docs/python-sdk/fastmcp-client-logging.mdx +1 -1
- docs/python-sdk/fastmcp-client-oauth_callback.mdx +5 -5
- docs/python-sdk/fastmcp-client-roots.mdx +2 -2
- docs/python-sdk/fastmcp-client-sampling.mdx +1 -1
- docs/python-sdk/fastmcp-client-transports.mdx +14 -14
- docs/python-sdk/fastmcp-exceptions.mdx +9 -9
- docs/python-sdk/fastmcp-prompts-prompt.mdx +7 -7
- docs/python-sdk/fastmcp-prompts-prompt_manager.mdx +4 -4
- docs/python-sdk/fastmcp-resources-resource.mdx +8 -8
- docs/python-sdk/fastmcp-resources-resource_manager.mdx +7 -7
- docs/python-sdk/fastmcp-resources-template.mdx +11 -11
- docs/python-sdk/fastmcp-resources-types.mdx +9 -9
- docs/python-sdk/fastmcp-server-auth-auth.mdx +1 -1
- docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx +6 -6
- docs/python-sdk/fastmcp-server-auth-providers-bearer_env.mdx +2 -2
- docs/python-sdk/fastmcp-server-auth-providers-in_memory.mdx +1 -1
- docs/python-sdk/fastmcp-server-context.mdx +8 -8
- docs/python-sdk/fastmcp-server-dependencies.mdx +3 -3
- docs/python-sdk/fastmcp-server-http.mdx +8 -8
- docs/python-sdk/fastmcp-server-middleware-error_handling.mdx +3 -3
- docs/python-sdk/fastmcp-server-middleware-logging.mdx +2 -2
- docs/python-sdk/fastmcp-server-middleware-middleware.mdx +11 -11
- docs/python-sdk/fastmcp-server-middleware-rate_limiting.mdx +5 -5
- docs/python-sdk/fastmcp-server-middleware-timing.mdx +2 -2
- docs/python-sdk/fastmcp-server-openapi.mdx +7 -7
- docs/python-sdk/fastmcp-server-proxy.mdx +12 -12
- docs/python-sdk/fastmcp-server-server.mdx +32 -32
- docs/python-sdk/fastmcp-settings.mdx +7 -7
- docs/python-sdk/fastmcp-tools-tool.mdx +9 -9
- docs/python-sdk/fastmcp-tools-tool_manager.mdx +5 -5
- docs/python-sdk/fastmcp-tools-tool_transform.mdx +3 -3
- docs/python-sdk/fastmcp-utilities-cache.mdx +4 -4
- docs/python-sdk/fastmcp-utilities-components.mdx +5 -5
- docs/python-sdk/fastmcp-utilities-exceptions.mdx +2 -2
- docs/python-sdk/fastmcp-utilities-http.mdx +1 -1
- docs/python-sdk/fastmcp-utilities-inspect.mdx +5 -5
- docs/python-sdk/fastmcp-utilities-json_schema.mdx +1 -1
- docs/python-sdk/fastmcp-utilities-logging.mdx +2 -2
- docs/python-sdk/fastmcp-utilities-mcp_config.mdx +7 -7
- docs/python-sdk/fastmcp-utilities-openapi.mdx +11 -11
- docs/python-sdk/fastmcp-utilities-tests.mdx +2 -2
- docs/python-sdk/fastmcp-utilities-types.mdx +11 -11
docs/python-sdk/fastmcp-cli-claude.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Claude app integration utilities.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `get_claude_config_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L14"
|
| 14 |
|
| 15 |
```python
|
| 16 |
get_claude_config_path() -> Path | None
|
|
@@ -20,7 +20,7 @@ get_claude_config_path() -> Path | None
|
|
| 20 |
Get the Claude config directory based on platform.
|
| 21 |
|
| 22 |
|
| 23 |
-
### `update_claude_config` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L32"
|
| 24 |
|
| 25 |
```python
|
| 26 |
update_claude_config(file_spec: str, server_name: str) -> bool
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `get_claude_config_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L14"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
get_claude_config_path() -> Path | None
|
|
|
|
| 20 |
Get the Claude config directory based on platform.
|
| 21 |
|
| 22 |
|
| 23 |
+
### `update_claude_config` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L32"><Icon icon="github" size="14" /></a></sup>
|
| 24 |
|
| 25 |
```python
|
| 26 |
update_claude_config(file_spec: str, server_name: str) -> bool
|
docs/python-sdk/fastmcp-cli-cli.mdx
CHANGED
|
@@ -10,13 +10,13 @@ FastMCP CLI tools.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `version` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L87"
|
| 14 |
|
| 15 |
```python
|
| 16 |
version(ctx: Context)
|
| 17 |
```
|
| 18 |
|
| 19 |
-
### `dev` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L110"
|
| 20 |
|
| 21 |
```python
|
| 22 |
dev(server_spec: str = typer.Argument(..., help='Python file to run, optionally with :object suffix'), with_editable: Annotated[Path | None, typer.Option('--with-editable', '-e', help='Directory containing pyproject.toml to install in editable mode', exists=True, file_okay=False, resolve_path=True)] = None, with_packages: Annotated[list[str], typer.Option('--with', help='Additional packages to install')] = [], inspector_version: Annotated[str | None, typer.Option('--inspector-version', help='Version of the MCP Inspector to use')] = None, ui_port: Annotated[int | None, typer.Option('--ui-port', help='Port for the MCP Inspector UI')] = None, server_port: Annotated[int | None, typer.Option('--server-port', help='Port for the MCP Inspector Proxy server')] = None) -> None
|
|
@@ -26,7 +26,7 @@ dev(server_spec: str = typer.Argument(..., help='Python file to run, optionally
|
|
| 26 |
Run a MCP server with the MCP Inspector.
|
| 27 |
|
| 28 |
|
| 29 |
-
### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L227"
|
| 30 |
|
| 31 |
```python
|
| 32 |
run(ctx: typer.Context, server_spec: str = typer.Argument(..., help='Python file, object specification (file:obj), or URL'), transport: Annotated[str | None, typer.Option('--transport', '-t', help='Transport protocol to use (stdio, http, or sse)')] = None, host: Annotated[str | None, typer.Option('--host', help='Host to bind to when using http transport (default: 127.0.0.1)')] = None, port: Annotated[int | None, typer.Option('--port', '-p', help='Port to bind to when using http transport (default: 8000)')] = None, log_level: Annotated[str | None, typer.Option('--log-level', '-l', help='Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)')] = None) -> None
|
|
@@ -51,7 +51,7 @@ Server arguments can be passed after -- :
|
|
| 51 |
fastmcp run server.py -- --config config.json --debug
|
| 52 |
|
| 53 |
|
| 54 |
-
### `install` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L313"
|
| 55 |
|
| 56 |
```python
|
| 57 |
install(server_spec: str = typer.Argument(..., help='Python file to run, optionally with :object suffix'), server_name: Annotated[str | None, typer.Option('--name', '-n', help="Custom name for the server (defaults to server's name attribute or file name)")] = None, with_editable: Annotated[Path | None, typer.Option('--with-editable', '-e', help='Directory containing pyproject.toml to install in editable mode', exists=True, file_okay=False, resolve_path=True)] = None, with_packages: Annotated[list[str], typer.Option('--with', help='Additional packages to install')] = [], env_vars: Annotated[list[str], typer.Option('--env-var', '-v', help='Environment variables in KEY=VALUE format')] = [], env_file: Annotated[Path | None, typer.Option('--env-file', '-f', help='Load environment variables from a .env file', exists=True, file_okay=True, dir_okay=False, resolve_path=True)] = None) -> None
|
|
@@ -64,7 +64,7 @@ Environment variables are preserved once added and only updated if new values
|
|
| 64 |
are explicitly provided.
|
| 65 |
|
| 66 |
|
| 67 |
-
### `inspect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L444"
|
| 68 |
|
| 69 |
```python
|
| 70 |
inspect(server_spec: str = typer.Argument(..., help='Python file to inspect, optionally with :object suffix'), output: Annotated[Path, typer.Option('--output', '-o', help='Output file path for the JSON report (default: server-info.json)')] = Path('server-info.json')) -> None
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `version` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L87"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
version(ctx: Context)
|
| 17 |
```
|
| 18 |
|
| 19 |
+
### `dev` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L110"><Icon icon="github" size="14" /></a></sup>
|
| 20 |
|
| 21 |
```python
|
| 22 |
dev(server_spec: str = typer.Argument(..., help='Python file to run, optionally with :object suffix'), with_editable: Annotated[Path | None, typer.Option('--with-editable', '-e', help='Directory containing pyproject.toml to install in editable mode', exists=True, file_okay=False, resolve_path=True)] = None, with_packages: Annotated[list[str], typer.Option('--with', help='Additional packages to install')] = [], inspector_version: Annotated[str | None, typer.Option('--inspector-version', help='Version of the MCP Inspector to use')] = None, ui_port: Annotated[int | None, typer.Option('--ui-port', help='Port for the MCP Inspector UI')] = None, server_port: Annotated[int | None, typer.Option('--server-port', help='Port for the MCP Inspector Proxy server')] = None) -> None
|
|
|
|
| 26 |
Run a MCP server with the MCP Inspector.
|
| 27 |
|
| 28 |
|
| 29 |
+
### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L227"><Icon icon="github" size="14" /></a></sup>
|
| 30 |
|
| 31 |
```python
|
| 32 |
run(ctx: typer.Context, server_spec: str = typer.Argument(..., help='Python file, object specification (file:obj), or URL'), transport: Annotated[str | None, typer.Option('--transport', '-t', help='Transport protocol to use (stdio, http, or sse)')] = None, host: Annotated[str | None, typer.Option('--host', help='Host to bind to when using http transport (default: 127.0.0.1)')] = None, port: Annotated[int | None, typer.Option('--port', '-p', help='Port to bind to when using http transport (default: 8000)')] = None, log_level: Annotated[str | None, typer.Option('--log-level', '-l', help='Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)')] = None) -> None
|
|
|
|
| 51 |
fastmcp run server.py -- --config config.json --debug
|
| 52 |
|
| 53 |
|
| 54 |
+
### `install` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L313"><Icon icon="github" size="14" /></a></sup>
|
| 55 |
|
| 56 |
```python
|
| 57 |
install(server_spec: str = typer.Argument(..., help='Python file to run, optionally with :object suffix'), server_name: Annotated[str | None, typer.Option('--name', '-n', help="Custom name for the server (defaults to server's name attribute or file name)")] = None, with_editable: Annotated[Path | None, typer.Option('--with-editable', '-e', help='Directory containing pyproject.toml to install in editable mode', exists=True, file_okay=False, resolve_path=True)] = None, with_packages: Annotated[list[str], typer.Option('--with', help='Additional packages to install')] = [], env_vars: Annotated[list[str], typer.Option('--env-var', '-v', help='Environment variables in KEY=VALUE format')] = [], env_file: Annotated[Path | None, typer.Option('--env-file', '-f', help='Load environment variables from a .env file', exists=True, file_okay=True, dir_okay=False, resolve_path=True)] = None) -> None
|
|
|
|
| 64 |
are explicitly provided.
|
| 65 |
|
| 66 |
|
| 67 |
+
### `inspect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L444"><Icon icon="github" size="14" /></a></sup>
|
| 68 |
|
| 69 |
```python
|
| 70 |
inspect(server_spec: str = typer.Argument(..., help='Python file to inspect, optionally with :object suffix'), output: Annotated[Path, typer.Option('--output', '-o', help='Output file path for the JSON report (default: server-info.json)')] = Path('server-info.json')) -> None
|
docs/python-sdk/fastmcp-cli-run.mdx
CHANGED
|
@@ -10,7 +10,7 @@ FastMCP run command implementation.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `is_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L14"
|
| 14 |
|
| 15 |
```python
|
| 16 |
is_url(path: str) -> bool
|
|
@@ -20,7 +20,7 @@ is_url(path: str) -> bool
|
|
| 20 |
Check if a string is a URL.
|
| 21 |
|
| 22 |
|
| 23 |
-
### `parse_file_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L20"
|
| 24 |
|
| 25 |
```python
|
| 26 |
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.
|
|
| 36 |
- Tuple of (file_path, server_object)
|
| 37 |
|
| 38 |
|
| 39 |
-
### `import_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L51"
|
| 40 |
|
| 41 |
```python
|
| 42 |
import_server(file: Path, server_object: str | None = None) -> Any
|
|
@@ -53,7 +53,7 @@ Import a MCP server from a file.
|
|
| 53 |
- The server object
|
| 54 |
|
| 55 |
|
| 56 |
-
### `create_client_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L121"
|
| 57 |
|
| 58 |
```python
|
| 59 |
create_client_server(url: str) -> Any
|
|
@@ -69,7 +69,7 @@ Create a FastMCP server from a client URL.
|
|
| 69 |
- A FastMCP server instance
|
| 70 |
|
| 71 |
|
| 72 |
-
### `import_server_with_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L141"
|
| 73 |
|
| 74 |
```python
|
| 75 |
import_server_with_args(file: Path, server_object: str | None = None, server_args: list[str] | None = None) -> Any
|
|
@@ -87,7 +87,7 @@ Import a server with optional command line arguments.
|
|
| 87 |
- The imported server object
|
| 88 |
|
| 89 |
|
| 90 |
-
### `run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L165"
|
| 91 |
|
| 92 |
```python
|
| 93 |
run_command(server_spec: str, transport: str | None = None, host: str | None = None, port: int | None = None, log_level: str | None = None, server_args: list[str] | None = None) -> None
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `is_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L14"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
is_url(path: str) -> bool
|
|
|
|
| 20 |
Check if a string is a URL.
|
| 21 |
|
| 22 |
|
| 23 |
+
### `parse_file_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L20"><Icon icon="github" size="14" /></a></sup>
|
| 24 |
|
| 25 |
```python
|
| 26 |
parse_file_path(server_spec: str) -> tuple[Path, str | None]
|
|
|
|
| 36 |
- Tuple of (file_path, server_object)
|
| 37 |
|
| 38 |
|
| 39 |
+
### `import_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L51"><Icon icon="github" size="14" /></a></sup>
|
| 40 |
|
| 41 |
```python
|
| 42 |
import_server(file: Path, server_object: str | None = None) -> Any
|
|
|
|
| 53 |
- The server object
|
| 54 |
|
| 55 |
|
| 56 |
+
### `create_client_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L121"><Icon icon="github" size="14" /></a></sup>
|
| 57 |
|
| 58 |
```python
|
| 59 |
create_client_server(url: str) -> Any
|
|
|
|
| 69 |
- A FastMCP server instance
|
| 70 |
|
| 71 |
|
| 72 |
+
### `import_server_with_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L141"><Icon icon="github" size="14" /></a></sup>
|
| 73 |
|
| 74 |
```python
|
| 75 |
import_server_with_args(file: Path, server_object: str | None = None, server_args: list[str] | None = None) -> Any
|
|
|
|
| 87 |
- The imported server object
|
| 88 |
|
| 89 |
|
| 90 |
+
### `run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L165"><Icon icon="github" size="14" /></a></sup>
|
| 91 |
|
| 92 |
```python
|
| 93 |
run_command(server_spec: str, transport: str | None = None, host: str | None = None, port: int | None = None, log_level: str | None = None, server_args: list[str] | None = None) -> None
|
docs/python-sdk/fastmcp-client-auth-bearer.mdx
CHANGED
|
@@ -7,11 +7,11 @@ sidebarTitle: bearer
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `BearerAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L11"
|
| 11 |
|
| 12 |
**Methods:**
|
| 13 |
|
| 14 |
-
#### `auth_flow` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L15"
|
| 15 |
|
| 16 |
```python
|
| 17 |
auth_flow(self, request)
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `BearerAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L11"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
**Methods:**
|
| 13 |
|
| 14 |
+
#### `auth_flow` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L15"><Icon icon="github" size="14" /></a></sup>
|
| 15 |
|
| 16 |
```python
|
| 17 |
auth_flow(self, request)
|
docs/python-sdk/fastmcp-client-auth-oauth.mdx
CHANGED
|
@@ -7,13 +7,13 @@ sidebarTitle: oauth
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `default_cache_dir` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L38"
|
| 11 |
|
| 12 |
```python
|
| 13 |
default_cache_dir() -> Path
|
| 14 |
```
|
| 15 |
|
| 16 |
-
### `OAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L295"
|
| 17 |
|
| 18 |
```python
|
| 19 |
OAuth(mcp_url: str, scopes: str | list[str] | None = None, client_name: str = 'FastMCP Client', token_storage_cache_dir: Path | None = None, additional_client_metadata: dict[str, Any] | None = None) -> _MCPOAuthClientProvider
|
|
@@ -38,7 +38,7 @@ httpx.AsyncClient (or appropriate FastMCP client/transport instance)
|
|
| 38 |
|
| 39 |
## Classes
|
| 40 |
|
| 41 |
-
### `ServerOAuthMetadata` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L43"
|
| 42 |
|
| 43 |
|
| 44 |
More flexible OAuth metadata model that accepts broader ranges of values
|
|
@@ -48,13 +48,13 @@ This handles real-world OAuth servers like PayPal that may support
|
|
| 48 |
additional methods not in the MCP specification.
|
| 49 |
|
| 50 |
|
| 51 |
-
### `OAuthClientProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L68"
|
| 52 |
|
| 53 |
|
| 54 |
OAuth client provider with more flexible OAuth metadata discovery.
|
| 55 |
|
| 56 |
|
| 57 |
-
### `FileTokenStorage` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L116"
|
| 58 |
|
| 59 |
|
| 60 |
File-based token storage implementation for OAuth credentials and tokens.
|
|
@@ -65,7 +65,7 @@ Each instance is tied to a specific server URL for proper token isolation.
|
|
| 65 |
|
| 66 |
**Methods:**
|
| 67 |
|
| 68 |
-
#### `get_base_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L131"
|
| 69 |
|
| 70 |
```python
|
| 71 |
get_base_url(url: str) -> str
|
|
@@ -74,7 +74,7 @@ get_base_url(url: str) -> str
|
|
| 74 |
Extract the base URL (scheme + host) from a URL.
|
| 75 |
|
| 76 |
|
| 77 |
-
#### `get_cache_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L136"
|
| 78 |
|
| 79 |
```python
|
| 80 |
get_cache_key(self) -> str
|
|
@@ -83,7 +83,7 @@ get_cache_key(self) -> str
|
|
| 83 |
Generate a safe filesystem key from the server's base URL.
|
| 84 |
|
| 85 |
|
| 86 |
-
#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L208"
|
| 87 |
|
| 88 |
```python
|
| 89 |
clear(self) -> None
|
|
@@ -92,7 +92,7 @@ clear(self) -> None
|
|
| 92 |
Clear all cached data for this server.
|
| 93 |
|
| 94 |
|
| 95 |
-
#### `clear_all` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L217"
|
| 96 |
|
| 97 |
```python
|
| 98 |
clear_all(cls, cache_dir: Path | None = None) -> None
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `default_cache_dir` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L38"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
default_cache_dir() -> Path
|
| 14 |
```
|
| 15 |
|
| 16 |
+
### `OAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L295"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
```python
|
| 19 |
OAuth(mcp_url: str, scopes: str | list[str] | None = None, client_name: str = 'FastMCP Client', token_storage_cache_dir: Path | None = None, additional_client_metadata: dict[str, Any] | None = None) -> _MCPOAuthClientProvider
|
|
|
|
| 38 |
|
| 39 |
## Classes
|
| 40 |
|
| 41 |
+
### `ServerOAuthMetadata` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L43"><Icon icon="github" size="14" /></a></sup>
|
| 42 |
|
| 43 |
|
| 44 |
More flexible OAuth metadata model that accepts broader ranges of values
|
|
|
|
| 48 |
additional methods not in the MCP specification.
|
| 49 |
|
| 50 |
|
| 51 |
+
### `OAuthClientProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L68"><Icon icon="github" size="14" /></a></sup>
|
| 52 |
|
| 53 |
|
| 54 |
OAuth client provider with more flexible OAuth metadata discovery.
|
| 55 |
|
| 56 |
|
| 57 |
+
### `FileTokenStorage` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L116"><Icon icon="github" size="14" /></a></sup>
|
| 58 |
|
| 59 |
|
| 60 |
File-based token storage implementation for OAuth credentials and tokens.
|
|
|
|
| 65 |
|
| 66 |
**Methods:**
|
| 67 |
|
| 68 |
+
#### `get_base_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L131"><Icon icon="github" size="14" /></a></sup>
|
| 69 |
|
| 70 |
```python
|
| 71 |
get_base_url(url: str) -> str
|
|
|
|
| 74 |
Extract the base URL (scheme + host) from a URL.
|
| 75 |
|
| 76 |
|
| 77 |
+
#### `get_cache_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L136"><Icon icon="github" size="14" /></a></sup>
|
| 78 |
|
| 79 |
```python
|
| 80 |
get_cache_key(self) -> str
|
|
|
|
| 83 |
Generate a safe filesystem key from the server's base URL.
|
| 84 |
|
| 85 |
|
| 86 |
+
#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L208"><Icon icon="github" size="14" /></a></sup>
|
| 87 |
|
| 88 |
```python
|
| 89 |
clear(self) -> None
|
|
|
|
| 92 |
Clear all cached data for this server.
|
| 93 |
|
| 94 |
|
| 95 |
+
#### `clear_all` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L217"><Icon icon="github" size="14" /></a></sup>
|
| 96 |
|
| 97 |
```python
|
| 98 |
clear_all(cls, cache_dir: Path | None = None) -> None
|
docs/python-sdk/fastmcp-client-client.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: client
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `Client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L60"
|
| 11 |
|
| 12 |
|
| 13 |
MCP client that delegates connection management to a Transport instance.
|
|
@@ -48,7 +48,7 @@ async with client:
|
|
| 48 |
|
| 49 |
**Methods:**
|
| 50 |
|
| 51 |
-
#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L207"
|
| 52 |
|
| 53 |
```python
|
| 54 |
session(self) -> ClientSession
|
|
@@ -57,7 +57,7 @@ session(self) -> ClientSession
|
|
| 57 |
Get the current active session. Raises RuntimeError if not connected.
|
| 58 |
|
| 59 |
|
| 60 |
-
#### `initialize_result` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L217"
|
| 61 |
|
| 62 |
```python
|
| 63 |
initialize_result(self) -> mcp.types.InitializeResult
|
|
@@ -66,7 +66,7 @@ initialize_result(self) -> mcp.types.InitializeResult
|
|
| 66 |
Get the result of the initialization request.
|
| 67 |
|
| 68 |
|
| 69 |
-
#### `set_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L225"
|
| 70 |
|
| 71 |
```python
|
| 72 |
set_roots(self, roots: RootsList | RootsHandler) -> None
|
|
@@ -75,7 +75,7 @@ set_roots(self, roots: RootsList | RootsHandler) -> None
|
|
| 75 |
Set the roots for the client. This does not automatically call `send_roots_list_changed`.
|
| 76 |
|
| 77 |
|
| 78 |
-
#### `set_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L229"
|
| 79 |
|
| 80 |
```python
|
| 81 |
set_sampling_callback(self, sampling_callback: SamplingHandler) -> None
|
|
@@ -84,7 +84,7 @@ set_sampling_callback(self, sampling_callback: SamplingHandler) -> None
|
|
| 84 |
Set the sampling callback for the client.
|
| 85 |
|
| 86 |
|
| 87 |
-
#### `is_connected` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L235"
|
| 88 |
|
| 89 |
```python
|
| 90 |
is_connected(self) -> bool
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `Client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L60"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
MCP client that delegates connection management to a Transport instance.
|
|
|
|
| 48 |
|
| 49 |
**Methods:**
|
| 50 |
|
| 51 |
+
#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L207"><Icon icon="github" size="14" /></a></sup>
|
| 52 |
|
| 53 |
```python
|
| 54 |
session(self) -> ClientSession
|
|
|
|
| 57 |
Get the current active session. Raises RuntimeError if not connected.
|
| 58 |
|
| 59 |
|
| 60 |
+
#### `initialize_result` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L217"><Icon icon="github" size="14" /></a></sup>
|
| 61 |
|
| 62 |
```python
|
| 63 |
initialize_result(self) -> mcp.types.InitializeResult
|
|
|
|
| 66 |
Get the result of the initialization request.
|
| 67 |
|
| 68 |
|
| 69 |
+
#### `set_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L225"><Icon icon="github" size="14" /></a></sup>
|
| 70 |
|
| 71 |
```python
|
| 72 |
set_roots(self, roots: RootsList | RootsHandler) -> None
|
|
|
|
| 75 |
Set the roots for the client. This does not automatically call `send_roots_list_changed`.
|
| 76 |
|
| 77 |
|
| 78 |
+
#### `set_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L229"><Icon icon="github" size="14" /></a></sup>
|
| 79 |
|
| 80 |
```python
|
| 81 |
set_sampling_callback(self, sampling_callback: SamplingHandler) -> None
|
|
|
|
| 84 |
Set the sampling callback for the client.
|
| 85 |
|
| 86 |
|
| 87 |
+
#### `is_connected` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L235"><Icon icon="github" size="14" /></a></sup>
|
| 88 |
|
| 89 |
```python
|
| 90 |
is_connected(self) -> bool
|
docs/python-sdk/fastmcp-client-logging.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: logging
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `create_log_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/logging.py#L20"
|
| 11 |
|
| 12 |
```python
|
| 13 |
create_log_callback(handler: LogHandler | None = None) -> LoggingFnT
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `create_log_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/logging.py#L20"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
create_log_callback(handler: LogHandler | None = None) -> LoggingFnT
|
docs/python-sdk/fastmcp-client-oauth_callback.mdx
CHANGED
|
@@ -15,7 +15,7 @@ and display styled responses to users.
|
|
| 15 |
|
| 16 |
## Functions
|
| 17 |
|
| 18 |
-
### `create_callback_html` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L25"
|
| 19 |
|
| 20 |
```python
|
| 21 |
create_callback_html(message: str, is_success: bool = True, title: str = 'FastMCP OAuth', server_url: str | None = None) -> str
|
|
@@ -25,7 +25,7 @@ create_callback_html(message: str, is_success: bool = True, title: str = 'FastMC
|
|
| 25 |
Create a styled HTML response for OAuth callbacks.
|
| 26 |
|
| 27 |
|
| 28 |
-
### `create_oauth_callback_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L197"
|
| 29 |
|
| 30 |
```python
|
| 31 |
create_oauth_callback_server(port: int, callback_path: str = '/callback', server_url: str | None = None, response_future: asyncio.Future | None = None) -> Server
|
|
@@ -46,17 +46,17 @@ Create an OAuth callback server.
|
|
| 46 |
|
| 47 |
## Classes
|
| 48 |
|
| 49 |
-
### `CallbackResponse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L183"
|
| 50 |
|
| 51 |
**Methods:**
|
| 52 |
|
| 53 |
-
#### `from_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L190"
|
| 54 |
|
| 55 |
```python
|
| 56 |
from_dict(cls, data: dict[str, str]) -> CallbackResponse
|
| 57 |
```
|
| 58 |
|
| 59 |
-
#### `to_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L193"
|
| 60 |
|
| 61 |
```python
|
| 62 |
to_dict(self) -> dict[str, str]
|
|
|
|
| 15 |
|
| 16 |
## Functions
|
| 17 |
|
| 18 |
+
### `create_callback_html` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L25"><Icon icon="github" size="14" /></a></sup>
|
| 19 |
|
| 20 |
```python
|
| 21 |
create_callback_html(message: str, is_success: bool = True, title: str = 'FastMCP OAuth', server_url: str | None = None) -> str
|
|
|
|
| 25 |
Create a styled HTML response for OAuth callbacks.
|
| 26 |
|
| 27 |
|
| 28 |
+
### `create_oauth_callback_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L197"><Icon icon="github" size="14" /></a></sup>
|
| 29 |
|
| 30 |
```python
|
| 31 |
create_oauth_callback_server(port: int, callback_path: str = '/callback', server_url: str | None = None, response_future: asyncio.Future | None = None) -> Server
|
|
|
|
| 46 |
|
| 47 |
## Classes
|
| 48 |
|
| 49 |
+
### `CallbackResponse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L183"><Icon icon="github" size="14" /></a></sup>
|
| 50 |
|
| 51 |
**Methods:**
|
| 52 |
|
| 53 |
+
#### `from_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L190"><Icon icon="github" size="14" /></a></sup>
|
| 54 |
|
| 55 |
```python
|
| 56 |
from_dict(cls, data: dict[str, str]) -> CallbackResponse
|
| 57 |
```
|
| 58 |
|
| 59 |
+
#### `to_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L193"><Icon icon="github" size="14" /></a></sup>
|
| 60 |
|
| 61 |
```python
|
| 62 |
to_dict(self) -> dict[str, str]
|
docs/python-sdk/fastmcp-client-roots.mdx
CHANGED
|
@@ -7,13 +7,13 @@ sidebarTitle: roots
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `convert_roots_list` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L19"
|
| 11 |
|
| 12 |
```python
|
| 13 |
convert_roots_list(roots: RootsList) -> list[mcp.types.Root]
|
| 14 |
```
|
| 15 |
|
| 16 |
-
### `create_roots_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L33"
|
| 17 |
|
| 18 |
```python
|
| 19 |
create_roots_callback(handler: RootsList | RootsHandler) -> ListRootsFnT
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `convert_roots_list` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L19"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
convert_roots_list(roots: RootsList) -> list[mcp.types.Root]
|
| 14 |
```
|
| 15 |
|
| 16 |
+
### `create_roots_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L33"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
```python
|
| 19 |
create_roots_callback(handler: RootsList | RootsHandler) -> ListRootsFnT
|
docs/python-sdk/fastmcp-client-sampling.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: sampling
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `create_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/sampling.py#L25"
|
| 11 |
|
| 12 |
```python
|
| 13 |
create_sampling_callback(sampling_handler: SamplingHandler) -> SamplingFnT
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `create_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/sampling.py#L25"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
create_sampling_callback(sampling_handler: SamplingHandler) -> SamplingFnT
|
docs/python-sdk/fastmcp-client-transports.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: transports
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `infer_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L837"
|
| 11 |
|
| 12 |
```python
|
| 13 |
infer_transport(transport: ClientTransport | FastMCP | FastMCP1Server | AnyUrl | Path | MCPConfig | dict[str, Any] | str) -> ClientTransport
|
|
@@ -57,13 +57,13 @@ transport = infer_transport(config)
|
|
| 57 |
|
| 58 |
## Classes
|
| 59 |
|
| 60 |
-
### `SessionKwargs` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L52"
|
| 61 |
|
| 62 |
|
| 63 |
Keyword arguments for the MCP ClientSession constructor.
|
| 64 |
|
| 65 |
|
| 66 |
-
### `ClientTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L63"
|
| 67 |
|
| 68 |
|
| 69 |
Abstract base class for different MCP client transport mechanisms.
|
|
@@ -72,25 +72,25 @@ A Transport is responsible for establishing and managing connections
|
|
| 72 |
to an MCP server, and providing a ClientSession within an async context.
|
| 73 |
|
| 74 |
|
| 75 |
-
### `WSTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L109"
|
| 76 |
|
| 77 |
|
| 78 |
Transport implementation that connects to an MCP server via WebSockets.
|
| 79 |
|
| 80 |
|
| 81 |
-
### `SSETransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L148"
|
| 82 |
|
| 83 |
|
| 84 |
Transport implementation that connects to an MCP server via Server-Sent Events.
|
| 85 |
|
| 86 |
|
| 87 |
-
### `StreamableHttpTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L223"
|
| 88 |
|
| 89 |
|
| 90 |
Transport implementation that connects to an MCP server via Streamable HTTP Requests.
|
| 91 |
|
| 92 |
|
| 93 |
-
### `StdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L299"
|
| 94 |
|
| 95 |
|
| 96 |
Base transport for connecting to an MCP server via subprocess with stdio.
|
|
@@ -99,37 +99,37 @@ This is a base class that can be subclassed for specific command-based
|
|
| 99 |
transports like Python, Node, Uvx, etc.
|
| 100 |
|
| 101 |
|
| 102 |
-
### `PythonStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L416"
|
| 103 |
|
| 104 |
|
| 105 |
Transport for running Python scripts.
|
| 106 |
|
| 107 |
|
| 108 |
-
### `FastMCPStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L462"
|
| 109 |
|
| 110 |
|
| 111 |
Transport for running FastMCP servers using the FastMCP CLI.
|
| 112 |
|
| 113 |
|
| 114 |
-
### `NodeStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L489"
|
| 115 |
|
| 116 |
|
| 117 |
Transport for running Node.js scripts.
|
| 118 |
|
| 119 |
|
| 120 |
-
### `UvxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L531"
|
| 121 |
|
| 122 |
|
| 123 |
Transport for running commands via the uvx tool.
|
| 124 |
|
| 125 |
|
| 126 |
-
### `NpxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L597"
|
| 127 |
|
| 128 |
|
| 129 |
Transport for running commands via the npx tool.
|
| 130 |
|
| 131 |
|
| 132 |
-
### `FastMCPTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L659"
|
| 133 |
|
| 134 |
|
| 135 |
In-memory transport for FastMCP servers.
|
|
@@ -140,7 +140,7 @@ servers from the low-level MCP SDK. This is particularly useful for unit
|
|
| 140 |
tests or scenarios where client and server run in the same runtime.
|
| 141 |
|
| 142 |
|
| 143 |
-
### `MCPConfigTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L713"
|
| 144 |
|
| 145 |
|
| 146 |
Transport for connecting to one or more MCP servers defined in an MCPConfig.
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `infer_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L837"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
infer_transport(transport: ClientTransport | FastMCP | FastMCP1Server | AnyUrl | Path | MCPConfig | dict[str, Any] | str) -> ClientTransport
|
|
|
|
| 57 |
|
| 58 |
## Classes
|
| 59 |
|
| 60 |
+
### `SessionKwargs` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L52"><Icon icon="github" size="14" /></a></sup>
|
| 61 |
|
| 62 |
|
| 63 |
Keyword arguments for the MCP ClientSession constructor.
|
| 64 |
|
| 65 |
|
| 66 |
+
### `ClientTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L63"><Icon icon="github" size="14" /></a></sup>
|
| 67 |
|
| 68 |
|
| 69 |
Abstract base class for different MCP client transport mechanisms.
|
|
|
|
| 72 |
to an MCP server, and providing a ClientSession within an async context.
|
| 73 |
|
| 74 |
|
| 75 |
+
### `WSTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L109"><Icon icon="github" size="14" /></a></sup>
|
| 76 |
|
| 77 |
|
| 78 |
Transport implementation that connects to an MCP server via WebSockets.
|
| 79 |
|
| 80 |
|
| 81 |
+
### `SSETransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L148"><Icon icon="github" size="14" /></a></sup>
|
| 82 |
|
| 83 |
|
| 84 |
Transport implementation that connects to an MCP server via Server-Sent Events.
|
| 85 |
|
| 86 |
|
| 87 |
+
### `StreamableHttpTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L223"><Icon icon="github" size="14" /></a></sup>
|
| 88 |
|
| 89 |
|
| 90 |
Transport implementation that connects to an MCP server via Streamable HTTP Requests.
|
| 91 |
|
| 92 |
|
| 93 |
+
### `StdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L299"><Icon icon="github" size="14" /></a></sup>
|
| 94 |
|
| 95 |
|
| 96 |
Base transport for connecting to an MCP server via subprocess with stdio.
|
|
|
|
| 99 |
transports like Python, Node, Uvx, etc.
|
| 100 |
|
| 101 |
|
| 102 |
+
### `PythonStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L416"><Icon icon="github" size="14" /></a></sup>
|
| 103 |
|
| 104 |
|
| 105 |
Transport for running Python scripts.
|
| 106 |
|
| 107 |
|
| 108 |
+
### `FastMCPStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L462"><Icon icon="github" size="14" /></a></sup>
|
| 109 |
|
| 110 |
|
| 111 |
Transport for running FastMCP servers using the FastMCP CLI.
|
| 112 |
|
| 113 |
|
| 114 |
+
### `NodeStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L489"><Icon icon="github" size="14" /></a></sup>
|
| 115 |
|
| 116 |
|
| 117 |
Transport for running Node.js scripts.
|
| 118 |
|
| 119 |
|
| 120 |
+
### `UvxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L531"><Icon icon="github" size="14" /></a></sup>
|
| 121 |
|
| 122 |
|
| 123 |
Transport for running commands via the uvx tool.
|
| 124 |
|
| 125 |
|
| 126 |
+
### `NpxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L597"><Icon icon="github" size="14" /></a></sup>
|
| 127 |
|
| 128 |
|
| 129 |
Transport for running commands via the npx tool.
|
| 130 |
|
| 131 |
|
| 132 |
+
### `FastMCPTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L659"><Icon icon="github" size="14" /></a></sup>
|
| 133 |
|
| 134 |
|
| 135 |
In-memory transport for FastMCP servers.
|
|
|
|
| 140 |
tests or scenarios where client and server run in the same runtime.
|
| 141 |
|
| 142 |
|
| 143 |
+
### `MCPConfigTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L713"><Icon icon="github" size="14" /></a></sup>
|
| 144 |
|
| 145 |
|
| 146 |
Transport for connecting to one or more MCP servers defined in an MCPConfig.
|
docs/python-sdk/fastmcp-exceptions.mdx
CHANGED
|
@@ -10,55 +10,55 @@ Custom exceptions for FastMCP.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `FastMCPError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L6"
|
| 14 |
|
| 15 |
|
| 16 |
Base error for FastMCP.
|
| 17 |
|
| 18 |
|
| 19 |
-
### `ValidationError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L10"
|
| 20 |
|
| 21 |
|
| 22 |
Error in validating parameters or return values.
|
| 23 |
|
| 24 |
|
| 25 |
-
### `ResourceError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L14"
|
| 26 |
|
| 27 |
|
| 28 |
Error in resource operations.
|
| 29 |
|
| 30 |
|
| 31 |
-
### `ToolError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L18"
|
| 32 |
|
| 33 |
|
| 34 |
Error in tool operations.
|
| 35 |
|
| 36 |
|
| 37 |
-
### `PromptError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L22"
|
| 38 |
|
| 39 |
|
| 40 |
Error in prompt operations.
|
| 41 |
|
| 42 |
|
| 43 |
-
### `InvalidSignature` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L26"
|
| 44 |
|
| 45 |
|
| 46 |
Invalid signature for use with FastMCP.
|
| 47 |
|
| 48 |
|
| 49 |
-
### `ClientError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L30"
|
| 50 |
|
| 51 |
|
| 52 |
Error in client operations.
|
| 53 |
|
| 54 |
|
| 55 |
-
### `NotFoundError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L34"
|
| 56 |
|
| 57 |
|
| 58 |
Object not found.
|
| 59 |
|
| 60 |
|
| 61 |
-
### `DisabledError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L38"
|
| 62 |
|
| 63 |
|
| 64 |
Object is disabled.
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `FastMCPError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L6"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Base error for FastMCP.
|
| 17 |
|
| 18 |
|
| 19 |
+
### `ValidationError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L10"><Icon icon="github" size="14" /></a></sup>
|
| 20 |
|
| 21 |
|
| 22 |
Error in validating parameters or return values.
|
| 23 |
|
| 24 |
|
| 25 |
+
### `ResourceError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L14"><Icon icon="github" size="14" /></a></sup>
|
| 26 |
|
| 27 |
|
| 28 |
Error in resource operations.
|
| 29 |
|
| 30 |
|
| 31 |
+
### `ToolError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L18"><Icon icon="github" size="14" /></a></sup>
|
| 32 |
|
| 33 |
|
| 34 |
Error in tool operations.
|
| 35 |
|
| 36 |
|
| 37 |
+
### `PromptError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L22"><Icon icon="github" size="14" /></a></sup>
|
| 38 |
|
| 39 |
|
| 40 |
Error in prompt operations.
|
| 41 |
|
| 42 |
|
| 43 |
+
### `InvalidSignature` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L26"><Icon icon="github" size="14" /></a></sup>
|
| 44 |
|
| 45 |
|
| 46 |
Invalid signature for use with FastMCP.
|
| 47 |
|
| 48 |
|
| 49 |
+
### `ClientError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L30"><Icon icon="github" size="14" /></a></sup>
|
| 50 |
|
| 51 |
|
| 52 |
Error in client operations.
|
| 53 |
|
| 54 |
|
| 55 |
+
### `NotFoundError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L34"><Icon icon="github" size="14" /></a></sup>
|
| 56 |
|
| 57 |
|
| 58 |
Object not found.
|
| 59 |
|
| 60 |
|
| 61 |
+
### `DisabledError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L38"><Icon icon="github" size="14" /></a></sup>
|
| 62 |
|
| 63 |
|
| 64 |
Object is disabled.
|
docs/python-sdk/fastmcp-prompts-prompt.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Base classes for FastMCP prompts.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `Message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L32"
|
| 14 |
|
| 15 |
```python
|
| 16 |
Message(content: str | MCPContent, role: Role | None = None, **kwargs: Any) -> PromptMessage
|
|
@@ -22,13 +22,13 @@ A user-friendly constructor for PromptMessage.
|
|
| 22 |
|
| 23 |
## Classes
|
| 24 |
|
| 25 |
-
### `PromptArgument` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L54"
|
| 26 |
|
| 27 |
|
| 28 |
An argument that can be passed to a prompt.
|
| 29 |
|
| 30 |
|
| 31 |
-
### `Prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L66"
|
| 32 |
|
| 33 |
|
| 34 |
A prompt template that can be rendered with parameters.
|
|
@@ -36,7 +36,7 @@ A prompt template that can be rendered with parameters.
|
|
| 36 |
|
| 37 |
**Methods:**
|
| 38 |
|
| 39 |
-
#### `to_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L73"
|
| 40 |
|
| 41 |
```python
|
| 42 |
to_mcp_prompt(self, **overrides: Any) -> MCPPrompt
|
|
@@ -45,7 +45,7 @@ to_mcp_prompt(self, **overrides: Any) -> MCPPrompt
|
|
| 45 |
Convert the prompt to an MCP prompt.
|
| 46 |
|
| 47 |
|
| 48 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L91"
|
| 49 |
|
| 50 |
```python
|
| 51 |
from_function(fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt
|
|
@@ -60,7 +60,7 @@ The function can return:
|
|
| 60 |
- A sequence of any of the above
|
| 61 |
|
| 62 |
|
| 63 |
-
### `FunctionPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L119"
|
| 64 |
|
| 65 |
|
| 66 |
A prompt that is a function.
|
|
@@ -68,7 +68,7 @@ A prompt that is a function.
|
|
| 68 |
|
| 69 |
**Methods:**
|
| 70 |
|
| 71 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L125"
|
| 72 |
|
| 73 |
```python
|
| 74 |
from_function(cls, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `Message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L32"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
Message(content: str | MCPContent, role: Role | None = None, **kwargs: Any) -> PromptMessage
|
|
|
|
| 22 |
|
| 23 |
## Classes
|
| 24 |
|
| 25 |
+
### `PromptArgument` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L54"><Icon icon="github" size="14" /></a></sup>
|
| 26 |
|
| 27 |
|
| 28 |
An argument that can be passed to a prompt.
|
| 29 |
|
| 30 |
|
| 31 |
+
### `Prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L66"><Icon icon="github" size="14" /></a></sup>
|
| 32 |
|
| 33 |
|
| 34 |
A prompt template that can be rendered with parameters.
|
|
|
|
| 36 |
|
| 37 |
**Methods:**
|
| 38 |
|
| 39 |
+
#### `to_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L73"><Icon icon="github" size="14" /></a></sup>
|
| 40 |
|
| 41 |
```python
|
| 42 |
to_mcp_prompt(self, **overrides: Any) -> MCPPrompt
|
|
|
|
| 45 |
Convert the prompt to an MCP prompt.
|
| 46 |
|
| 47 |
|
| 48 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L91"><Icon icon="github" size="14" /></a></sup>
|
| 49 |
|
| 50 |
```python
|
| 51 |
from_function(fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt
|
|
|
|
| 60 |
- A sequence of any of the above
|
| 61 |
|
| 62 |
|
| 63 |
+
### `FunctionPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L119"><Icon icon="github" size="14" /></a></sup>
|
| 64 |
|
| 65 |
|
| 66 |
A prompt that is a function.
|
|
|
|
| 68 |
|
| 69 |
**Methods:**
|
| 70 |
|
| 71 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L125"><Icon icon="github" size="14" /></a></sup>
|
| 72 |
|
| 73 |
```python
|
| 74 |
from_function(cls, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt
|
docs/python-sdk/fastmcp-prompts-prompt_manager.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: prompt_manager
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `PromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L21"
|
| 11 |
|
| 12 |
|
| 13 |
Manages FastMCP prompts.
|
|
@@ -15,7 +15,7 @@ Manages FastMCP prompts.
|
|
| 15 |
|
| 16 |
**Methods:**
|
| 17 |
|
| 18 |
-
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L45"
|
| 19 |
|
| 20 |
```python
|
| 21 |
mount(self, server: MountedServer) -> None
|
|
@@ -24,7 +24,7 @@ mount(self, server: MountedServer) -> None
|
|
| 24 |
Adds a mounted server as a source for prompts.
|
| 25 |
|
| 26 |
|
| 27 |
-
#### `add_prompt_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L114"
|
| 28 |
|
| 29 |
```python
|
| 30 |
add_prompt_from_fn(self, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None) -> FunctionPrompt
|
|
@@ -33,7 +33,7 @@ add_prompt_from_fn(self, fn: Callable[..., PromptResult | Awaitable[PromptResult
|
|
| 33 |
Create a prompt from a function.
|
| 34 |
|
| 35 |
|
| 36 |
-
#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L134"
|
| 37 |
|
| 38 |
```python
|
| 39 |
add_prompt(self, prompt: Prompt) -> Prompt
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `PromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L21"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
Manages FastMCP prompts.
|
|
|
|
| 15 |
|
| 16 |
**Methods:**
|
| 17 |
|
| 18 |
+
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L45"><Icon icon="github" size="14" /></a></sup>
|
| 19 |
|
| 20 |
```python
|
| 21 |
mount(self, server: MountedServer) -> None
|
|
|
|
| 24 |
Adds a mounted server as a source for prompts.
|
| 25 |
|
| 26 |
|
| 27 |
+
#### `add_prompt_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L114"><Icon icon="github" size="14" /></a></sup>
|
| 28 |
|
| 29 |
```python
|
| 30 |
add_prompt_from_fn(self, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None) -> FunctionPrompt
|
|
|
|
| 33 |
Create a prompt from a function.
|
| 34 |
|
| 35 |
|
| 36 |
+
#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L134"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
add_prompt(self, prompt: Prompt) -> Prompt
|
docs/python-sdk/fastmcp-resources-resource.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Base classes and interfaces for FastMCP resources.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `Resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L32"
|
| 14 |
|
| 15 |
|
| 16 |
Base class for all resources.
|
|
@@ -18,13 +18,13 @@ Base class for all resources.
|
|
| 18 |
|
| 19 |
**Methods:**
|
| 20 |
|
| 21 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L48"
|
| 22 |
|
| 23 |
```python
|
| 24 |
from_function(fn: Callable[[], Any], uri: str | AnyUrl, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource
|
| 25 |
```
|
| 26 |
|
| 27 |
-
#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L69"
|
| 28 |
|
| 29 |
```python
|
| 30 |
set_default_mime_type(cls, mime_type: str | None) -> str
|
|
@@ -33,7 +33,7 @@ set_default_mime_type(cls, mime_type: str | None) -> str
|
|
| 33 |
Set default MIME type if not provided.
|
| 34 |
|
| 35 |
|
| 36 |
-
#### `set_default_name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L76"
|
| 37 |
|
| 38 |
```python
|
| 39 |
set_default_name(self) -> Self
|
|
@@ -42,7 +42,7 @@ set_default_name(self) -> Self
|
|
| 42 |
Set default name from URI if not provided.
|
| 43 |
|
| 44 |
|
| 45 |
-
#### `to_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L91"
|
| 46 |
|
| 47 |
```python
|
| 48 |
to_mcp_resource(self, **overrides: Any) -> MCPResource
|
|
@@ -51,7 +51,7 @@ to_mcp_resource(self, **overrides: Any) -> MCPResource
|
|
| 51 |
Convert the resource to an MCPResource.
|
| 52 |
|
| 53 |
|
| 54 |
-
#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L105"
|
| 55 |
|
| 56 |
```python
|
| 57 |
key(self) -> str
|
|
@@ -63,7 +63,7 @@ keys having a certain value, as the same tool loaded from different
|
|
| 63 |
hierarchies of servers may have different keys.
|
| 64 |
|
| 65 |
|
| 66 |
-
### `FunctionResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L115"
|
| 67 |
|
| 68 |
|
| 69 |
A resource that defers data loading by wrapping a function.
|
|
@@ -80,7 +80,7 @@ The function can return:
|
|
| 80 |
|
| 81 |
**Methods:**
|
| 82 |
|
| 83 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L131"
|
| 84 |
|
| 85 |
```python
|
| 86 |
from_function(cls, fn: Callable[[], Any], uri: str | AnyUrl, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `Resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L32"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Base class for all resources.
|
|
|
|
| 18 |
|
| 19 |
**Methods:**
|
| 20 |
|
| 21 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L48"><Icon icon="github" size="14" /></a></sup>
|
| 22 |
|
| 23 |
```python
|
| 24 |
from_function(fn: Callable[[], Any], uri: str | AnyUrl, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource
|
| 25 |
```
|
| 26 |
|
| 27 |
+
#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L69"><Icon icon="github" size="14" /></a></sup>
|
| 28 |
|
| 29 |
```python
|
| 30 |
set_default_mime_type(cls, mime_type: str | None) -> str
|
|
|
|
| 33 |
Set default MIME type if not provided.
|
| 34 |
|
| 35 |
|
| 36 |
+
#### `set_default_name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L76"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
set_default_name(self) -> Self
|
|
|
|
| 42 |
Set default name from URI if not provided.
|
| 43 |
|
| 44 |
|
| 45 |
+
#### `to_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L91"><Icon icon="github" size="14" /></a></sup>
|
| 46 |
|
| 47 |
```python
|
| 48 |
to_mcp_resource(self, **overrides: Any) -> MCPResource
|
|
|
|
| 51 |
Convert the resource to an MCPResource.
|
| 52 |
|
| 53 |
|
| 54 |
+
#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L105"><Icon icon="github" size="14" /></a></sup>
|
| 55 |
|
| 56 |
```python
|
| 57 |
key(self) -> str
|
|
|
|
| 63 |
hierarchies of servers may have different keys.
|
| 64 |
|
| 65 |
|
| 66 |
+
### `FunctionResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L115"><Icon icon="github" size="14" /></a></sup>
|
| 67 |
|
| 68 |
|
| 69 |
A resource that defers data loading by wrapping a function.
|
|
|
|
| 80 |
|
| 81 |
**Methods:**
|
| 82 |
|
| 83 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L131"><Icon icon="github" size="14" /></a></sup>
|
| 84 |
|
| 85 |
```python
|
| 86 |
from_function(cls, fn: Callable[[], Any], uri: str | AnyUrl, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource
|
docs/python-sdk/fastmcp-resources-resource_manager.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Resource manager functionality.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `ResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L28"
|
| 14 |
|
| 15 |
|
| 16 |
Manages FastMCP resources.
|
|
@@ -18,7 +18,7 @@ Manages FastMCP resources.
|
|
| 18 |
|
| 19 |
**Methods:**
|
| 20 |
|
| 21 |
-
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L60"
|
| 22 |
|
| 23 |
```python
|
| 24 |
mount(self, server: MountedServer) -> None
|
|
@@ -27,7 +27,7 @@ mount(self, server: MountedServer) -> None
|
|
| 27 |
Adds a mounted server as a source for resources and templates.
|
| 28 |
|
| 29 |
|
| 30 |
-
#### `add_resource_or_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L182"
|
| 31 |
|
| 32 |
```python
|
| 33 |
add_resource_or_template_from_fn(self, fn: Callable[..., Any], uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> Resource | ResourceTemplate
|
|
@@ -48,7 +48,7 @@ Add a resource or template to the manager from a function.
|
|
| 48 |
- returns the existing resource or template.
|
| 49 |
|
| 50 |
|
| 51 |
-
#### `add_resource_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L230"
|
| 52 |
|
| 53 |
```python
|
| 54 |
add_resource_from_fn(self, fn: Callable[..., Any], uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> Resource
|
|
@@ -69,7 +69,7 @@ Add a resource to the manager from a function.
|
|
| 69 |
- returns the existing resource.
|
| 70 |
|
| 71 |
|
| 72 |
-
#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L270"
|
| 73 |
|
| 74 |
```python
|
| 75 |
add_resource(self, resource: Resource) -> Resource
|
|
@@ -83,7 +83,7 @@ will be used as the storage key. To overwrite it, call
|
|
| 83 |
Resource.with_key() before calling this method.
|
| 84 |
|
| 85 |
|
| 86 |
-
#### `add_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L292"
|
| 87 |
|
| 88 |
```python
|
| 89 |
add_template_from_fn(self, fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> ResourceTemplate
|
|
@@ -92,7 +92,7 @@ add_template_from_fn(self, fn: Callable[..., Any], uri_template: str, name: str
|
|
| 92 |
Create a template from a function.
|
| 93 |
|
| 94 |
|
| 95 |
-
#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L319"
|
| 96 |
|
| 97 |
```python
|
| 98 |
add_template(self, template: ResourceTemplate) -> ResourceTemplate
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `ResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L28"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Manages FastMCP resources.
|
|
|
|
| 18 |
|
| 19 |
**Methods:**
|
| 20 |
|
| 21 |
+
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L60"><Icon icon="github" size="14" /></a></sup>
|
| 22 |
|
| 23 |
```python
|
| 24 |
mount(self, server: MountedServer) -> None
|
|
|
|
| 27 |
Adds a mounted server as a source for resources and templates.
|
| 28 |
|
| 29 |
|
| 30 |
+
#### `add_resource_or_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L182"><Icon icon="github" size="14" /></a></sup>
|
| 31 |
|
| 32 |
```python
|
| 33 |
add_resource_or_template_from_fn(self, fn: Callable[..., Any], uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> Resource | ResourceTemplate
|
|
|
|
| 48 |
- returns the existing resource or template.
|
| 49 |
|
| 50 |
|
| 51 |
+
#### `add_resource_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L230"><Icon icon="github" size="14" /></a></sup>
|
| 52 |
|
| 53 |
```python
|
| 54 |
add_resource_from_fn(self, fn: Callable[..., Any], uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> Resource
|
|
|
|
| 69 |
- returns the existing resource.
|
| 70 |
|
| 71 |
|
| 72 |
+
#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L270"><Icon icon="github" size="14" /></a></sup>
|
| 73 |
|
| 74 |
```python
|
| 75 |
add_resource(self, resource: Resource) -> Resource
|
|
|
|
| 83 |
Resource.with_key() before calling this method.
|
| 84 |
|
| 85 |
|
| 86 |
+
#### `add_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L292"><Icon icon="github" size="14" /></a></sup>
|
| 87 |
|
| 88 |
```python
|
| 89 |
add_template_from_fn(self, fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> ResourceTemplate
|
|
|
|
| 92 |
Create a template from a function.
|
| 93 |
|
| 94 |
|
| 95 |
+
#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L319"><Icon icon="github" size="14" /></a></sup>
|
| 96 |
|
| 97 |
```python
|
| 98 |
add_template(self, template: ResourceTemplate) -> ResourceTemplate
|
docs/python-sdk/fastmcp-resources-template.mdx
CHANGED
|
@@ -10,13 +10,13 @@ Resource template functionality.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `build_regex` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L28"
|
| 14 |
|
| 15 |
```python
|
| 16 |
build_regex(template: str) -> re.Pattern
|
| 17 |
```
|
| 18 |
|
| 19 |
-
### `match_uri_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L44"
|
| 20 |
|
| 21 |
```python
|
| 22 |
match_uri_template(uri: str, uri_template: str) -> dict[str, str] | None
|
|
@@ -24,7 +24,7 @@ match_uri_template(uri: str, uri_template: str) -> dict[str, str] | None
|
|
| 24 |
|
| 25 |
## Classes
|
| 26 |
|
| 27 |
-
### `ResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L52"
|
| 28 |
|
| 29 |
|
| 30 |
A template for dynamically creating resources.
|
|
@@ -32,13 +32,13 @@ A template for dynamically creating resources.
|
|
| 32 |
|
| 33 |
**Methods:**
|
| 34 |
|
| 35 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L69"
|
| 36 |
|
| 37 |
```python
|
| 38 |
from_function(fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate
|
| 39 |
```
|
| 40 |
|
| 41 |
-
#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L90"
|
| 42 |
|
| 43 |
```python
|
| 44 |
set_default_mime_type(cls, mime_type: str | None) -> str
|
|
@@ -47,7 +47,7 @@ set_default_mime_type(cls, mime_type: str | None) -> str
|
|
| 47 |
Set default MIME type if not provided.
|
| 48 |
|
| 49 |
|
| 50 |
-
#### `matches` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L96"
|
| 51 |
|
| 52 |
```python
|
| 53 |
matches(self, uri: str) -> dict[str, Any] | None
|
|
@@ -56,7 +56,7 @@ matches(self, uri: str) -> dict[str, Any] | None
|
|
| 56 |
Check if URI matches template and extract parameters.
|
| 57 |
|
| 58 |
|
| 59 |
-
#### `to_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L124"
|
| 60 |
|
| 61 |
```python
|
| 62 |
to_mcp_template(self, **overrides: Any) -> MCPResourceTemplate
|
|
@@ -65,7 +65,7 @@ to_mcp_template(self, **overrides: Any) -> MCPResourceTemplate
|
|
| 65 |
Convert the resource template to an MCPResourceTemplate.
|
| 66 |
|
| 67 |
|
| 68 |
-
#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L135"
|
| 69 |
|
| 70 |
```python
|
| 71 |
from_mcp_template(cls, mcp_template: MCPResourceTemplate) -> ResourceTemplate
|
|
@@ -74,7 +74,7 @@ from_mcp_template(cls, mcp_template: MCPResourceTemplate) -> ResourceTemplate
|
|
| 74 |
Creates a FastMCP ResourceTemplate from a raw MCP ResourceTemplate object.
|
| 75 |
|
| 76 |
|
| 77 |
-
#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L148"
|
| 78 |
|
| 79 |
```python
|
| 80 |
key(self) -> str
|
|
@@ -86,7 +86,7 @@ keys having a certain value, as the same tool loaded from different
|
|
| 86 |
hierarchies of servers may have different keys.
|
| 87 |
|
| 88 |
|
| 89 |
-
### `FunctionResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L158"
|
| 90 |
|
| 91 |
|
| 92 |
A template for dynamically creating resources.
|
|
@@ -94,7 +94,7 @@ A template for dynamically creating resources.
|
|
| 94 |
|
| 95 |
**Methods:**
|
| 96 |
|
| 97 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L179"
|
| 98 |
|
| 99 |
```python
|
| 100 |
from_function(cls, fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `build_regex` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L28"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
build_regex(template: str) -> re.Pattern
|
| 17 |
```
|
| 18 |
|
| 19 |
+
### `match_uri_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L44"><Icon icon="github" size="14" /></a></sup>
|
| 20 |
|
| 21 |
```python
|
| 22 |
match_uri_template(uri: str, uri_template: str) -> dict[str, str] | None
|
|
|
|
| 24 |
|
| 25 |
## Classes
|
| 26 |
|
| 27 |
+
### `ResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L52"><Icon icon="github" size="14" /></a></sup>
|
| 28 |
|
| 29 |
|
| 30 |
A template for dynamically creating resources.
|
|
|
|
| 32 |
|
| 33 |
**Methods:**
|
| 34 |
|
| 35 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L69"><Icon icon="github" size="14" /></a></sup>
|
| 36 |
|
| 37 |
```python
|
| 38 |
from_function(fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate
|
| 39 |
```
|
| 40 |
|
| 41 |
+
#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L90"><Icon icon="github" size="14" /></a></sup>
|
| 42 |
|
| 43 |
```python
|
| 44 |
set_default_mime_type(cls, mime_type: str | None) -> str
|
|
|
|
| 47 |
Set default MIME type if not provided.
|
| 48 |
|
| 49 |
|
| 50 |
+
#### `matches` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L96"><Icon icon="github" size="14" /></a></sup>
|
| 51 |
|
| 52 |
```python
|
| 53 |
matches(self, uri: str) -> dict[str, Any] | None
|
|
|
|
| 56 |
Check if URI matches template and extract parameters.
|
| 57 |
|
| 58 |
|
| 59 |
+
#### `to_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L124"><Icon icon="github" size="14" /></a></sup>
|
| 60 |
|
| 61 |
```python
|
| 62 |
to_mcp_template(self, **overrides: Any) -> MCPResourceTemplate
|
|
|
|
| 65 |
Convert the resource template to an MCPResourceTemplate.
|
| 66 |
|
| 67 |
|
| 68 |
+
#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L135"><Icon icon="github" size="14" /></a></sup>
|
| 69 |
|
| 70 |
```python
|
| 71 |
from_mcp_template(cls, mcp_template: MCPResourceTemplate) -> ResourceTemplate
|
|
|
|
| 74 |
Creates a FastMCP ResourceTemplate from a raw MCP ResourceTemplate object.
|
| 75 |
|
| 76 |
|
| 77 |
+
#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L148"><Icon icon="github" size="14" /></a></sup>
|
| 78 |
|
| 79 |
```python
|
| 80 |
key(self) -> str
|
|
|
|
| 86 |
hierarchies of servers may have different keys.
|
| 87 |
|
| 88 |
|
| 89 |
+
### `FunctionResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L158"><Icon icon="github" size="14" /></a></sup>
|
| 90 |
|
| 91 |
|
| 92 |
A template for dynamically creating resources.
|
|
|
|
| 94 |
|
| 95 |
**Methods:**
|
| 96 |
|
| 97 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L179"><Icon icon="github" size="14" /></a></sup>
|
| 98 |
|
| 99 |
```python
|
| 100 |
from_function(cls, fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate
|
docs/python-sdk/fastmcp-resources-types.mdx
CHANGED
|
@@ -10,19 +10,19 @@ Concrete resource implementations.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `TextResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L21"
|
| 14 |
|
| 15 |
|
| 16 |
A resource that reads from a string.
|
| 17 |
|
| 18 |
|
| 19 |
-
### `BinaryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L31"
|
| 20 |
|
| 21 |
|
| 22 |
A resource that reads from bytes.
|
| 23 |
|
| 24 |
|
| 25 |
-
### `FileResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L41"
|
| 26 |
|
| 27 |
|
| 28 |
A resource that reads from a file.
|
|
@@ -32,7 +32,7 @@ Set is_binary=True to read file as binary data instead of text.
|
|
| 32 |
|
| 33 |
**Methods:**
|
| 34 |
|
| 35 |
-
#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L59"
|
| 36 |
|
| 37 |
```python
|
| 38 |
validate_absolute_path(cls, path: Path) -> Path
|
|
@@ -41,7 +41,7 @@ validate_absolute_path(cls, path: Path) -> Path
|
|
| 41 |
Ensure path is absolute.
|
| 42 |
|
| 43 |
|
| 44 |
-
#### `set_binary_from_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L67"
|
| 45 |
|
| 46 |
```python
|
| 47 |
set_binary_from_mime_type(cls, is_binary: bool, info: ValidationInfo) -> bool
|
|
@@ -50,13 +50,13 @@ set_binary_from_mime_type(cls, is_binary: bool, info: ValidationInfo) -> bool
|
|
| 50 |
Set is_binary based on mime_type if not explicitly set.
|
| 51 |
|
| 52 |
|
| 53 |
-
### `HttpResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L84"
|
| 54 |
|
| 55 |
|
| 56 |
A resource that reads from an HTTP endpoint.
|
| 57 |
|
| 58 |
|
| 59 |
-
### `DirectoryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L100"
|
| 60 |
|
| 61 |
|
| 62 |
A resource that lists files in a directory.
|
|
@@ -64,7 +64,7 @@ A resource that lists files in a directory.
|
|
| 64 |
|
| 65 |
**Methods:**
|
| 66 |
|
| 67 |
-
#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L116"
|
| 68 |
|
| 69 |
```python
|
| 70 |
validate_absolute_path(cls, path: Path) -> Path
|
|
@@ -73,7 +73,7 @@ validate_absolute_path(cls, path: Path) -> Path
|
|
| 73 |
Ensure path is absolute.
|
| 74 |
|
| 75 |
|
| 76 |
-
#### `list_files` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L122"
|
| 77 |
|
| 78 |
```python
|
| 79 |
list_files(self) -> list[Path]
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `TextResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L21"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
A resource that reads from a string.
|
| 17 |
|
| 18 |
|
| 19 |
+
### `BinaryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L31"><Icon icon="github" size="14" /></a></sup>
|
| 20 |
|
| 21 |
|
| 22 |
A resource that reads from bytes.
|
| 23 |
|
| 24 |
|
| 25 |
+
### `FileResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L41"><Icon icon="github" size="14" /></a></sup>
|
| 26 |
|
| 27 |
|
| 28 |
A resource that reads from a file.
|
|
|
|
| 32 |
|
| 33 |
**Methods:**
|
| 34 |
|
| 35 |
+
#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L59"><Icon icon="github" size="14" /></a></sup>
|
| 36 |
|
| 37 |
```python
|
| 38 |
validate_absolute_path(cls, path: Path) -> Path
|
|
|
|
| 41 |
Ensure path is absolute.
|
| 42 |
|
| 43 |
|
| 44 |
+
#### `set_binary_from_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L67"><Icon icon="github" size="14" /></a></sup>
|
| 45 |
|
| 46 |
```python
|
| 47 |
set_binary_from_mime_type(cls, is_binary: bool, info: ValidationInfo) -> bool
|
|
|
|
| 50 |
Set is_binary based on mime_type if not explicitly set.
|
| 51 |
|
| 52 |
|
| 53 |
+
### `HttpResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L84"><Icon icon="github" size="14" /></a></sup>
|
| 54 |
|
| 55 |
|
| 56 |
A resource that reads from an HTTP endpoint.
|
| 57 |
|
| 58 |
|
| 59 |
+
### `DirectoryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L100"><Icon icon="github" size="14" /></a></sup>
|
| 60 |
|
| 61 |
|
| 62 |
A resource that lists files in a directory.
|
|
|
|
| 64 |
|
| 65 |
**Methods:**
|
| 66 |
|
| 67 |
+
#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L116"><Icon icon="github" size="14" /></a></sup>
|
| 68 |
|
| 69 |
```python
|
| 70 |
validate_absolute_path(cls, path: Path) -> Path
|
|
|
|
| 73 |
Ensure path is absolute.
|
| 74 |
|
| 75 |
|
| 76 |
+
#### `list_files` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L122"><Icon icon="github" size="14" /></a></sup>
|
| 77 |
|
| 78 |
```python
|
| 79 |
list_files(self) -> list[Path]
|
docs/python-sdk/fastmcp-server-auth-auth.mdx
CHANGED
|
@@ -7,4 +7,4 @@ sidebarTitle: auth
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `OAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/auth.py#L14"
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `OAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/auth.py#L14"><Icon icon="github" size="14" /></a></sup>
|
docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx
CHANGED
|
@@ -7,23 +7,23 @@ sidebarTitle: bearer
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `JWKData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L29"
|
| 11 |
|
| 12 |
|
| 13 |
JSON Web Key data structure.
|
| 14 |
|
| 15 |
|
| 16 |
-
### `JWKSData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L42"
|
| 17 |
|
| 18 |
|
| 19 |
JSON Web Key Set data structure.
|
| 20 |
|
| 21 |
|
| 22 |
-
### `RSAKeyPair` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L49"
|
| 23 |
|
| 24 |
**Methods:**
|
| 25 |
|
| 26 |
-
#### `generate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L54"
|
| 27 |
|
| 28 |
```python
|
| 29 |
generate(cls) -> 'RSAKeyPair'
|
|
@@ -35,7 +35,7 @@ Generate an RSA key pair for testing.
|
|
| 35 |
- (private_key_pem, public_key_pem)
|
| 36 |
|
| 37 |
|
| 38 |
-
#### `create_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L88"
|
| 39 |
|
| 40 |
```python
|
| 41 |
create_token(self, subject: str = 'fastmcp-user', issuer: str = 'https://fastmcp.example.com', audience: str | list[str] | None = None, scopes: list[str] | None = None, expires_in_seconds: int = 3600, additional_claims: dict[str, Any] | None = None, kid: str | None = None) -> str
|
|
@@ -57,7 +57,7 @@ Generate a test JWT token for testing purposes.
|
|
| 57 |
- Signed JWT token string
|
| 58 |
|
| 59 |
|
| 60 |
-
### `BearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L149"
|
| 61 |
|
| 62 |
|
| 63 |
Simple JWT Bearer Token validator for hosted MCP servers.
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `JWKData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L29"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
JSON Web Key data structure.
|
| 14 |
|
| 15 |
|
| 16 |
+
### `JWKSData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L42"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
|
| 19 |
JSON Web Key Set data structure.
|
| 20 |
|
| 21 |
|
| 22 |
+
### `RSAKeyPair` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L49"><Icon icon="github" size="14" /></a></sup>
|
| 23 |
|
| 24 |
**Methods:**
|
| 25 |
|
| 26 |
+
#### `generate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L54"><Icon icon="github" size="14" /></a></sup>
|
| 27 |
|
| 28 |
```python
|
| 29 |
generate(cls) -> 'RSAKeyPair'
|
|
|
|
| 35 |
- (private_key_pem, public_key_pem)
|
| 36 |
|
| 37 |
|
| 38 |
+
#### `create_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L88"><Icon icon="github" size="14" /></a></sup>
|
| 39 |
|
| 40 |
```python
|
| 41 |
create_token(self, subject: str = 'fastmcp-user', issuer: str = 'https://fastmcp.example.com', audience: str | list[str] | None = None, scopes: list[str] | None = None, expires_in_seconds: int = 3600, additional_claims: dict[str, Any] | None = None, kid: str | None = None) -> str
|
|
|
|
| 57 |
- Signed JWT token string
|
| 58 |
|
| 59 |
|
| 60 |
+
### `BearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L149"><Icon icon="github" size="14" /></a></sup>
|
| 61 |
|
| 62 |
|
| 63 |
Simple JWT Bearer Token validator for hosted MCP servers.
|
docs/python-sdk/fastmcp-server-auth-providers-bearer_env.mdx
CHANGED
|
@@ -7,13 +7,13 @@ sidebarTitle: bearer_env
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `EnvBearerAuthProviderSettings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L8"
|
| 11 |
|
| 12 |
|
| 13 |
Settings for the BearerAuthProvider.
|
| 14 |
|
| 15 |
|
| 16 |
-
### `EnvBearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L24"
|
| 17 |
|
| 18 |
|
| 19 |
A BearerAuthProvider that loads settings from environment variables. Any
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `EnvBearerAuthProviderSettings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L8"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
Settings for the BearerAuthProvider.
|
| 14 |
|
| 15 |
|
| 16 |
+
### `EnvBearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L24"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
|
| 19 |
A BearerAuthProvider that loads settings from environment variables. Any
|
docs/python-sdk/fastmcp-server-auth-providers-in_memory.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: in_memory
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `InMemoryOAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L31"
|
| 11 |
|
| 12 |
|
| 13 |
An in-memory OAuth provider for testing purposes.
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `InMemoryOAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L31"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
An in-memory OAuth provider for testing purposes.
|
docs/python-sdk/fastmcp-server-context.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: context
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `set_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L36"
|
| 11 |
|
| 12 |
```python
|
| 13 |
set_context(context: Context) -> Generator[Context, None, None]
|
|
@@ -15,7 +15,7 @@ set_context(context: Context) -> Generator[Context, None, None]
|
|
| 15 |
|
| 16 |
## Classes
|
| 17 |
|
| 18 |
-
### `Context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L45"
|
| 19 |
|
| 20 |
|
| 21 |
Context object providing access to MCP capabilities.
|
|
@@ -53,7 +53,7 @@ The context is optional - tools that don't need it can omit the parameter.
|
|
| 53 |
|
| 54 |
**Methods:**
|
| 55 |
|
| 56 |
-
#### `request_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L98"
|
| 57 |
|
| 58 |
```python
|
| 59 |
request_context(self) -> RequestContext
|
|
@@ -64,7 +64,7 @@ Access to the underlying request context.
|
|
| 64 |
If called outside of a request context, this will raise a ValueError.
|
| 65 |
|
| 66 |
|
| 67 |
-
#### `client_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L168"
|
| 68 |
|
| 69 |
```python
|
| 70 |
client_id(self) -> str | None
|
|
@@ -73,7 +73,7 @@ client_id(self) -> str | None
|
|
| 73 |
Get the client ID if available.
|
| 74 |
|
| 75 |
|
| 76 |
-
#### `request_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L177"
|
| 77 |
|
| 78 |
```python
|
| 79 |
request_id(self) -> str
|
|
@@ -82,7 +82,7 @@ request_id(self) -> str
|
|
| 82 |
Get the unique ID for this request.
|
| 83 |
|
| 84 |
|
| 85 |
-
#### `session_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L182"
|
| 86 |
|
| 87 |
```python
|
| 88 |
session_id(self) -> str | None
|
|
@@ -99,7 +99,7 @@ the same client session.
|
|
| 99 |
- for stdio and in-memory transports which don't use session IDs.
|
| 100 |
|
| 101 |
|
| 102 |
-
#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L213"
|
| 103 |
|
| 104 |
```python
|
| 105 |
session(self)
|
|
@@ -108,7 +108,7 @@ session(self)
|
|
| 108 |
Access to the underlying session for advanced usage.
|
| 109 |
|
| 110 |
|
| 111 |
-
#### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L282"
|
| 112 |
|
| 113 |
```python
|
| 114 |
get_http_request(self) -> Request
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `set_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L36"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
set_context(context: Context) -> Generator[Context, None, None]
|
|
|
|
| 15 |
|
| 16 |
## Classes
|
| 17 |
|
| 18 |
+
### `Context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L45"><Icon icon="github" size="14" /></a></sup>
|
| 19 |
|
| 20 |
|
| 21 |
Context object providing access to MCP capabilities.
|
|
|
|
| 53 |
|
| 54 |
**Methods:**
|
| 55 |
|
| 56 |
+
#### `request_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L98"><Icon icon="github" size="14" /></a></sup>
|
| 57 |
|
| 58 |
```python
|
| 59 |
request_context(self) -> RequestContext
|
|
|
|
| 64 |
If called outside of a request context, this will raise a ValueError.
|
| 65 |
|
| 66 |
|
| 67 |
+
#### `client_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L168"><Icon icon="github" size="14" /></a></sup>
|
| 68 |
|
| 69 |
```python
|
| 70 |
client_id(self) -> str | None
|
|
|
|
| 73 |
Get the client ID if available.
|
| 74 |
|
| 75 |
|
| 76 |
+
#### `request_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L177"><Icon icon="github" size="14" /></a></sup>
|
| 77 |
|
| 78 |
```python
|
| 79 |
request_id(self) -> str
|
|
|
|
| 82 |
Get the unique ID for this request.
|
| 83 |
|
| 84 |
|
| 85 |
+
#### `session_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L182"><Icon icon="github" size="14" /></a></sup>
|
| 86 |
|
| 87 |
```python
|
| 88 |
session_id(self) -> str | None
|
|
|
|
| 99 |
- for stdio and in-memory transports which don't use session IDs.
|
| 100 |
|
| 101 |
|
| 102 |
+
#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L213"><Icon icon="github" size="14" /></a></sup>
|
| 103 |
|
| 104 |
```python
|
| 105 |
session(self)
|
|
|
|
| 108 |
Access to the underlying session for advanced usage.
|
| 109 |
|
| 110 |
|
| 111 |
+
#### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L282"><Icon icon="github" size="14" /></a></sup>
|
| 112 |
|
| 113 |
```python
|
| 114 |
get_http_request(self) -> Request
|
docs/python-sdk/fastmcp-server-dependencies.mdx
CHANGED
|
@@ -7,19 +7,19 @@ sidebarTitle: dependencies
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `get_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L27"
|
| 11 |
|
| 12 |
```python
|
| 13 |
get_context() -> Context
|
| 14 |
```
|
| 15 |
|
| 16 |
-
### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L39"
|
| 17 |
|
| 18 |
```python
|
| 19 |
get_http_request() -> Request
|
| 20 |
```
|
| 21 |
|
| 22 |
-
### `get_http_headers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L48"
|
| 23 |
|
| 24 |
```python
|
| 25 |
get_http_headers(include_all: bool = False) -> dict[str, str]
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `get_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L27"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
get_context() -> Context
|
| 14 |
```
|
| 15 |
|
| 16 |
+
### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L39"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
```python
|
| 19 |
get_http_request() -> Request
|
| 20 |
```
|
| 21 |
|
| 22 |
+
### `get_http_headers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L48"><Icon icon="github" size="14" /></a></sup>
|
| 23 |
|
| 24 |
```python
|
| 25 |
get_http_headers(include_all: bool = False) -> dict[str, str]
|
docs/python-sdk/fastmcp-server-http.mdx
CHANGED
|
@@ -7,13 +7,13 @@ sidebarTitle: http
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `set_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L48"
|
| 11 |
|
| 12 |
```python
|
| 13 |
set_http_request(request: Request) -> Generator[Request, None, None]
|
| 14 |
```
|
| 15 |
|
| 16 |
-
### `setup_auth_middleware_and_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L72"
|
| 17 |
|
| 18 |
```python
|
| 19 |
setup_auth_middleware_and_routes(auth: OAuthProvider) -> tuple[list[Middleware], list[BaseRoute], list[str]]
|
|
@@ -29,7 +29,7 @@ Set up authentication middleware and routes if auth is enabled.
|
|
| 29 |
- Tuple of (middleware, auth_routes, required_scopes)
|
| 30 |
|
| 31 |
|
| 32 |
-
### `create_base_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L110"
|
| 33 |
|
| 34 |
```python
|
| 35 |
create_base_app(routes: list[BaseRoute], middleware: list[Middleware], debug: bool = False, lifespan: Callable | None = None) -> StarletteWithLifespan
|
|
@@ -48,7 +48,7 @@ Create a base Starlette app with common middleware and routes.
|
|
| 48 |
- A Starlette application
|
| 49 |
|
| 50 |
|
| 51 |
-
### `create_sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L138"
|
| 52 |
|
| 53 |
```python
|
| 54 |
create_sse_app(server: FastMCP[LifespanResultT], message_path: str, sse_path: str, auth: OAuthProvider | None = None, debug: bool = False, routes: list[BaseRoute] | None = None, middleware: list[Middleware] | None = None) -> StarletteWithLifespan
|
|
@@ -70,7 +70,7 @@ Returns:
|
|
| 70 |
A Starlette application with RequestContextMiddleware
|
| 71 |
|
| 72 |
|
| 73 |
-
### `create_streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L246"
|
| 74 |
|
| 75 |
```python
|
| 76 |
create_streamable_http_app(server: FastMCP[LifespanResultT], streamable_http_path: str, event_store: EventStore | None = None, auth: OAuthProvider | None = None, json_response: bool = False, stateless_http: bool = False, debug: bool = False, routes: list[BaseRoute] | None = None, middleware: list[Middleware] | None = None) -> StarletteWithLifespan
|
|
@@ -96,17 +96,17 @@ Return an instance of the StreamableHTTP server app.
|
|
| 96 |
|
| 97 |
## Classes
|
| 98 |
|
| 99 |
-
### `StarletteWithLifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L41"
|
| 100 |
|
| 101 |
**Methods:**
|
| 102 |
|
| 103 |
-
#### `lifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L43"
|
| 104 |
|
| 105 |
```python
|
| 106 |
lifespan(self) -> Lifespan
|
| 107 |
```
|
| 108 |
|
| 109 |
-
### `RequestContextMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L56"
|
| 110 |
|
| 111 |
|
| 112 |
Middleware that stores each request in a ContextVar
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `set_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L48"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
set_http_request(request: Request) -> Generator[Request, None, None]
|
| 14 |
```
|
| 15 |
|
| 16 |
+
### `setup_auth_middleware_and_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L72"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
```python
|
| 19 |
setup_auth_middleware_and_routes(auth: OAuthProvider) -> tuple[list[Middleware], list[BaseRoute], list[str]]
|
|
|
|
| 29 |
- Tuple of (middleware, auth_routes, required_scopes)
|
| 30 |
|
| 31 |
|
| 32 |
+
### `create_base_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L110"><Icon icon="github" size="14" /></a></sup>
|
| 33 |
|
| 34 |
```python
|
| 35 |
create_base_app(routes: list[BaseRoute], middleware: list[Middleware], debug: bool = False, lifespan: Callable | None = None) -> StarletteWithLifespan
|
|
|
|
| 48 |
- A Starlette application
|
| 49 |
|
| 50 |
|
| 51 |
+
### `create_sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L138"><Icon icon="github" size="14" /></a></sup>
|
| 52 |
|
| 53 |
```python
|
| 54 |
create_sse_app(server: FastMCP[LifespanResultT], message_path: str, sse_path: str, auth: OAuthProvider | None = None, debug: bool = False, routes: list[BaseRoute] | None = None, middleware: list[Middleware] | None = None) -> StarletteWithLifespan
|
|
|
|
| 70 |
A Starlette application with RequestContextMiddleware
|
| 71 |
|
| 72 |
|
| 73 |
+
### `create_streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L246"><Icon icon="github" size="14" /></a></sup>
|
| 74 |
|
| 75 |
```python
|
| 76 |
create_streamable_http_app(server: FastMCP[LifespanResultT], streamable_http_path: str, event_store: EventStore | None = None, auth: OAuthProvider | None = None, json_response: bool = False, stateless_http: bool = False, debug: bool = False, routes: list[BaseRoute] | None = None, middleware: list[Middleware] | None = None) -> StarletteWithLifespan
|
|
|
|
| 96 |
|
| 97 |
## Classes
|
| 98 |
|
| 99 |
+
### `StarletteWithLifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L41"><Icon icon="github" size="14" /></a></sup>
|
| 100 |
|
| 101 |
**Methods:**
|
| 102 |
|
| 103 |
+
#### `lifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L43"><Icon icon="github" size="14" /></a></sup>
|
| 104 |
|
| 105 |
```python
|
| 106 |
lifespan(self) -> Lifespan
|
| 107 |
```
|
| 108 |
|
| 109 |
+
### `RequestContextMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L56"><Icon icon="github" size="14" /></a></sup>
|
| 110 |
|
| 111 |
|
| 112 |
Middleware that stores each request in a ContextVar
|
docs/python-sdk/fastmcp-server-middleware-error_handling.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Error handling middleware for consistent error responses and tracking.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `ErrorHandlingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L15"
|
| 14 |
|
| 15 |
|
| 16 |
Middleware that provides consistent error handling and logging.
|
|
@@ -21,7 +21,7 @@ proper MCP error responses. Also tracks error patterns for monitoring.
|
|
| 21 |
|
| 22 |
**Methods:**
|
| 23 |
|
| 24 |
-
#### `get_error_stats` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L121"
|
| 25 |
|
| 26 |
```python
|
| 27 |
get_error_stats(self) -> dict[str, int]
|
|
@@ -30,7 +30,7 @@ get_error_stats(self) -> dict[str, int]
|
|
| 30 |
Get error statistics for monitoring.
|
| 31 |
|
| 32 |
|
| 33 |
-
### `RetryMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L126"
|
| 34 |
|
| 35 |
|
| 36 |
Middleware that implements automatic retry logic for failed requests.
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `ErrorHandlingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L15"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Middleware that provides consistent error handling and logging.
|
|
|
|
| 21 |
|
| 22 |
**Methods:**
|
| 23 |
|
| 24 |
+
#### `get_error_stats` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L121"><Icon icon="github" size="14" /></a></sup>
|
| 25 |
|
| 26 |
```python
|
| 27 |
get_error_stats(self) -> dict[str, int]
|
|
|
|
| 30 |
Get error statistics for monitoring.
|
| 31 |
|
| 32 |
|
| 33 |
+
### `RetryMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L126"><Icon icon="github" size="14" /></a></sup>
|
| 34 |
|
| 35 |
|
| 36 |
Middleware that implements automatic retry logic for failed requests.
|
docs/python-sdk/fastmcp-server-middleware-logging.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Comprehensive logging middleware for FastMCP servers.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `LoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L10"
|
| 14 |
|
| 15 |
|
| 16 |
Middleware that provides comprehensive request and response logging.
|
|
@@ -19,7 +19,7 @@ Logs all MCP messages with configurable detail levels. Useful for debugging,
|
|
| 19 |
monitoring, and understanding server usage patterns.
|
| 20 |
|
| 21 |
|
| 22 |
-
### `StructuredLoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L87"
|
| 23 |
|
| 24 |
|
| 25 |
Middleware that provides structured JSON logging for better log analysis.
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `LoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L10"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Middleware that provides comprehensive request and response logging.
|
|
|
|
| 19 |
monitoring, and understanding server usage patterns.
|
| 20 |
|
| 21 |
|
| 22 |
+
### `StructuredLoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L87"><Icon icon="github" size="14" /></a></sup>
|
| 23 |
|
| 24 |
|
| 25 |
Middleware that provides structured JSON logging for better log analysis.
|
docs/python-sdk/fastmcp-server-middleware-middleware.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: middleware
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `make_middleware_wrapper` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L106"
|
| 11 |
|
| 12 |
```python
|
| 13 |
make_middleware_wrapper(middleware: Middleware, call_next: CallNext[T, R]) -> CallNext[T, R]
|
|
@@ -21,21 +21,21 @@ passed to other functions that expect a call_next function.
|
|
| 21 |
|
| 22 |
## Classes
|
| 23 |
|
| 24 |
-
### `CallNext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L36"
|
| 25 |
|
| 26 |
-
### `CallToolResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L56"
|
| 27 |
|
| 28 |
-
### `ListToolsResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L62"
|
| 29 |
|
| 30 |
-
### `ListResourcesResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L67"
|
| 31 |
|
| 32 |
-
### `ListResourceTemplatesResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L72"
|
| 33 |
|
| 34 |
-
### `ListPromptsResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L77"
|
| 35 |
|
| 36 |
-
### `ServerResultProtocol` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L82"
|
| 37 |
|
| 38 |
-
### `MiddlewareContext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L87"
|
| 39 |
|
| 40 |
|
| 41 |
Unified context for all middleware operations.
|
|
@@ -43,13 +43,13 @@ Unified context for all middleware operations.
|
|
| 43 |
|
| 44 |
**Methods:**
|
| 45 |
|
| 46 |
-
#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L102"
|
| 47 |
|
| 48 |
```python
|
| 49 |
copy(self, **kwargs: Any) -> MiddlewareContext[T]
|
| 50 |
```
|
| 51 |
|
| 52 |
-
### `Middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L119"
|
| 53 |
|
| 54 |
|
| 55 |
Base class for FastMCP middleware with dispatching hooks.
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `make_middleware_wrapper` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L106"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
make_middleware_wrapper(middleware: Middleware, call_next: CallNext[T, R]) -> CallNext[T, R]
|
|
|
|
| 21 |
|
| 22 |
## Classes
|
| 23 |
|
| 24 |
+
### `CallNext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L36"><Icon icon="github" size="14" /></a></sup>
|
| 25 |
|
| 26 |
+
### `CallToolResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L56"><Icon icon="github" size="14" /></a></sup>
|
| 27 |
|
| 28 |
+
### `ListToolsResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L62"><Icon icon="github" size="14" /></a></sup>
|
| 29 |
|
| 30 |
+
### `ListResourcesResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L67"><Icon icon="github" size="14" /></a></sup>
|
| 31 |
|
| 32 |
+
### `ListResourceTemplatesResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L72"><Icon icon="github" size="14" /></a></sup>
|
| 33 |
|
| 34 |
+
### `ListPromptsResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L77"><Icon icon="github" size="14" /></a></sup>
|
| 35 |
|
| 36 |
+
### `ServerResultProtocol` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L82"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
+
### `MiddlewareContext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L87"><Icon icon="github" size="14" /></a></sup>
|
| 39 |
|
| 40 |
|
| 41 |
Unified context for all middleware operations.
|
|
|
|
| 43 |
|
| 44 |
**Methods:**
|
| 45 |
|
| 46 |
+
#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L102"><Icon icon="github" size="14" /></a></sup>
|
| 47 |
|
| 48 |
```python
|
| 49 |
copy(self, **kwargs: Any) -> MiddlewareContext[T]
|
| 50 |
```
|
| 51 |
|
| 52 |
+
### `Middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L119"><Icon icon="github" size="14" /></a></sup>
|
| 53 |
|
| 54 |
|
| 55 |
Base class for FastMCP middleware with dispatching hooks.
|
docs/python-sdk/fastmcp-server-middleware-rate_limiting.mdx
CHANGED
|
@@ -10,25 +10,25 @@ Rate limiting middleware for protecting FastMCP servers from abuse.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `RateLimitError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L15"
|
| 14 |
|
| 15 |
|
| 16 |
Error raised when rate limit is exceeded.
|
| 17 |
|
| 18 |
|
| 19 |
-
### `TokenBucketRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L22"
|
| 20 |
|
| 21 |
|
| 22 |
Token bucket implementation for rate limiting.
|
| 23 |
|
| 24 |
|
| 25 |
-
### `SlidingWindowRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L61"
|
| 26 |
|
| 27 |
|
| 28 |
Sliding window rate limiter implementation.
|
| 29 |
|
| 30 |
|
| 31 |
-
### `RateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L92"
|
| 32 |
|
| 33 |
|
| 34 |
Middleware that implements rate limiting to prevent server abuse.
|
|
@@ -37,7 +37,7 @@ Uses a token bucket algorithm by default, allowing for burst traffic
|
|
| 37 |
while maintaining a sustainable long-term rate.
|
| 38 |
|
| 39 |
|
| 40 |
-
### `SlidingWindowRateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L170"
|
| 41 |
|
| 42 |
|
| 43 |
Middleware that implements sliding window rate limiting.
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `RateLimitError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L15"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Error raised when rate limit is exceeded.
|
| 17 |
|
| 18 |
|
| 19 |
+
### `TokenBucketRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L22"><Icon icon="github" size="14" /></a></sup>
|
| 20 |
|
| 21 |
|
| 22 |
Token bucket implementation for rate limiting.
|
| 23 |
|
| 24 |
|
| 25 |
+
### `SlidingWindowRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L61"><Icon icon="github" size="14" /></a></sup>
|
| 26 |
|
| 27 |
|
| 28 |
Sliding window rate limiter implementation.
|
| 29 |
|
| 30 |
|
| 31 |
+
### `RateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L92"><Icon icon="github" size="14" /></a></sup>
|
| 32 |
|
| 33 |
|
| 34 |
Middleware that implements rate limiting to prevent server abuse.
|
|
|
|
| 37 |
while maintaining a sustainable long-term rate.
|
| 38 |
|
| 39 |
|
| 40 |
+
### `SlidingWindowRateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L170"><Icon icon="github" size="14" /></a></sup>
|
| 41 |
|
| 42 |
|
| 43 |
Middleware that implements sliding window rate limiting.
|
docs/python-sdk/fastmcp-server-middleware-timing.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Timing middleware for measuring and logging request performance.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `TimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L10"
|
| 14 |
|
| 15 |
|
| 16 |
Middleware that logs the execution time of requests.
|
|
@@ -19,7 +19,7 @@ Only measures and logs timing for request messages (not notifications).
|
|
| 19 |
Provides insights into performance characteristics of your MCP server.
|
| 20 |
|
| 21 |
|
| 22 |
-
### `DetailedTimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L60"
|
| 23 |
|
| 24 |
|
| 25 |
Enhanced timing middleware with per-operation breakdowns.
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `TimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L10"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Middleware that logs the execution time of requests.
|
|
|
|
| 19 |
Provides insights into performance characteristics of your MCP server.
|
| 20 |
|
| 21 |
|
| 22 |
+
### `DetailedTimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L60"><Icon icon="github" size="14" /></a></sup>
|
| 23 |
|
| 24 |
|
| 25 |
Enhanced timing middleware with per-operation breakdowns.
|
docs/python-sdk/fastmcp-server-openapi.mdx
CHANGED
|
@@ -10,13 +10,13 @@ FastMCP server implementation for OpenAPI integration.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `MCPType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L76"
|
| 14 |
|
| 15 |
|
| 16 |
Type of FastMCP component to create from a route.
|
| 17 |
|
| 18 |
|
| 19 |
-
### `RouteType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L95"
|
| 20 |
|
| 21 |
|
| 22 |
Deprecated: Use MCPType instead.
|
|
@@ -24,31 +24,31 @@ Deprecated: Use MCPType instead.
|
|
| 24 |
This enum is kept for backward compatibility and will be removed in a future version.
|
| 25 |
|
| 26 |
|
| 27 |
-
### `RouteMap` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L109"
|
| 28 |
|
| 29 |
|
| 30 |
Mapping configuration for HTTP routes to FastMCP component types.
|
| 31 |
|
| 32 |
|
| 33 |
-
### `OpenAPITool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L227"
|
| 34 |
|
| 35 |
|
| 36 |
Tool implementation for OpenAPI endpoints.
|
| 37 |
|
| 38 |
|
| 39 |
-
### `OpenAPIResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L478"
|
| 40 |
|
| 41 |
|
| 42 |
Resource implementation for OpenAPI endpoints.
|
| 43 |
|
| 44 |
|
| 45 |
-
### `OpenAPIResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L597"
|
| 46 |
|
| 47 |
|
| 48 |
Resource template implementation for OpenAPI endpoints.
|
| 49 |
|
| 50 |
|
| 51 |
-
### `FastMCPOpenAPI` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L651"
|
| 52 |
|
| 53 |
|
| 54 |
FastMCP server implementation that creates components from an OpenAPI schema.
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `MCPType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L76"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Type of FastMCP component to create from a route.
|
| 17 |
|
| 18 |
|
| 19 |
+
### `RouteType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L95"><Icon icon="github" size="14" /></a></sup>
|
| 20 |
|
| 21 |
|
| 22 |
Deprecated: Use MCPType instead.
|
|
|
|
| 24 |
This enum is kept for backward compatibility and will be removed in a future version.
|
| 25 |
|
| 26 |
|
| 27 |
+
### `RouteMap` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L109"><Icon icon="github" size="14" /></a></sup>
|
| 28 |
|
| 29 |
|
| 30 |
Mapping configuration for HTTP routes to FastMCP component types.
|
| 31 |
|
| 32 |
|
| 33 |
+
### `OpenAPITool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L227"><Icon icon="github" size="14" /></a></sup>
|
| 34 |
|
| 35 |
|
| 36 |
Tool implementation for OpenAPI endpoints.
|
| 37 |
|
| 38 |
|
| 39 |
+
### `OpenAPIResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L478"><Icon icon="github" size="14" /></a></sup>
|
| 40 |
|
| 41 |
|
| 42 |
Resource implementation for OpenAPI endpoints.
|
| 43 |
|
| 44 |
|
| 45 |
+
### `OpenAPIResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L597"><Icon icon="github" size="14" /></a></sup>
|
| 46 |
|
| 47 |
|
| 48 |
Resource template implementation for OpenAPI endpoints.
|
| 49 |
|
| 50 |
|
| 51 |
+
### `FastMCPOpenAPI` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L651"><Icon icon="github" size="14" /></a></sup>
|
| 52 |
|
| 53 |
|
| 54 |
FastMCP server implementation that creates components from an OpenAPI schema.
|
docs/python-sdk/fastmcp-server-proxy.mdx
CHANGED
|
@@ -7,25 +7,25 @@ sidebarTitle: proxy
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `ProxyToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L36"
|
| 11 |
|
| 12 |
|
| 13 |
A ToolManager that sources its tools from a remote client in addition to local and mounted tools.
|
| 14 |
|
| 15 |
|
| 16 |
-
### `ProxyResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L81"
|
| 17 |
|
| 18 |
|
| 19 |
A ResourceManager that sources its resources from a remote client in addition to local and mounted resources.
|
| 20 |
|
| 21 |
|
| 22 |
-
### `ProxyPromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L159"
|
| 23 |
|
| 24 |
|
| 25 |
A PromptManager that sources its prompts from a remote client in addition to local and mounted prompts.
|
| 26 |
|
| 27 |
|
| 28 |
-
### `ProxyTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L209"
|
| 29 |
|
| 30 |
|
| 31 |
A Tool that represents and executes a tool on a remote server.
|
|
@@ -33,7 +33,7 @@ A Tool that represents and executes a tool on a remote server.
|
|
| 33 |
|
| 34 |
**Methods:**
|
| 35 |
|
| 36 |
-
#### `from_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L219"
|
| 37 |
|
| 38 |
```python
|
| 39 |
from_mcp_tool(cls, client: Client, mcp_tool: mcp.types.Tool) -> ProxyTool
|
|
@@ -42,7 +42,7 @@ from_mcp_tool(cls, client: Client, mcp_tool: mcp.types.Tool) -> ProxyTool
|
|
| 42 |
Factory method to create a ProxyTool from a raw MCP tool schema.
|
| 43 |
|
| 44 |
|
| 45 |
-
### `ProxyResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L246"
|
| 46 |
|
| 47 |
|
| 48 |
A Resource that represents and reads a resource from a remote server.
|
|
@@ -50,7 +50,7 @@ A Resource that represents and reads a resource from a remote server.
|
|
| 50 |
|
| 51 |
**Methods:**
|
| 52 |
|
| 53 |
-
#### `from_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L260"
|
| 54 |
|
| 55 |
```python
|
| 56 |
from_mcp_resource(cls, client: Client, mcp_resource: mcp.types.Resource) -> ProxyResource
|
|
@@ -59,7 +59,7 @@ from_mcp_resource(cls, client: Client, mcp_resource: mcp.types.Resource) -> Prox
|
|
| 59 |
Factory method to create a ProxyResource from a raw MCP resource schema.
|
| 60 |
|
| 61 |
|
| 62 |
-
### `ProxyTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L287"
|
| 63 |
|
| 64 |
|
| 65 |
A ResourceTemplate that represents and creates resources from a remote server template.
|
|
@@ -67,7 +67,7 @@ A ResourceTemplate that represents and creates resources from a remote server te
|
|
| 67 |
|
| 68 |
**Methods:**
|
| 69 |
|
| 70 |
-
#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L297"
|
| 71 |
|
| 72 |
```python
|
| 73 |
from_mcp_template(cls, client: Client, mcp_template: mcp.types.ResourceTemplate) -> ProxyTemplate
|
|
@@ -76,7 +76,7 @@ from_mcp_template(cls, client: Client, mcp_template: mcp.types.ResourceTemplate)
|
|
| 76 |
Factory method to create a ProxyTemplate from a raw MCP template schema.
|
| 77 |
|
| 78 |
|
| 79 |
-
### `ProxyPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L343"
|
| 80 |
|
| 81 |
|
| 82 |
A Prompt that represents and renders a prompt from a remote server.
|
|
@@ -84,7 +84,7 @@ A Prompt that represents and renders a prompt from a remote server.
|
|
| 84 |
|
| 85 |
**Methods:**
|
| 86 |
|
| 87 |
-
#### `from_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L355"
|
| 88 |
|
| 89 |
```python
|
| 90 |
from_mcp_prompt(cls, client: Client, mcp_prompt: mcp.types.Prompt) -> ProxyPrompt
|
|
@@ -93,7 +93,7 @@ from_mcp_prompt(cls, client: Client, mcp_prompt: mcp.types.Prompt) -> ProxyPromp
|
|
| 93 |
Factory method to create a ProxyPrompt from a raw MCP prompt schema.
|
| 94 |
|
| 95 |
|
| 96 |
-
### `FastMCPProxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L381"
|
| 97 |
|
| 98 |
|
| 99 |
A FastMCP server that acts as a proxy to a remote MCP-compliant server.
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `ProxyToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L36"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
A ToolManager that sources its tools from a remote client in addition to local and mounted tools.
|
| 14 |
|
| 15 |
|
| 16 |
+
### `ProxyResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L81"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
|
| 19 |
A ResourceManager that sources its resources from a remote client in addition to local and mounted resources.
|
| 20 |
|
| 21 |
|
| 22 |
+
### `ProxyPromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L159"><Icon icon="github" size="14" /></a></sup>
|
| 23 |
|
| 24 |
|
| 25 |
A PromptManager that sources its prompts from a remote client in addition to local and mounted prompts.
|
| 26 |
|
| 27 |
|
| 28 |
+
### `ProxyTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L209"><Icon icon="github" size="14" /></a></sup>
|
| 29 |
|
| 30 |
|
| 31 |
A Tool that represents and executes a tool on a remote server.
|
|
|
|
| 33 |
|
| 34 |
**Methods:**
|
| 35 |
|
| 36 |
+
#### `from_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L219"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
from_mcp_tool(cls, client: Client, mcp_tool: mcp.types.Tool) -> ProxyTool
|
|
|
|
| 42 |
Factory method to create a ProxyTool from a raw MCP tool schema.
|
| 43 |
|
| 44 |
|
| 45 |
+
### `ProxyResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L246"><Icon icon="github" size="14" /></a></sup>
|
| 46 |
|
| 47 |
|
| 48 |
A Resource that represents and reads a resource from a remote server.
|
|
|
|
| 50 |
|
| 51 |
**Methods:**
|
| 52 |
|
| 53 |
+
#### `from_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L260"><Icon icon="github" size="14" /></a></sup>
|
| 54 |
|
| 55 |
```python
|
| 56 |
from_mcp_resource(cls, client: Client, mcp_resource: mcp.types.Resource) -> ProxyResource
|
|
|
|
| 59 |
Factory method to create a ProxyResource from a raw MCP resource schema.
|
| 60 |
|
| 61 |
|
| 62 |
+
### `ProxyTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L287"><Icon icon="github" size="14" /></a></sup>
|
| 63 |
|
| 64 |
|
| 65 |
A ResourceTemplate that represents and creates resources from a remote server template.
|
|
|
|
| 67 |
|
| 68 |
**Methods:**
|
| 69 |
|
| 70 |
+
#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L297"><Icon icon="github" size="14" /></a></sup>
|
| 71 |
|
| 72 |
```python
|
| 73 |
from_mcp_template(cls, client: Client, mcp_template: mcp.types.ResourceTemplate) -> ProxyTemplate
|
|
|
|
| 76 |
Factory method to create a ProxyTemplate from a raw MCP template schema.
|
| 77 |
|
| 78 |
|
| 79 |
+
### `ProxyPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L343"><Icon icon="github" size="14" /></a></sup>
|
| 80 |
|
| 81 |
|
| 82 |
A Prompt that represents and renders a prompt from a remote server.
|
|
|
|
| 84 |
|
| 85 |
**Methods:**
|
| 86 |
|
| 87 |
+
#### `from_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L355"><Icon icon="github" size="14" /></a></sup>
|
| 88 |
|
| 89 |
```python
|
| 90 |
from_mcp_prompt(cls, client: Client, mcp_prompt: mcp.types.Prompt) -> ProxyPrompt
|
|
|
|
| 93 |
Factory method to create a ProxyPrompt from a raw MCP prompt schema.
|
| 94 |
|
| 95 |
|
| 96 |
+
### `FastMCPProxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L381"><Icon icon="github" size="14" /></a></sup>
|
| 97 |
|
| 98 |
|
| 99 |
A FastMCP server that acts as a proxy to a remote MCP-compliant server.
|
docs/python-sdk/fastmcp-server-server.mdx
CHANGED
|
@@ -10,7 +10,7 @@ FastMCP - A more ergonomic interface for MCP servers.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `add_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1865"
|
| 14 |
|
| 15 |
```python
|
| 16 |
add_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> str
|
|
@@ -39,7 +39,7 @@ Add a prefix to a resource URI.
|
|
| 39 |
- `ValueError`: If the URI doesn't match the expected protocol\://path format
|
| 40 |
|
| 41 |
|
| 42 |
-
### `remove_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1916"
|
| 43 |
|
| 44 |
```python
|
| 45 |
remove_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> str
|
|
@@ -69,7 +69,7 @@ Returns:
|
|
| 69 |
- `ValueError`: If the URI doesn't match the expected protocol\://path format
|
| 70 |
|
| 71 |
|
| 72 |
-
### `has_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1974"
|
| 73 |
|
| 74 |
```python
|
| 75 |
has_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> bool
|
|
@@ -100,29 +100,29 @@ False
|
|
| 100 |
|
| 101 |
## Classes
|
| 102 |
|
| 103 |
-
### `FastMCP` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L113"
|
| 104 |
|
| 105 |
**Methods:**
|
| 106 |
|
| 107 |
-
#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L264"
|
| 108 |
|
| 109 |
```python
|
| 110 |
settings(self) -> Settings
|
| 111 |
```
|
| 112 |
|
| 113 |
-
#### `name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L275"
|
| 114 |
|
| 115 |
```python
|
| 116 |
name(self) -> str
|
| 117 |
```
|
| 118 |
|
| 119 |
-
#### `instructions` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L279"
|
| 120 |
|
| 121 |
```python
|
| 122 |
instructions(self) -> str | None
|
| 123 |
```
|
| 124 |
|
| 125 |
-
#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L304"
|
| 126 |
|
| 127 |
```python
|
| 128 |
run(self, transport: Transport | None = None, **transport_kwargs: Any) -> None
|
|
@@ -134,13 +134,13 @@ Run the FastMCP server. Note this is a synchronous function.
|
|
| 134 |
- `transport`: Transport protocol to use ("stdio", "sse", or "streamable-http")
|
| 135 |
|
| 136 |
|
| 137 |
-
#### `add_middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L338"
|
| 138 |
|
| 139 |
```python
|
| 140 |
add_middleware(self, middleware: Middleware) -> None
|
| 141 |
```
|
| 142 |
|
| 143 |
-
#### `custom_route` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L383"
|
| 144 |
|
| 145 |
```python
|
| 146 |
custom_route(self, path: str, methods: list[str], name: str | None = None, include_in_schema: bool = True)
|
|
@@ -161,7 +161,7 @@ Starlette's reverse URL lookup feature)
|
|
| 161 |
- `include_in_schema`: Whether to include in OpenAPI schema, defaults to True
|
| 162 |
|
| 163 |
|
| 164 |
-
#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L738"
|
| 165 |
|
| 166 |
```python
|
| 167 |
add_tool(self, tool: Tool) -> None
|
|
@@ -176,7 +176,7 @@ with the Context type annotation. See the @tool decorator for examples.
|
|
| 176 |
- `tool`: The Tool instance to register
|
| 177 |
|
| 178 |
|
| 179 |
-
#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L750"
|
| 180 |
|
| 181 |
```python
|
| 182 |
remove_tool(self, name: str) -> None
|
|
@@ -191,19 +191,19 @@ Remove a tool from the server.
|
|
| 191 |
- `NotFoundError`: If the tool is not found
|
| 192 |
|
| 193 |
|
| 194 |
-
#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L763"
|
| 195 |
|
| 196 |
```python
|
| 197 |
tool(self, name_or_fn: AnyFunction) -> FunctionTool
|
| 198 |
```
|
| 199 |
|
| 200 |
-
#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L776"
|
| 201 |
|
| 202 |
```python
|
| 203 |
tool(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionTool]
|
| 204 |
```
|
| 205 |
|
| 206 |
-
#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L788"
|
| 207 |
|
| 208 |
```python
|
| 209 |
tool(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionTool] | FunctionTool
|
|
@@ -232,7 +232,7 @@ This decorator supports multiple calling patterns:
|
|
| 232 |
- `enabled`: Optional boolean to enable or disable the tool
|
| 233 |
|
| 234 |
|
| 235 |
-
#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L904"
|
| 236 |
|
| 237 |
```python
|
| 238 |
add_resource(self, resource: Resource) -> None
|
|
@@ -244,7 +244,7 @@ Add a resource to the server.
|
|
| 244 |
- `resource`: A Resource instance to add
|
| 245 |
|
| 246 |
|
| 247 |
-
#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L914"
|
| 248 |
|
| 249 |
```python
|
| 250 |
add_template(self, template: ResourceTemplate) -> None
|
|
@@ -256,7 +256,7 @@ Add a resource template to the server.
|
|
| 256 |
- `template`: A ResourceTemplate instance to add
|
| 257 |
|
| 258 |
|
| 259 |
-
#### `add_resource_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L922"
|
| 260 |
|
| 261 |
```python
|
| 262 |
add_resource_fn(self, fn: AnyFunction, uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> None
|
|
@@ -276,7 +276,7 @@ has parameters, it will be registered as a template resource.
|
|
| 276 |
- `tags`: Optional set of tags for categorizing the resource
|
| 277 |
|
| 278 |
|
| 279 |
-
#### `resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L961"
|
| 280 |
|
| 281 |
```python
|
| 282 |
resource(self, uri: str) -> Callable[[AnyFunction], Resource | ResourceTemplate]
|
|
@@ -306,7 +306,7 @@ has parameters, it will be registered as a template resource.
|
|
| 306 |
- `enabled`: Optional boolean to enable or disable the resource
|
| 307 |
|
| 308 |
|
| 309 |
-
#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1081"
|
| 310 |
|
| 311 |
```python
|
| 312 |
add_prompt(self, prompt: Prompt) -> None
|
|
@@ -318,19 +318,19 @@ Add a prompt to the server.
|
|
| 318 |
- `prompt`: A Prompt instance to add
|
| 319 |
|
| 320 |
|
| 321 |
-
#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1091"
|
| 322 |
|
| 323 |
```python
|
| 324 |
prompt(self, name_or_fn: AnyFunction) -> FunctionPrompt
|
| 325 |
```
|
| 326 |
|
| 327 |
-
#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1102"
|
| 328 |
|
| 329 |
```python
|
| 330 |
prompt(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionPrompt]
|
| 331 |
```
|
| 332 |
|
| 333 |
-
#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1112"
|
| 334 |
|
| 335 |
```python
|
| 336 |
prompt(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt
|
|
@@ -404,7 +404,7 @@ Decorator to register a prompt.
|
|
| 404 |
server.prompt(my_function, name="custom_name")
|
| 405 |
|
| 406 |
|
| 407 |
-
#### `sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1330"
|
| 408 |
|
| 409 |
```python
|
| 410 |
sse_app(self, path: str | None = None, message_path: str | None = None, middleware: list[ASGIMiddleware] | None = None) -> StarletteWithLifespan
|
|
@@ -418,7 +418,7 @@ Create a Starlette app for the SSE server.
|
|
| 418 |
- `middleware`: A list of middleware to apply to the app
|
| 419 |
|
| 420 |
|
| 421 |
-
#### `streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1361"
|
| 422 |
|
| 423 |
```python
|
| 424 |
streamable_http_app(self, path: str | None = None, middleware: list[ASGIMiddleware] | None = None) -> StarletteWithLifespan
|
|
@@ -431,7 +431,7 @@ Create a Starlette app for the StreamableHTTP server.
|
|
| 431 |
- `middleware`: A list of middleware to apply to the app
|
| 432 |
|
| 433 |
|
| 434 |
-
#### `http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1382"
|
| 435 |
|
| 436 |
```python
|
| 437 |
http_app(self, path: str | None = None, middleware: list[ASGIMiddleware] | None = None, json_response: bool | None = None, stateless_http: bool | None = None, transport: Literal['http', 'streamable-http', 'sse'] = 'http') -> StarletteWithLifespan
|
|
@@ -448,7 +448,7 @@ Create a Starlette app using the specified HTTP transport.
|
|
| 448 |
- A Starlette application configured with the specified transport
|
| 449 |
|
| 450 |
|
| 451 |
-
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1456"
|
| 452 |
|
| 453 |
```python
|
| 454 |
mount(self, server: FastMCP[LifespanResultT], prefix: str | None = None, as_proxy: bool | None = None) -> None
|
|
@@ -502,7 +502,7 @@ automatically determined based on whether the server has a custom lifespan
|
|
| 502 |
- `prompt_separator`: Deprecated. Separator character for prompt names.
|
| 503 |
|
| 504 |
|
| 505 |
-
#### `from_openapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1706"
|
| 506 |
|
| 507 |
```python
|
| 508 |
from_openapi(cls, openapi_spec: dict[str, Any], client: httpx.AsyncClient, route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, tags: set[str] | None = None, **settings: Any) -> FastMCPOpenAPI
|
|
@@ -511,7 +511,7 @@ from_openapi(cls, openapi_spec: dict[str, Any], client: httpx.AsyncClient, route
|
|
| 511 |
Create a FastMCP server from an OpenAPI specification.
|
| 512 |
|
| 513 |
|
| 514 |
-
#### `from_fastapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1734"
|
| 515 |
|
| 516 |
```python
|
| 517 |
from_fastapi(cls, app: Any, name: str | None = None, route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, httpx_client_kwargs: dict[str, Any] | None = None, tags: set[str] | None = None, **settings: Any) -> FastMCPOpenAPI
|
|
@@ -520,7 +520,7 @@ from_fastapi(cls, app: Any, name: str | None = None, route_maps: list[RouteMap]
|
|
| 520 |
Create a FastMCP server from a FastAPI application.
|
| 521 |
|
| 522 |
|
| 523 |
-
#### `as_proxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1776"
|
| 524 |
|
| 525 |
```python
|
| 526 |
as_proxy(cls, backend: Client[ClientTransportT] | ClientTransport | FastMCP[Any] | AnyUrl | Path | MCPConfig | dict[str, Any] | str, **settings: Any) -> FastMCPProxy
|
|
@@ -534,7 +534,7 @@ instance or any value accepted as the ``transport`` argument of
|
|
| 534 |
``Client`` constructor.
|
| 535 |
|
| 536 |
|
| 537 |
-
#### `from_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1806"
|
| 538 |
|
| 539 |
```python
|
| 540 |
from_client(cls, client: Client[ClientTransportT], **settings: Any) -> FastMCPProxy
|
|
@@ -543,4 +543,4 @@ from_client(cls, client: Client[ClientTransportT], **settings: Any) -> FastMCPPr
|
|
| 543 |
Create a FastMCP proxy server from a FastMCP client.
|
| 544 |
|
| 545 |
|
| 546 |
-
### `MountedServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1859"
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `add_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1865"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
add_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> str
|
|
|
|
| 39 |
- `ValueError`: If the URI doesn't match the expected protocol\://path format
|
| 40 |
|
| 41 |
|
| 42 |
+
### `remove_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1916"><Icon icon="github" size="14" /></a></sup>
|
| 43 |
|
| 44 |
```python
|
| 45 |
remove_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> str
|
|
|
|
| 69 |
- `ValueError`: If the URI doesn't match the expected protocol\://path format
|
| 70 |
|
| 71 |
|
| 72 |
+
### `has_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1974"><Icon icon="github" size="14" /></a></sup>
|
| 73 |
|
| 74 |
```python
|
| 75 |
has_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> bool
|
|
|
|
| 100 |
|
| 101 |
## Classes
|
| 102 |
|
| 103 |
+
### `FastMCP` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L113"><Icon icon="github" size="14" /></a></sup>
|
| 104 |
|
| 105 |
**Methods:**
|
| 106 |
|
| 107 |
+
#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L264"><Icon icon="github" size="14" /></a></sup>
|
| 108 |
|
| 109 |
```python
|
| 110 |
settings(self) -> Settings
|
| 111 |
```
|
| 112 |
|
| 113 |
+
#### `name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L275"><Icon icon="github" size="14" /></a></sup>
|
| 114 |
|
| 115 |
```python
|
| 116 |
name(self) -> str
|
| 117 |
```
|
| 118 |
|
| 119 |
+
#### `instructions` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L279"><Icon icon="github" size="14" /></a></sup>
|
| 120 |
|
| 121 |
```python
|
| 122 |
instructions(self) -> str | None
|
| 123 |
```
|
| 124 |
|
| 125 |
+
#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L304"><Icon icon="github" size="14" /></a></sup>
|
| 126 |
|
| 127 |
```python
|
| 128 |
run(self, transport: Transport | None = None, **transport_kwargs: Any) -> None
|
|
|
|
| 134 |
- `transport`: Transport protocol to use ("stdio", "sse", or "streamable-http")
|
| 135 |
|
| 136 |
|
| 137 |
+
#### `add_middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L338"><Icon icon="github" size="14" /></a></sup>
|
| 138 |
|
| 139 |
```python
|
| 140 |
add_middleware(self, middleware: Middleware) -> None
|
| 141 |
```
|
| 142 |
|
| 143 |
+
#### `custom_route` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L383"><Icon icon="github" size="14" /></a></sup>
|
| 144 |
|
| 145 |
```python
|
| 146 |
custom_route(self, path: str, methods: list[str], name: str | None = None, include_in_schema: bool = True)
|
|
|
|
| 161 |
- `include_in_schema`: Whether to include in OpenAPI schema, defaults to True
|
| 162 |
|
| 163 |
|
| 164 |
+
#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L738"><Icon icon="github" size="14" /></a></sup>
|
| 165 |
|
| 166 |
```python
|
| 167 |
add_tool(self, tool: Tool) -> None
|
|
|
|
| 176 |
- `tool`: The Tool instance to register
|
| 177 |
|
| 178 |
|
| 179 |
+
#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L750"><Icon icon="github" size="14" /></a></sup>
|
| 180 |
|
| 181 |
```python
|
| 182 |
remove_tool(self, name: str) -> None
|
|
|
|
| 191 |
- `NotFoundError`: If the tool is not found
|
| 192 |
|
| 193 |
|
| 194 |
+
#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L763"><Icon icon="github" size="14" /></a></sup>
|
| 195 |
|
| 196 |
```python
|
| 197 |
tool(self, name_or_fn: AnyFunction) -> FunctionTool
|
| 198 |
```
|
| 199 |
|
| 200 |
+
#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L776"><Icon icon="github" size="14" /></a></sup>
|
| 201 |
|
| 202 |
```python
|
| 203 |
tool(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionTool]
|
| 204 |
```
|
| 205 |
|
| 206 |
+
#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L788"><Icon icon="github" size="14" /></a></sup>
|
| 207 |
|
| 208 |
```python
|
| 209 |
tool(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionTool] | FunctionTool
|
|
|
|
| 232 |
- `enabled`: Optional boolean to enable or disable the tool
|
| 233 |
|
| 234 |
|
| 235 |
+
#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L904"><Icon icon="github" size="14" /></a></sup>
|
| 236 |
|
| 237 |
```python
|
| 238 |
add_resource(self, resource: Resource) -> None
|
|
|
|
| 244 |
- `resource`: A Resource instance to add
|
| 245 |
|
| 246 |
|
| 247 |
+
#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L914"><Icon icon="github" size="14" /></a></sup>
|
| 248 |
|
| 249 |
```python
|
| 250 |
add_template(self, template: ResourceTemplate) -> None
|
|
|
|
| 256 |
- `template`: A ResourceTemplate instance to add
|
| 257 |
|
| 258 |
|
| 259 |
+
#### `add_resource_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L922"><Icon icon="github" size="14" /></a></sup>
|
| 260 |
|
| 261 |
```python
|
| 262 |
add_resource_fn(self, fn: AnyFunction, uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> None
|
|
|
|
| 276 |
- `tags`: Optional set of tags for categorizing the resource
|
| 277 |
|
| 278 |
|
| 279 |
+
#### `resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L961"><Icon icon="github" size="14" /></a></sup>
|
| 280 |
|
| 281 |
```python
|
| 282 |
resource(self, uri: str) -> Callable[[AnyFunction], Resource | ResourceTemplate]
|
|
|
|
| 306 |
- `enabled`: Optional boolean to enable or disable the resource
|
| 307 |
|
| 308 |
|
| 309 |
+
#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1081"><Icon icon="github" size="14" /></a></sup>
|
| 310 |
|
| 311 |
```python
|
| 312 |
add_prompt(self, prompt: Prompt) -> None
|
|
|
|
| 318 |
- `prompt`: A Prompt instance to add
|
| 319 |
|
| 320 |
|
| 321 |
+
#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1091"><Icon icon="github" size="14" /></a></sup>
|
| 322 |
|
| 323 |
```python
|
| 324 |
prompt(self, name_or_fn: AnyFunction) -> FunctionPrompt
|
| 325 |
```
|
| 326 |
|
| 327 |
+
#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1102"><Icon icon="github" size="14" /></a></sup>
|
| 328 |
|
| 329 |
```python
|
| 330 |
prompt(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionPrompt]
|
| 331 |
```
|
| 332 |
|
| 333 |
+
#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1112"><Icon icon="github" size="14" /></a></sup>
|
| 334 |
|
| 335 |
```python
|
| 336 |
prompt(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt
|
|
|
|
| 404 |
server.prompt(my_function, name="custom_name")
|
| 405 |
|
| 406 |
|
| 407 |
+
#### `sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1330"><Icon icon="github" size="14" /></a></sup>
|
| 408 |
|
| 409 |
```python
|
| 410 |
sse_app(self, path: str | None = None, message_path: str | None = None, middleware: list[ASGIMiddleware] | None = None) -> StarletteWithLifespan
|
|
|
|
| 418 |
- `middleware`: A list of middleware to apply to the app
|
| 419 |
|
| 420 |
|
| 421 |
+
#### `streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1361"><Icon icon="github" size="14" /></a></sup>
|
| 422 |
|
| 423 |
```python
|
| 424 |
streamable_http_app(self, path: str | None = None, middleware: list[ASGIMiddleware] | None = None) -> StarletteWithLifespan
|
|
|
|
| 431 |
- `middleware`: A list of middleware to apply to the app
|
| 432 |
|
| 433 |
|
| 434 |
+
#### `http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1382"><Icon icon="github" size="14" /></a></sup>
|
| 435 |
|
| 436 |
```python
|
| 437 |
http_app(self, path: str | None = None, middleware: list[ASGIMiddleware] | None = None, json_response: bool | None = None, stateless_http: bool | None = None, transport: Literal['http', 'streamable-http', 'sse'] = 'http') -> StarletteWithLifespan
|
|
|
|
| 448 |
- A Starlette application configured with the specified transport
|
| 449 |
|
| 450 |
|
| 451 |
+
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1456"><Icon icon="github" size="14" /></a></sup>
|
| 452 |
|
| 453 |
```python
|
| 454 |
mount(self, server: FastMCP[LifespanResultT], prefix: str | None = None, as_proxy: bool | None = None) -> None
|
|
|
|
| 502 |
- `prompt_separator`: Deprecated. Separator character for prompt names.
|
| 503 |
|
| 504 |
|
| 505 |
+
#### `from_openapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1706"><Icon icon="github" size="14" /></a></sup>
|
| 506 |
|
| 507 |
```python
|
| 508 |
from_openapi(cls, openapi_spec: dict[str, Any], client: httpx.AsyncClient, route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, tags: set[str] | None = None, **settings: Any) -> FastMCPOpenAPI
|
|
|
|
| 511 |
Create a FastMCP server from an OpenAPI specification.
|
| 512 |
|
| 513 |
|
| 514 |
+
#### `from_fastapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1734"><Icon icon="github" size="14" /></a></sup>
|
| 515 |
|
| 516 |
```python
|
| 517 |
from_fastapi(cls, app: Any, name: str | None = None, route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, httpx_client_kwargs: dict[str, Any] | None = None, tags: set[str] | None = None, **settings: Any) -> FastMCPOpenAPI
|
|
|
|
| 520 |
Create a FastMCP server from a FastAPI application.
|
| 521 |
|
| 522 |
|
| 523 |
+
#### `as_proxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1776"><Icon icon="github" size="14" /></a></sup>
|
| 524 |
|
| 525 |
```python
|
| 526 |
as_proxy(cls, backend: Client[ClientTransportT] | ClientTransport | FastMCP[Any] | AnyUrl | Path | MCPConfig | dict[str, Any] | str, **settings: Any) -> FastMCPProxy
|
|
|
|
| 534 |
``Client`` constructor.
|
| 535 |
|
| 536 |
|
| 537 |
+
#### `from_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1806"><Icon icon="github" size="14" /></a></sup>
|
| 538 |
|
| 539 |
```python
|
| 540 |
from_client(cls, client: Client[ClientTransportT], **settings: Any) -> FastMCPProxy
|
|
|
|
| 543 |
Create a FastMCP proxy server from a FastMCP client.
|
| 544 |
|
| 545 |
|
| 546 |
+
### `MountedServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1859"><Icon icon="github" size="14" /></a></sup>
|
docs/python-sdk/fastmcp-settings.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: settings
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `ExtendedEnvSettingsSource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L26"
|
| 11 |
|
| 12 |
|
| 13 |
A special EnvSettingsSource that allows for multiple env var prefixes to be used.
|
|
@@ -17,15 +17,15 @@ Raises a deprecation warning if the old `FASTMCP_SERVER_` prefix is used.
|
|
| 17 |
|
| 18 |
**Methods:**
|
| 19 |
|
| 20 |
-
#### `get_field_value` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L33"
|
| 21 |
|
| 22 |
```python
|
| 23 |
get_field_value(self, field: FieldInfo, field_name: str) -> tuple[Any, str, bool]
|
| 24 |
```
|
| 25 |
|
| 26 |
-
### `ExtendedSettingsConfigDict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L53"
|
| 27 |
|
| 28 |
-
### `Settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L57"
|
| 29 |
|
| 30 |
|
| 31 |
FastMCP settings.
|
|
@@ -33,13 +33,13 @@ FastMCP settings.
|
|
| 33 |
|
| 34 |
**Methods:**
|
| 35 |
|
| 36 |
-
#### `settings_customise_sources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L69"
|
| 37 |
|
| 38 |
```python
|
| 39 |
settings_customise_sources(cls, settings_cls: type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) -> tuple[PydanticBaseSettingsSource, ...]
|
| 40 |
```
|
| 41 |
|
| 42 |
-
#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L87"
|
| 43 |
|
| 44 |
```python
|
| 45 |
settings(self) -> Self
|
|
@@ -49,7 +49,7 @@ This property is for backwards compatibility with FastMCP < 2.8.0,
|
|
| 49 |
which accessed fastmcp.settings.settings
|
| 50 |
|
| 51 |
|
| 52 |
-
#### `setup_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L182"
|
| 53 |
|
| 54 |
```python
|
| 55 |
setup_logging(self) -> Self
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `ExtendedEnvSettingsSource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L26"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
A special EnvSettingsSource that allows for multiple env var prefixes to be used.
|
|
|
|
| 17 |
|
| 18 |
**Methods:**
|
| 19 |
|
| 20 |
+
#### `get_field_value` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L33"><Icon icon="github" size="14" /></a></sup>
|
| 21 |
|
| 22 |
```python
|
| 23 |
get_field_value(self, field: FieldInfo, field_name: str) -> tuple[Any, str, bool]
|
| 24 |
```
|
| 25 |
|
| 26 |
+
### `ExtendedSettingsConfigDict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L53"><Icon icon="github" size="14" /></a></sup>
|
| 27 |
|
| 28 |
+
### `Settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L57"><Icon icon="github" size="14" /></a></sup>
|
| 29 |
|
| 30 |
|
| 31 |
FastMCP settings.
|
|
|
|
| 33 |
|
| 34 |
**Methods:**
|
| 35 |
|
| 36 |
+
#### `settings_customise_sources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L69"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
settings_customise_sources(cls, settings_cls: type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) -> tuple[PydanticBaseSettingsSource, ...]
|
| 40 |
```
|
| 41 |
|
| 42 |
+
#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L87"><Icon icon="github" size="14" /></a></sup>
|
| 43 |
|
| 44 |
```python
|
| 45 |
settings(self) -> Self
|
|
|
|
| 49 |
which accessed fastmcp.settings.settings
|
| 50 |
|
| 51 |
|
| 52 |
+
#### `setup_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L182"><Icon icon="github" size="14" /></a></sup>
|
| 53 |
|
| 54 |
```python
|
| 55 |
setup_logging(self) -> Self
|
docs/python-sdk/fastmcp-tools-tool.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: tool
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `default_serializer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L34"
|
| 11 |
|
| 12 |
```python
|
| 13 |
default_serializer(data: Any) -> str
|
|
@@ -15,7 +15,7 @@ default_serializer(data: Any) -> str
|
|
| 15 |
|
| 16 |
## Classes
|
| 17 |
|
| 18 |
-
### `Tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L38"
|
| 19 |
|
| 20 |
|
| 21 |
Internal tool registration info.
|
|
@@ -23,13 +23,13 @@ Internal tool registration info.
|
|
| 23 |
|
| 24 |
**Methods:**
|
| 25 |
|
| 26 |
-
#### `to_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L49"
|
| 27 |
|
| 28 |
```python
|
| 29 |
to_mcp_tool(self, **overrides: Any) -> MCPTool
|
| 30 |
```
|
| 31 |
|
| 32 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L59"
|
| 33 |
|
| 34 |
```python
|
| 35 |
from_function(fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool
|
|
@@ -38,17 +38,17 @@ from_function(fn: Callable[..., Any], name: str | None = None, description: str
|
|
| 38 |
Create a Tool from a function.
|
| 39 |
|
| 40 |
|
| 41 |
-
#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L86"
|
| 42 |
|
| 43 |
```python
|
| 44 |
from_tool(cls, tool: Tool, transform_fn: Callable[..., Any] | None = None, name: str | None = None, transform_args: dict[str, ArgTransform] | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool
|
| 45 |
```
|
| 46 |
|
| 47 |
-
### `FunctionTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L113"
|
| 48 |
|
| 49 |
**Methods:**
|
| 50 |
|
| 51 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L117"
|
| 52 |
|
| 53 |
```python
|
| 54 |
from_function(cls, fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool
|
|
@@ -57,11 +57,11 @@ from_function(cls, fn: Callable[..., Any], name: str | None = None, description:
|
|
| 57 |
Create a Tool from a function.
|
| 58 |
|
| 59 |
|
| 60 |
-
### `ParsedFunction` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L194"
|
| 61 |
|
| 62 |
**Methods:**
|
| 63 |
|
| 64 |
-
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L201"
|
| 65 |
|
| 66 |
```python
|
| 67 |
from_function(cls, fn: Callable[..., Any], exclude_args: list[str] | None = None, validate: bool = True) -> ParsedFunction
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `default_serializer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L34"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
default_serializer(data: Any) -> str
|
|
|
|
| 15 |
|
| 16 |
## Classes
|
| 17 |
|
| 18 |
+
### `Tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L38"><Icon icon="github" size="14" /></a></sup>
|
| 19 |
|
| 20 |
|
| 21 |
Internal tool registration info.
|
|
|
|
| 23 |
|
| 24 |
**Methods:**
|
| 25 |
|
| 26 |
+
#### `to_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L49"><Icon icon="github" size="14" /></a></sup>
|
| 27 |
|
| 28 |
```python
|
| 29 |
to_mcp_tool(self, **overrides: Any) -> MCPTool
|
| 30 |
```
|
| 31 |
|
| 32 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L59"><Icon icon="github" size="14" /></a></sup>
|
| 33 |
|
| 34 |
```python
|
| 35 |
from_function(fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool
|
|
|
|
| 38 |
Create a Tool from a function.
|
| 39 |
|
| 40 |
|
| 41 |
+
#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L86"><Icon icon="github" size="14" /></a></sup>
|
| 42 |
|
| 43 |
```python
|
| 44 |
from_tool(cls, tool: Tool, transform_fn: Callable[..., Any] | None = None, name: str | None = None, transform_args: dict[str, ArgTransform] | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool
|
| 45 |
```
|
| 46 |
|
| 47 |
+
### `FunctionTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L113"><Icon icon="github" size="14" /></a></sup>
|
| 48 |
|
| 49 |
**Methods:**
|
| 50 |
|
| 51 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L117"><Icon icon="github" size="14" /></a></sup>
|
| 52 |
|
| 53 |
```python
|
| 54 |
from_function(cls, fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool
|
|
|
|
| 57 |
Create a Tool from a function.
|
| 58 |
|
| 59 |
|
| 60 |
+
### `ParsedFunction` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L194"><Icon icon="github" size="14" /></a></sup>
|
| 61 |
|
| 62 |
**Methods:**
|
| 63 |
|
| 64 |
+
#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L201"><Icon icon="github" size="14" /></a></sup>
|
| 65 |
|
| 66 |
```python
|
| 67 |
from_function(cls, fn: Callable[..., Any], exclude_args: list[str] | None = None, validate: bool = True) -> ParsedFunction
|
docs/python-sdk/fastmcp-tools-tool_manager.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: tool_manager
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `ToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L22"
|
| 11 |
|
| 12 |
|
| 13 |
Manages FastMCP tools.
|
|
@@ -15,7 +15,7 @@ Manages FastMCP tools.
|
|
| 15 |
|
| 16 |
**Methods:**
|
| 17 |
|
| 18 |
-
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L46"
|
| 19 |
|
| 20 |
```python
|
| 21 |
mount(self, server: MountedServer) -> None
|
|
@@ -24,7 +24,7 @@ mount(self, server: MountedServer) -> None
|
|
| 24 |
Adds a mounted server as a source for tools.
|
| 25 |
|
| 26 |
|
| 27 |
-
#### `add_tool_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L113"
|
| 28 |
|
| 29 |
```python
|
| 30 |
add_tool_from_fn(self, fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, exclude_args: list[str] | None = None) -> Tool
|
|
@@ -33,7 +33,7 @@ add_tool_from_fn(self, fn: Callable[..., Any], name: str | None = None, descript
|
|
| 33 |
Add a tool to the server.
|
| 34 |
|
| 35 |
|
| 36 |
-
#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L142"
|
| 37 |
|
| 38 |
```python
|
| 39 |
add_tool(self, tool: Tool) -> Tool
|
|
@@ -42,7 +42,7 @@ add_tool(self, tool: Tool) -> Tool
|
|
| 42 |
Register a tool with the server.
|
| 43 |
|
| 44 |
|
| 45 |
-
#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L159"
|
| 46 |
|
| 47 |
```python
|
| 48 |
remove_tool(self, key: str) -> None
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `ToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L22"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
Manages FastMCP tools.
|
|
|
|
| 15 |
|
| 16 |
**Methods:**
|
| 17 |
|
| 18 |
+
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L46"><Icon icon="github" size="14" /></a></sup>
|
| 19 |
|
| 20 |
```python
|
| 21 |
mount(self, server: MountedServer) -> None
|
|
|
|
| 24 |
Adds a mounted server as a source for tools.
|
| 25 |
|
| 26 |
|
| 27 |
+
#### `add_tool_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L113"><Icon icon="github" size="14" /></a></sup>
|
| 28 |
|
| 29 |
```python
|
| 30 |
add_tool_from_fn(self, fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, exclude_args: list[str] | None = None) -> Tool
|
|
|
|
| 33 |
Add a tool to the server.
|
| 34 |
|
| 35 |
|
| 36 |
+
#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L142"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
add_tool(self, tool: Tool) -> Tool
|
|
|
|
| 42 |
Register a tool with the server.
|
| 43 |
|
| 44 |
|
| 45 |
+
#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L159"><Icon icon="github" size="14" /></a></sup>
|
| 46 |
|
| 47 |
```python
|
| 48 |
remove_tool(self, key: str) -> None
|
docs/python-sdk/fastmcp-tools-tool_transform.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: tool_transform
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `ArgTransform` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L85"
|
| 11 |
|
| 12 |
|
| 13 |
Configuration for transforming a parent tool's argument.
|
|
@@ -49,7 +49,7 @@ ArgTransform(required=True)
|
|
| 49 |
ArgTransform(name="new_name", description="New desc", default=None, type=int)
|
| 50 |
|
| 51 |
|
| 52 |
-
### `TransformedTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L179"
|
| 53 |
|
| 54 |
|
| 55 |
A tool that is transformed from another tool.
|
|
@@ -65,7 +65,7 @@ with transformed arguments.
|
|
| 65 |
|
| 66 |
**Methods:**
|
| 67 |
|
| 68 |
-
#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L260"
|
| 69 |
|
| 70 |
```python
|
| 71 |
from_tool(cls, tool: Tool, name: str | None = None, description: str | None = None, tags: set[str] | None = None, transform_fn: Callable[..., Any] | None = None, transform_args: dict[str, ArgTransform] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `ArgTransform` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L85"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
Configuration for transforming a parent tool's argument.
|
|
|
|
| 49 |
ArgTransform(name="new_name", description="New desc", default=None, type=int)
|
| 50 |
|
| 51 |
|
| 52 |
+
### `TransformedTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L179"><Icon icon="github" size="14" /></a></sup>
|
| 53 |
|
| 54 |
|
| 55 |
A tool that is transformed from another tool.
|
|
|
|
| 65 |
|
| 66 |
**Methods:**
|
| 67 |
|
| 68 |
+
#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L260"><Icon icon="github" size="14" /></a></sup>
|
| 69 |
|
| 70 |
```python
|
| 71 |
from_tool(cls, tool: Tool, name: str | None = None, description: str | None = None, tags: set[str] | None = None, transform_fn: Callable[..., Any] | None = None, transform_args: dict[str, ArgTransform] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool
|
docs/python-sdk/fastmcp-utilities-cache.mdx
CHANGED
|
@@ -7,23 +7,23 @@ sidebarTitle: cache
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `TimedCache` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L7"
|
| 11 |
|
| 12 |
**Methods:**
|
| 13 |
|
| 14 |
-
#### `set` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L14"
|
| 15 |
|
| 16 |
```python
|
| 17 |
set(self, key: Any, value: Any) -> None
|
| 18 |
```
|
| 19 |
|
| 20 |
-
#### `get` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L18"
|
| 21 |
|
| 22 |
```python
|
| 23 |
get(self, key: Any) -> Any
|
| 24 |
```
|
| 25 |
|
| 26 |
-
#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L25"
|
| 27 |
|
| 28 |
```python
|
| 29 |
clear(self) -> None
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `TimedCache` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L7"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
**Methods:**
|
| 13 |
|
| 14 |
+
#### `set` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L14"><Icon icon="github" size="14" /></a></sup>
|
| 15 |
|
| 16 |
```python
|
| 17 |
set(self, key: Any, value: Any) -> None
|
| 18 |
```
|
| 19 |
|
| 20 |
+
#### `get` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L18"><Icon icon="github" size="14" /></a></sup>
|
| 21 |
|
| 22 |
```python
|
| 23 |
get(self, key: Any) -> Any
|
| 24 |
```
|
| 25 |
|
| 26 |
+
#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L25"><Icon icon="github" size="14" /></a></sup>
|
| 27 |
|
| 28 |
```python
|
| 29 |
clear(self) -> None
|
docs/python-sdk/fastmcp-utilities-components.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: components
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
-
### `FastMCPComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L21"
|
| 11 |
|
| 12 |
|
| 13 |
Base class for FastMCP tools, prompts, resources, and resource templates.
|
|
@@ -15,7 +15,7 @@ Base class for FastMCP tools, prompts, resources, and resource templates.
|
|
| 15 |
|
| 16 |
**Methods:**
|
| 17 |
|
| 18 |
-
#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L48"
|
| 19 |
|
| 20 |
```python
|
| 21 |
key(self) -> str
|
|
@@ -27,13 +27,13 @@ keys having a certain value, as the same tool loaded from different
|
|
| 27 |
hierarchies of servers may have different keys.
|
| 28 |
|
| 29 |
|
| 30 |
-
#### `with_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L57"
|
| 31 |
|
| 32 |
```python
|
| 33 |
with_key(self, key: str) -> Self
|
| 34 |
```
|
| 35 |
|
| 36 |
-
#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L69"
|
| 37 |
|
| 38 |
```python
|
| 39 |
enable(self) -> None
|
|
@@ -42,7 +42,7 @@ enable(self) -> None
|
|
| 42 |
Enable the component.
|
| 43 |
|
| 44 |
|
| 45 |
-
#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L73"
|
| 46 |
|
| 47 |
```python
|
| 48 |
disable(self) -> None
|
|
|
|
| 7 |
|
| 8 |
## Classes
|
| 9 |
|
| 10 |
+
### `FastMCPComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L21"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
|
| 13 |
Base class for FastMCP tools, prompts, resources, and resource templates.
|
|
|
|
| 15 |
|
| 16 |
**Methods:**
|
| 17 |
|
| 18 |
+
#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L48"><Icon icon="github" size="14" /></a></sup>
|
| 19 |
|
| 20 |
```python
|
| 21 |
key(self) -> str
|
|
|
|
| 27 |
hierarchies of servers may have different keys.
|
| 28 |
|
| 29 |
|
| 30 |
+
#### `with_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L57"><Icon icon="github" size="14" /></a></sup>
|
| 31 |
|
| 32 |
```python
|
| 33 |
with_key(self, key: str) -> Self
|
| 34 |
```
|
| 35 |
|
| 36 |
+
#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L69"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
enable(self) -> None
|
|
|
|
| 42 |
Enable the component.
|
| 43 |
|
| 44 |
|
| 45 |
+
#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L73"><Icon icon="github" size="14" /></a></sup>
|
| 46 |
|
| 47 |
```python
|
| 48 |
disable(self) -> None
|
docs/python-sdk/fastmcp-utilities-exceptions.mdx
CHANGED
|
@@ -7,13 +7,13 @@ sidebarTitle: exceptions
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `iter_exc` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L12"
|
| 11 |
|
| 12 |
```python
|
| 13 |
iter_exc(group: BaseExceptionGroup)
|
| 14 |
```
|
| 15 |
|
| 16 |
-
### `get_catch_handlers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L42"
|
| 17 |
|
| 18 |
```python
|
| 19 |
get_catch_handlers() -> Mapping[type[BaseException] | Iterable[type[BaseException]], Callable[[BaseExceptionGroup[Any]], Any]]
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `iter_exc` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L12"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
iter_exc(group: BaseExceptionGroup)
|
| 14 |
```
|
| 15 |
|
| 16 |
+
### `get_catch_handlers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L42"><Icon icon="github" size="14" /></a></sup>
|
| 17 |
|
| 18 |
```python
|
| 19 |
get_catch_handlers() -> Mapping[type[BaseException] | Iterable[type[BaseException]], Callable[[BaseExceptionGroup[Any]], Any]]
|
docs/python-sdk/fastmcp-utilities-http.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: http
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `find_available_port` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/http.py#L4"
|
| 11 |
|
| 12 |
```python
|
| 13 |
find_available_port() -> int
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `find_available_port` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/http.py#L4"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
find_available_port() -> int
|
docs/python-sdk/fastmcp-utilities-inspect.mdx
CHANGED
|
@@ -10,31 +10,31 @@ Utilities for inspecting FastMCP instances.
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
-
### `ToolInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L16"
|
| 14 |
|
| 15 |
|
| 16 |
Information about a tool.
|
| 17 |
|
| 18 |
|
| 19 |
-
### `PromptInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L29"
|
| 20 |
|
| 21 |
|
| 22 |
Information about a prompt.
|
| 23 |
|
| 24 |
|
| 25 |
-
### `ResourceInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L41"
|
| 26 |
|
| 27 |
|
| 28 |
Information about a resource.
|
| 29 |
|
| 30 |
|
| 31 |
-
### `TemplateInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L54"
|
| 32 |
|
| 33 |
|
| 34 |
Information about a resource template.
|
| 35 |
|
| 36 |
|
| 37 |
-
### `FastMCPInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L67"
|
| 38 |
|
| 39 |
|
| 40 |
Information extracted from a FastMCP instance.
|
|
|
|
| 10 |
|
| 11 |
## Classes
|
| 12 |
|
| 13 |
+
### `ToolInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L16"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
|
| 16 |
Information about a tool.
|
| 17 |
|
| 18 |
|
| 19 |
+
### `PromptInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L29"><Icon icon="github" size="14" /></a></sup>
|
| 20 |
|
| 21 |
|
| 22 |
Information about a prompt.
|
| 23 |
|
| 24 |
|
| 25 |
+
### `ResourceInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L41"><Icon icon="github" size="14" /></a></sup>
|
| 26 |
|
| 27 |
|
| 28 |
Information about a resource.
|
| 29 |
|
| 30 |
|
| 31 |
+
### `TemplateInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L54"><Icon icon="github" size="14" /></a></sup>
|
| 32 |
|
| 33 |
|
| 34 |
Information about a resource template.
|
| 35 |
|
| 36 |
|
| 37 |
+
### `FastMCPInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L67"><Icon icon="github" size="14" /></a></sup>
|
| 38 |
|
| 39 |
|
| 40 |
Information extracted from a FastMCP instance.
|
docs/python-sdk/fastmcp-utilities-json_schema.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: json_schema
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `compress_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/json_schema.py#L130"
|
| 11 |
|
| 12 |
```python
|
| 13 |
compress_schema(schema: dict, prune_params: list[str] | None = None, prune_defs: bool = True, prune_additional_properties: bool = True, prune_titles: bool = False) -> dict
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `compress_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/json_schema.py#L130"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
compress_schema(schema: dict, prune_params: list[str] | None = None, prune_defs: bool = True, prune_additional_properties: bool = True, prune_titles: bool = False) -> dict
|
docs/python-sdk/fastmcp-utilities-logging.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Logging utilities for FastMCP.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `get_logger` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L10"
|
| 14 |
|
| 15 |
```python
|
| 16 |
get_logger(name: str) -> logging.Logger
|
|
@@ -26,7 +26,7 @@ Get a logger nested under FastMCP namespace.
|
|
| 26 |
- a configured logger instance
|
| 27 |
|
| 28 |
|
| 29 |
-
### `configure_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L22"
|
| 30 |
|
| 31 |
```python
|
| 32 |
configure_logging(level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | int = 'INFO', logger: logging.Logger | None = None, enable_rich_tracebacks: bool = True) -> None
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `get_logger` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L10"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
get_logger(name: str) -> logging.Logger
|
|
|
|
| 26 |
- a configured logger instance
|
| 27 |
|
| 28 |
|
| 29 |
+
### `configure_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L22"><Icon icon="github" size="14" /></a></sup>
|
| 30 |
|
| 31 |
```python
|
| 32 |
configure_logging(level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | int = 'INFO', logger: logging.Logger | None = None, enable_rich_tracebacks: bool = True) -> None
|
docs/python-sdk/fastmcp-utilities-mcp_config.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: mcp_config
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `infer_transport_type_from_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L20"
|
| 11 |
|
| 12 |
```python
|
| 13 |
infer_transport_type_from_url(url: str | AnyUrl) -> Literal['http', 'sse']
|
|
@@ -19,31 +19,31 @@ Infer the appropriate transport type from the given URL.
|
|
| 19 |
|
| 20 |
## Classes
|
| 21 |
|
| 22 |
-
### `StdioMCPServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L40"
|
| 23 |
|
| 24 |
**Methods:**
|
| 25 |
|
| 26 |
-
#### `to_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L47"
|
| 27 |
|
| 28 |
```python
|
| 29 |
to_transport(self) -> StdioTransport
|
| 30 |
```
|
| 31 |
|
| 32 |
-
### `RemoteMCPServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L58"
|
| 33 |
|
| 34 |
**Methods:**
|
| 35 |
|
| 36 |
-
#### `to_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L71"
|
| 37 |
|
| 38 |
```python
|
| 39 |
to_transport(self) -> StreamableHttpTransport | SSETransport
|
| 40 |
```
|
| 41 |
|
| 42 |
-
### `MCPConfig` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L88"
|
| 43 |
|
| 44 |
**Methods:**
|
| 45 |
|
| 46 |
-
#### `from_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L92"
|
| 47 |
|
| 48 |
```python
|
| 49 |
from_dict(cls, config: dict[str, Any]) -> MCPConfig
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `infer_transport_type_from_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L20"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
infer_transport_type_from_url(url: str | AnyUrl) -> Literal['http', 'sse']
|
|
|
|
| 19 |
|
| 20 |
## Classes
|
| 21 |
|
| 22 |
+
### `StdioMCPServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L40"><Icon icon="github" size="14" /></a></sup>
|
| 23 |
|
| 24 |
**Methods:**
|
| 25 |
|
| 26 |
+
#### `to_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L47"><Icon icon="github" size="14" /></a></sup>
|
| 27 |
|
| 28 |
```python
|
| 29 |
to_transport(self) -> StdioTransport
|
| 30 |
```
|
| 31 |
|
| 32 |
+
### `RemoteMCPServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L58"><Icon icon="github" size="14" /></a></sup>
|
| 33 |
|
| 34 |
**Methods:**
|
| 35 |
|
| 36 |
+
#### `to_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L71"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
to_transport(self) -> StreamableHttpTransport | SSETransport
|
| 40 |
```
|
| 41 |
|
| 42 |
+
### `MCPConfig` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L88"><Icon icon="github" size="14" /></a></sup>
|
| 43 |
|
| 44 |
**Methods:**
|
| 45 |
|
| 46 |
+
#### `from_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_config.py#L92"><Icon icon="github" size="14" /></a></sup>
|
| 47 |
|
| 48 |
```python
|
| 49 |
from_dict(cls, config: dict[str, Any]) -> MCPConfig
|
docs/python-sdk/fastmcp-utilities-openapi.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: openapi
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `parse_openapi_to_http_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L112"
|
| 11 |
|
| 12 |
```python
|
| 13 |
parse_openapi_to_http_routes(openapi_dict: dict[str, Any]) -> list[HTTPRoute]
|
|
@@ -20,7 +20,7 @@ using the openapi-pydantic library.
|
|
| 20 |
Supports both OpenAPI 3.0.x and 3.1.x versions.
|
| 21 |
|
| 22 |
|
| 23 |
-
### `clean_schema_for_display` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L570"
|
| 24 |
|
| 25 |
```python
|
| 26 |
clean_schema_for_display(schema: JsonSchema | None) -> JsonSchema | None
|
|
@@ -30,7 +30,7 @@ clean_schema_for_display(schema: JsonSchema | None) -> JsonSchema | None
|
|
| 30 |
Clean up a schema dictionary for display by removing internal/complex fields.
|
| 31 |
|
| 32 |
|
| 33 |
-
### `generate_example_from_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L630"
|
| 34 |
|
| 35 |
```python
|
| 36 |
generate_example_from_schema(schema: JsonSchema | None) -> Any
|
|
@@ -41,7 +41,7 @@ Generate a simple example value from a JSON schema dictionary.
|
|
| 41 |
Very basic implementation focusing on types.
|
| 42 |
|
| 43 |
|
| 44 |
-
### `format_json_for_description` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L713"
|
| 45 |
|
| 46 |
```python
|
| 47 |
format_json_for_description(data: Any, indent: int = 2) -> str
|
|
@@ -51,7 +51,7 @@ format_json_for_description(data: Any, indent: int = 2) -> str
|
|
| 51 |
Formats Python data as a JSON string block for markdown.
|
| 52 |
|
| 53 |
|
| 54 |
-
### `format_description_with_responses` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L722"
|
| 55 |
|
| 56 |
```python
|
| 57 |
format_description_with_responses(base_description: str, responses: dict[str, Any], parameters: list[ParameterInfo] | None = None, request_body: RequestBodyInfo | None = None) -> str
|
|
@@ -76,31 +76,31 @@ including its description, whether it is required, and its content schema.
|
|
| 76 |
|
| 77 |
## Classes
|
| 78 |
|
| 79 |
-
### `ParameterInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L42"
|
| 80 |
|
| 81 |
|
| 82 |
Represents a single parameter for an HTTP operation in our IR.
|
| 83 |
|
| 84 |
|
| 85 |
-
### `RequestBodyInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L52"
|
| 86 |
|
| 87 |
|
| 88 |
Represents the request body for an HTTP operation in our IR.
|
| 89 |
|
| 90 |
|
| 91 |
-
### `ResponseInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L62"
|
| 92 |
|
| 93 |
|
| 94 |
Represents response information in our IR.
|
| 95 |
|
| 96 |
|
| 97 |
-
### `HTTPRoute` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L70"
|
| 98 |
|
| 99 |
|
| 100 |
Intermediate Representation for a single OpenAPI operation.
|
| 101 |
|
| 102 |
|
| 103 |
-
### `OpenAPIParser` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L164"
|
| 104 |
|
| 105 |
|
| 106 |
Unified parser for OpenAPI schemas with generic type parameters to handle both 3.0 and 3.1.
|
|
@@ -108,7 +108,7 @@ Unified parser for OpenAPI schemas with generic type parameters to handle both 3
|
|
| 108 |
|
| 109 |
**Methods:**
|
| 110 |
|
| 111 |
-
#### `parse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L469"
|
| 112 |
|
| 113 |
```python
|
| 114 |
parse(self) -> list[HTTPRoute]
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `parse_openapi_to_http_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L112"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
parse_openapi_to_http_routes(openapi_dict: dict[str, Any]) -> list[HTTPRoute]
|
|
|
|
| 20 |
Supports both OpenAPI 3.0.x and 3.1.x versions.
|
| 21 |
|
| 22 |
|
| 23 |
+
### `clean_schema_for_display` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L570"><Icon icon="github" size="14" /></a></sup>
|
| 24 |
|
| 25 |
```python
|
| 26 |
clean_schema_for_display(schema: JsonSchema | None) -> JsonSchema | None
|
|
|
|
| 30 |
Clean up a schema dictionary for display by removing internal/complex fields.
|
| 31 |
|
| 32 |
|
| 33 |
+
### `generate_example_from_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L630"><Icon icon="github" size="14" /></a></sup>
|
| 34 |
|
| 35 |
```python
|
| 36 |
generate_example_from_schema(schema: JsonSchema | None) -> Any
|
|
|
|
| 41 |
Very basic implementation focusing on types.
|
| 42 |
|
| 43 |
|
| 44 |
+
### `format_json_for_description` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L713"><Icon icon="github" size="14" /></a></sup>
|
| 45 |
|
| 46 |
```python
|
| 47 |
format_json_for_description(data: Any, indent: int = 2) -> str
|
|
|
|
| 51 |
Formats Python data as a JSON string block for markdown.
|
| 52 |
|
| 53 |
|
| 54 |
+
### `format_description_with_responses` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L722"><Icon icon="github" size="14" /></a></sup>
|
| 55 |
|
| 56 |
```python
|
| 57 |
format_description_with_responses(base_description: str, responses: dict[str, Any], parameters: list[ParameterInfo] | None = None, request_body: RequestBodyInfo | None = None) -> str
|
|
|
|
| 76 |
|
| 77 |
## Classes
|
| 78 |
|
| 79 |
+
### `ParameterInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L42"><Icon icon="github" size="14" /></a></sup>
|
| 80 |
|
| 81 |
|
| 82 |
Represents a single parameter for an HTTP operation in our IR.
|
| 83 |
|
| 84 |
|
| 85 |
+
### `RequestBodyInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L52"><Icon icon="github" size="14" /></a></sup>
|
| 86 |
|
| 87 |
|
| 88 |
Represents the request body for an HTTP operation in our IR.
|
| 89 |
|
| 90 |
|
| 91 |
+
### `ResponseInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L62"><Icon icon="github" size="14" /></a></sup>
|
| 92 |
|
| 93 |
|
| 94 |
Represents response information in our IR.
|
| 95 |
|
| 96 |
|
| 97 |
+
### `HTTPRoute` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L70"><Icon icon="github" size="14" /></a></sup>
|
| 98 |
|
| 99 |
|
| 100 |
Intermediate Representation for a single OpenAPI operation.
|
| 101 |
|
| 102 |
|
| 103 |
+
### `OpenAPIParser` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L164"><Icon icon="github" size="14" /></a></sup>
|
| 104 |
|
| 105 |
|
| 106 |
Unified parser for OpenAPI schemas with generic type parameters to handle both 3.0 and 3.1.
|
|
|
|
| 108 |
|
| 109 |
**Methods:**
|
| 110 |
|
| 111 |
+
#### `parse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L469"><Icon icon="github" size="14" /></a></sup>
|
| 112 |
|
| 113 |
```python
|
| 114 |
parse(self) -> list[HTTPRoute]
|
docs/python-sdk/fastmcp-utilities-tests.mdx
CHANGED
|
@@ -7,7 +7,7 @@ sidebarTitle: tests
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
-
### `temporary_settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L21"
|
| 11 |
|
| 12 |
```python
|
| 13 |
temporary_settings(**kwargs: Any)
|
|
@@ -20,7 +20,7 @@ Temporarily override FastMCP setting values.
|
|
| 20 |
- `**kwargs`: The settings to override, including nested settings.
|
| 21 |
|
| 22 |
|
| 23 |
-
### `run_server_in_process` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L74"
|
| 24 |
|
| 25 |
```python
|
| 26 |
run_server_in_process(server_fn: Callable[..., None], *args, **kwargs) -> Generator[str, None, None]
|
|
|
|
| 7 |
|
| 8 |
## Functions
|
| 9 |
|
| 10 |
+
### `temporary_settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L21"><Icon icon="github" size="14" /></a></sup>
|
| 11 |
|
| 12 |
```python
|
| 13 |
temporary_settings(**kwargs: Any)
|
|
|
|
| 20 |
- `**kwargs`: The settings to override, including nested settings.
|
| 21 |
|
| 22 |
|
| 23 |
+
### `run_server_in_process` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L74"><Icon icon="github" size="14" /></a></sup>
|
| 24 |
|
| 25 |
```python
|
| 26 |
run_server_in_process(server_fn: Callable[..., None], *args, **kwargs) -> Generator[str, None, None]
|
docs/python-sdk/fastmcp-utilities-types.mdx
CHANGED
|
@@ -10,7 +10,7 @@ Common types used across FastMCP.
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
-
### `get_cached_typeadapter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L35"
|
| 14 |
|
| 15 |
```python
|
| 16 |
get_cached_typeadapter(cls: T) -> TypeAdapter[T]
|
|
@@ -23,7 +23,7 @@ However, this isn't feasible for user-generated functions. Instead, we use a
|
|
| 23 |
cache to minimize the cost of creating them as much as possible.
|
| 24 |
|
| 25 |
|
| 26 |
-
### `issubclass_safe` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L45"
|
| 27 |
|
| 28 |
```python
|
| 29 |
issubclass_safe(cls: type, base: type) -> bool
|
|
@@ -33,7 +33,7 @@ issubclass_safe(cls: type, base: type) -> bool
|
|
| 33 |
Check if cls is a subclass of base, even if cls is a type variable.
|
| 34 |
|
| 35 |
|
| 36 |
-
### `is_class_member_of_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L55"
|
| 37 |
|
| 38 |
```python
|
| 39 |
is_class_member_of_type(cls: type, base: type) -> bool
|
|
@@ -46,7 +46,7 @@ Base can be a type, a UnionType, or an Annotated type. Generic types are not
|
|
| 46 |
considered members (e.g. T is not a member of list\[T]).
|
| 47 |
|
| 48 |
|
| 49 |
-
### `find_kwarg_by_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L77"
|
| 50 |
|
| 51 |
```python
|
| 52 |
find_kwarg_by_type(fn: Callable, kwarg_type: type) -> str | None
|
|
@@ -60,13 +60,13 @@ Includes union types that contain the kwarg_type, as well as Annotated types.
|
|
| 60 |
|
| 61 |
## Classes
|
| 62 |
|
| 63 |
-
### `FastMCPBaseModel` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L28"
|
| 64 |
|
| 65 |
|
| 66 |
Base model for FastMCP models.
|
| 67 |
|
| 68 |
|
| 69 |
-
### `Image` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L94"
|
| 70 |
|
| 71 |
|
| 72 |
Helper class for returning images from tools.
|
|
@@ -74,7 +74,7 @@ Helper class for returning images from tools.
|
|
| 74 |
|
| 75 |
**Methods:**
|
| 76 |
|
| 77 |
-
#### `to_image_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L131"
|
| 78 |
|
| 79 |
```python
|
| 80 |
to_image_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> ImageContent
|
|
@@ -83,7 +83,7 @@ to_image_content(self, mime_type: str | None = None, annotations: Annotations |
|
|
| 83 |
Convert to MCP ImageContent.
|
| 84 |
|
| 85 |
|
| 86 |
-
### `Audio` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L153"
|
| 87 |
|
| 88 |
|
| 89 |
Helper class for returning audio from tools.
|
|
@@ -91,13 +91,13 @@ Helper class for returning audio from tools.
|
|
| 91 |
|
| 92 |
**Methods:**
|
| 93 |
|
| 94 |
-
#### `to_audio_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L190"
|
| 95 |
|
| 96 |
```python
|
| 97 |
to_audio_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> AudioContent
|
| 98 |
```
|
| 99 |
|
| 100 |
-
### `File` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L211"
|
| 101 |
|
| 102 |
|
| 103 |
Helper class for returning audio from tools.
|
|
@@ -105,7 +105,7 @@ Helper class for returning audio from tools.
|
|
| 105 |
|
| 106 |
**Methods:**
|
| 107 |
|
| 108 |
-
#### `to_resource_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L250"
|
| 109 |
|
| 110 |
```python
|
| 111 |
to_resource_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> EmbeddedResource
|
|
|
|
| 10 |
|
| 11 |
## Functions
|
| 12 |
|
| 13 |
+
### `get_cached_typeadapter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L35"><Icon icon="github" size="14" /></a></sup>
|
| 14 |
|
| 15 |
```python
|
| 16 |
get_cached_typeadapter(cls: T) -> TypeAdapter[T]
|
|
|
|
| 23 |
cache to minimize the cost of creating them as much as possible.
|
| 24 |
|
| 25 |
|
| 26 |
+
### `issubclass_safe` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L45"><Icon icon="github" size="14" /></a></sup>
|
| 27 |
|
| 28 |
```python
|
| 29 |
issubclass_safe(cls: type, base: type) -> bool
|
|
|
|
| 33 |
Check if cls is a subclass of base, even if cls is a type variable.
|
| 34 |
|
| 35 |
|
| 36 |
+
### `is_class_member_of_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L55"><Icon icon="github" size="14" /></a></sup>
|
| 37 |
|
| 38 |
```python
|
| 39 |
is_class_member_of_type(cls: type, base: type) -> bool
|
|
|
|
| 46 |
considered members (e.g. T is not a member of list\[T]).
|
| 47 |
|
| 48 |
|
| 49 |
+
### `find_kwarg_by_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L77"><Icon icon="github" size="14" /></a></sup>
|
| 50 |
|
| 51 |
```python
|
| 52 |
find_kwarg_by_type(fn: Callable, kwarg_type: type) -> str | None
|
|
|
|
| 60 |
|
| 61 |
## Classes
|
| 62 |
|
| 63 |
+
### `FastMCPBaseModel` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L28"><Icon icon="github" size="14" /></a></sup>
|
| 64 |
|
| 65 |
|
| 66 |
Base model for FastMCP models.
|
| 67 |
|
| 68 |
|
| 69 |
+
### `Image` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L94"><Icon icon="github" size="14" /></a></sup>
|
| 70 |
|
| 71 |
|
| 72 |
Helper class for returning images from tools.
|
|
|
|
| 74 |
|
| 75 |
**Methods:**
|
| 76 |
|
| 77 |
+
#### `to_image_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L131"><Icon icon="github" size="14" /></a></sup>
|
| 78 |
|
| 79 |
```python
|
| 80 |
to_image_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> ImageContent
|
|
|
|
| 83 |
Convert to MCP ImageContent.
|
| 84 |
|
| 85 |
|
| 86 |
+
### `Audio` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L153"><Icon icon="github" size="14" /></a></sup>
|
| 87 |
|
| 88 |
|
| 89 |
Helper class for returning audio from tools.
|
|
|
|
| 91 |
|
| 92 |
**Methods:**
|
| 93 |
|
| 94 |
+
#### `to_audio_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L190"><Icon icon="github" size="14" /></a></sup>
|
| 95 |
|
| 96 |
```python
|
| 97 |
to_audio_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> AudioContent
|
| 98 |
```
|
| 99 |
|
| 100 |
+
### `File` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L211"><Icon icon="github" size="14" /></a></sup>
|
| 101 |
|
| 102 |
|
| 103 |
Helper class for returning audio from tools.
|
|
|
|
| 105 |
|
| 106 |
**Methods:**
|
| 107 |
|
| 108 |
+
#### `to_resource_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L250"><Icon icon="github" size="14" /></a></sup>
|
| 109 |
|
| 110 |
```python
|
| 111 |
to_resource_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> EmbeddedResource
|