Skip to content

Mcp Utils

docforge.cli.mcp_utils

Classes

Functions

generate_resources

generate_resources(module: str, project_name: str | None, out_dir: Path) -> None

Generate MCP documentation resources from a Python module.

The function performs project introspection, builds the internal documentation model, and renders MCP-compatible JSON resources to the specified output directory.

Parameters:

Name Type Description Default
module str

Python module import path used as the entry point for documentation generation.

required
project_name str | None

Optional override for the project name used in generated documentation metadata.

required
out_dir Path

Directory where MCP resources (index.json, nav.json, and module data) will be written.

required

serve

serve(module: str, mcp_root: Path) -> None

Start an MCP server for a pre-generated documentation bundle.

The server exposes documentation resources such as project metadata, navigation structure, and module documentation through MCP endpoints.

Parameters:

Name Type Description Default
module str

Python module import path used to identify the served documentation instance.

required
mcp_root Path

Path to the directory containing the MCP documentation bundle (index.json, nav.json, and modules/).

required

Raises:

Type Description
ClickException

If the MCP documentation bundle is missing required files or directories.