Skip to content

Entry Points

The CLI and server entry points are documented below.

mcp_zen_of_languages.cli.main

main(argv=None)

Top-level CLI entry point invoked by the zen console script.

With no arguments the welcome panel is displayed and the process exits cleanly. Otherwise argv is forwarded to the Typer :pydata:app instance. All Typer and Click exceptions are caught so the function always returns a numeric exit code rather than raising.

PARAMETER DESCRIPTION
argv

Command-line tokens; defaults to sys.argv[1:].

TYPE: list[str] | None DEFAULT: None

RETURNS DESCRIPTION
int

Process exit code — 0 for success, non-zero on errors.

TYPE: int

See Also

_build_welcome_panel: Rendered when no arguments are supplied.

Source code in src/mcp_zen_of_languages/cli.py
def main(argv: list[str] | None = None) -> int:
    """Top-level CLI entry point invoked by the ``zen`` console script.

    With no arguments the welcome panel is displayed and the process exits
    cleanly.  Otherwise *argv* is forwarded to the Typer :pydata:`app`
    instance.  All Typer and Click exceptions are caught so the function
    always returns a numeric exit code rather than raising.

    Args:
        argv (list[str] | None, optional): Command-line tokens; defaults to ``sys.argv[1:]``.

    Returns:
        int: Process exit code — ``0`` for success, non-zero on errors.

    See Also:
        ``_build_welcome_panel``: Rendered when no arguments are supplied.
    """
    if argv is None:
        argv = sys.argv[1:]
    if not argv:
        if not is_quiet():
            _build_welcome_panel()
        return 0
    try:
        result = app(args=argv, prog_name="zen", standalone_mode=False)
    except typer.Exit as exc:
        return exc.exit_code
    except click.ClickException as exc:
        exc.show()
        raise SystemExit(exc.exit_code) from exc
    except SystemExit as exc:
        return int(exc.code) if isinstance(exc.code, int) else 1
    return result if isinstance(result, int) else 0

mcp_zen_of_languages.__main__.main

main()

Start the FastMCP server with stdio transport.

Stdio transport is the standard MCP communication channel: the server reads JSON-RPC requests from stdin and writes responses to stdout, letting any MCP-compatible client drive the interaction. Once running, the server exposes tools for code analysis, reporting, and configuration management.

See Also

server.mcp: The FastMCP instance that registers all available MCP tools and handles request routing.

Source code in src/mcp_zen_of_languages/__main__.py
def main() -> None:
    """Start the FastMCP server with stdio transport.

    Stdio transport is the standard MCP communication channel: the server
    reads JSON-RPC requests from stdin and writes responses to stdout,
    letting any MCP-compatible client drive the interaction. Once running,
    the server exposes tools for code analysis, reporting, and
    configuration management.

    See Also:
        server.mcp: The ``FastMCP`` instance that registers all available
            MCP tools and handles request routing.
    """
    mcp.run()