From dc3630bc9327d4dec918b1c9d5c01b82138ab1b4 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Sun, 22 Jun 2025 15:15:15 -0500 Subject: [PATCH] adapt to new structure --- docs/docs.json | 26 +++++++++--- docs/python-sdk/fastmcp-cli-cli.mdx | 21 ++++++++++ docs/python-sdk/fastmcp-utilities-inspect.mdx | 41 ++++++++++++++++++ docs/python-sdk/fastmcp-utilities-tests.mdx | 42 +++++++++++++++++++ justfile | 2 +- 5 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 docs/python-sdk/fastmcp-utilities-inspect.mdx create mode 100644 docs/python-sdk/fastmcp-utilities-tests.mdx diff --git a/docs/docs.json b/docs/docs.json index c92615af0..be0b82944 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -76,7 +76,9 @@ { "group": "Authentication", "icon": "shield-check", - "pages": ["servers/auth/bearer"] + "pages": [ + "servers/auth/bearer" + ] }, "servers/middleware", "servers/openapi", @@ -85,7 +87,10 @@ { "group": "Deployment", "icon": "upload", - "pages": ["deployment/running-server", "deployment/asgi"] + "pages": [ + "deployment/running-server", + "deployment/asgi" + ] } ] }, @@ -116,7 +121,10 @@ { "group": "Authentication", "icon": "user-shield", - "pages": ["clients/auth/oauth", "clients/auth/bearer"] + "pages": [ + "clients/auth/oauth", + "clients/auth/bearer" + ] } ] }, @@ -155,13 +163,17 @@ }, { "anchor": "What's New", - "pages": ["updates", "changelog"] + "pages": [ + "updates", + "changelog" + ] }, - { "anchor": "Community", "icon": "users", - "pages": ["community/showcase"] + "pages": [ + "community/showcase" + ] } ] }, @@ -268,10 +280,12 @@ "python-sdk/fastmcp-utilities-components", "python-sdk/fastmcp-utilities-exceptions", "python-sdk/fastmcp-utilities-http", + "python-sdk/fastmcp-utilities-inspect", "python-sdk/fastmcp-utilities-json_schema", "python-sdk/fastmcp-utilities-logging", "python-sdk/fastmcp-utilities-mcp_config", "python-sdk/fastmcp-utilities-openapi", + "python-sdk/fastmcp-utilities-tests", "python-sdk/fastmcp-utilities-types" ] } diff --git a/docs/python-sdk/fastmcp-cli-cli.mdx b/docs/python-sdk/fastmcp-cli-cli.mdx index 1ebb968b2..60c24c556 100644 --- a/docs/python-sdk/fastmcp-cli-cli.mdx +++ b/docs/python-sdk/fastmcp-cli-cli.mdx @@ -63,3 +63,24 @@ Install a MCP server in the Claude desktop app. Environment variables are preserved once added and only updated if new values are explicitly provided. + +### `inspect` + +```python +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 +``` + + +Inspect a FastMCP server and generate a JSON report. + + This command analyzes a FastMCP server (v1.x or v2.x) and generates + a comprehensive JSON report containing information about the server's + name, instructions, version, tools, prompts, resources, templates, + and capabilities. + + Examples: + fastmcp inspect server.py + fastmcp inspect server.py -o report.json + fastmcp inspect server.py:mcp -o analysis.json + fastmcp inspect path/to/server.py:app -o /tmp/server-info.json + diff --git a/docs/python-sdk/fastmcp-utilities-inspect.mdx b/docs/python-sdk/fastmcp-utilities-inspect.mdx new file mode 100644 index 000000000..0f12cd8a0 --- /dev/null +++ b/docs/python-sdk/fastmcp-utilities-inspect.mdx @@ -0,0 +1,41 @@ +--- +title: inspect +sidebarTitle: inspect +--- + +# `fastmcp.utilities.inspect` + + +Utilities for inspecting FastMCP instances. + +## Classes + +### `ToolInfo` + + +Information about a tool. + + +### `PromptInfo` + + +Information about a prompt. + + +### `ResourceInfo` + + +Information about a resource. + + +### `TemplateInfo` + + +Information about a resource template. + + +### `FastMCPInfo` + + +Information extracted from a FastMCP instance. + diff --git a/docs/python-sdk/fastmcp-utilities-tests.mdx b/docs/python-sdk/fastmcp-utilities-tests.mdx new file mode 100644 index 000000000..817f113d0 --- /dev/null +++ b/docs/python-sdk/fastmcp-utilities-tests.mdx @@ -0,0 +1,42 @@ +--- +title: tests +sidebarTitle: tests +--- + +# `fastmcp.utilities.tests` + +## Functions + +### `temporary_settings` + +```python +temporary_settings(**kwargs: Any) +``` + + +Temporarily override ControlFlow setting values. + +**Args:** +- `**kwargs`: The settings to override, including nested settings. + + +### `run_server_in_process` + +```python +run_server_in_process(server_fn: Callable[..., None], *args, **kwargs) -> Generator[str, None, None] +``` + + +Context manager that runs a FastMCP server in a separate process and +returns the server URL. When the context manager is exited, the server process is killed. + +**Args:** +- `server_fn`: The function that runs a FastMCP server. FastMCP servers are +not pickleable, so we need a function that creates and runs one. +- `*args`: Arguments to pass to the server function. +- `provide_host_and_port`: Whether to provide the host and port to the server function as kwargs. +- `**kwargs`: Keyword arguments to pass to the server function. + +**Returns:** +- The server URL. + diff --git a/justfile b/justfile index fc2f33501..83fed54e8 100644 --- a/justfile +++ b/justfile @@ -16,7 +16,7 @@ docs: # Generate API reference documentation for all modules api-ref-all: - uvx --with-editable . --refresh-package mdxify mdxify@latest --all --root-module fastmcp --anchor-name "SDK Reference" + uv run --with-editable . --with git+https://github.com/zzstoatzz/mdxify.git@fix-nested-anchor-navigation mdxify --all --root-module fastmcp --anchor-name "Python SDK" --exclude fastmcp.contrib # Generate API reference for specific modules (e.g., just api-ref prefect.flows prefect.tasks) api-ref *MODULES: