API Reference

Config reference

Generated from add_config_value() registrations in sphinx_autodoc_fastmcp/__init__.py.

fastmcp_tool_modules
config env
config env
fastmcp_tool_modules

Dotted module paths whose register(server) hooks expose FastMCP tools to autodoc. Each module is imported once at builder-inited and its tools are added to the rendered reference.

Type:

list

Default:

[]

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_area_map
config env
config env
fastmcp_area_map

Mapping of tool-module suffix (e.g. "session_tools") to the docs area page that owns its tools (e.g. "sessions"). Drives cross-reference resolution and the area badge in card layouts.

Type:

dict

Default:

{}

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_model_module
config env
config env
fastmcp_model_module

Dotted module containing the Pydantic model classes referenced by tool return types. Used to resolve {fastmcp-model} cross-references.

Type:

str

Default:

''

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_model_classes
config env
config env
fastmcp_model_classes

Iterable of model class names within fastmcp_model_module to autodoc. Empty default skips model rendering entirely.

Type:

tuple

Default:

()

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_section_badge_map
config env
config env
fastmcp_section_badge_map

Mapping of docstring section heading (e.g. "Inspect") to the badge it renders with, either "term" or "axis:term" naming a term declared in fastmcp_axes. Drives the inline section pills next to grouped tool lists.

Type:

dict

Default:

{}

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_section_badge_pages
config env
config env
fastmcp_section_badge_pages

Iterable of docnames where fastmcp_section_badge_map should be applied. Pages outside this list render plain section headings.

Type:

tuple

Default:

()

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_axes
config env
config env
fastmcp_axes

Independent ways of classifying a tool, each rendering its own badge. Every entry is a mapping with "name", an optional "source" ("tags", "annotations" or "meta:<key>") and "terms". A term is a tag name or a mapping with "term" and optional "label" / "tooltip" / "icon" / "tone" / "style" / "fill" / "classes". Empty declares no axes. A tool matching no term on an axis renders no badge for it rather than being reported as the lowest term.

Type:

tuple

Default:

()

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_collector_mode
config env
config env
fastmcp_collector_mode

How tools are gathered from each fastmcp_tool_modules entry. "register" calls the module’s register(server) hook (the FastMCP convention); "introspect" walks module attributes for @server.tool-decorated callables.

Type:

str

Default:

'register'

Registered by:

sphinx_autodoc_fastmcp.setup()

fastmcp_server_module
config env
config env
fastmcp_server_module

"pkg.module:attribute" path to a live FastMCP instance. When set, the collector walks the server’s providers – mounted servers, aggregates and the transforms each applies – so docs enumerate the same surface the server serves: tools, prompts, resources and resource templates. Tools read this way take precedence over fastmcp_tool_modules.

Type:

str

Default:

''

Registered by:

sphinx_autodoc_fastmcp.setup()

Directive and role reference

Generated from add_directive() and add_role() registrations in sphinx_autodoc_fastmcp/__init__.py via sphinx-autodoc-docutils.

.. fastmcp-tool::
directive
directive
.. fastmcp-tool::

Autodocument one MCP tool: section (ToC/labels) + card body.

Options:

Python path:

sphinx_autodoc_fastmcp._directives.FastMCPToolDirective

Required arguments:

1

Optional arguments:

0

Final argument whitespace:

False

Has content:

True

:no-index:
option
option
:no-index:

Validator: flag.

.. fastmcp-tool-input::
directive
directive
.. fastmcp-tool-input::

Emit the parameter table for a tool.

Python path:

sphinx_autodoc_fastmcp._directives.FastMCPToolInputDirective

Required arguments:

1

Optional arguments:

0

Final argument whitespace:

False

Has content:

False

.. fastmcp-tool-summary::
directive
directive
.. fastmcp-tool-summary::

Summary tables of tools grouped by one axis.

Python path:

sphinx_autodoc_fastmcp._directives.FastMCPToolSummaryDirective

Required arguments:

0

Optional arguments:

1

Final argument whitespace:

False

Has content:

False

.. fastmcp-prompt::
directive
directive
.. fastmcp-prompt::

Autodocument one MCP prompt: section + card body.

Options:

Python path:

sphinx_autodoc_fastmcp._directives.FastMCPPromptDirective

Required arguments:

1

Optional arguments:

0

Final argument whitespace:

False

Has content:

True

:no-index:
option
option
:no-index:

Validator: flag.

.. fastmcp-prompt-input::
directive
directive
.. fastmcp-prompt-input::

Emit the argument table for a prompt.

Python path:

sphinx_autodoc_fastmcp._directives.FastMCPPromptInputDirective

Required arguments:

1

Optional arguments:

0

Final argument whitespace:

False

Has content:

False

.. fastmcp-resource::
directive
directive
.. fastmcp-resource::

Autodocument one MCP resource (fixed URI).

Options:

Python path:

sphinx_autodoc_fastmcp._directives.FastMCPResourceDirective

Required arguments:

1

Optional arguments:

0

Final argument whitespace:

False

Has content:

True

:no-index:
option
option
:no-index:

Validator: flag.

.. fastmcp-resource-template::
directive
directive
.. fastmcp-resource-template::

Autodocument one MCP resource template (parameterised URI).

Options:

Python path:

sphinx_autodoc_fastmcp._directives.FastMCPResourceTemplateDirective

Required arguments:

1

Optional arguments:

0

Final argument whitespace:

False

Has content:

True

:no-index:
option
option
:no-index:

Validator: flag.

:tool:
role
role
:tool:

Role :tool:`name` → link + badge (resolved later).

class:

class_option

:toolref:
role
role
:toolref:

Role :toolref:`name` → link without badge.

class:

class_option

:toolicon:
role
role
:toolicon:

Autodocumented role callable.

class:

class_option

:tooliconl:
role
role
:tooliconl:

Autodocumented role callable.

class:

class_option

:tooliconr:
role
role
:tooliconr:

Autodocumented role callable.

class:

class_option

:tooliconil:
role
role
:tooliconil:

Autodocumented role callable.

class:

class_option

:tooliconir:
role
role
:tooliconir:

Autodocumented role callable.

class:

class_option

:resource:
role
role
:resource:

Autodocumented role callable.

class:

class_option

:resourceref:
role
role
:resourceref:

Autodocumented role callable.

class:

class_option

:prompt:
role
role
:prompt:

Autodocumented role callable.

class:

class_option

:promptref:
role
role
:promptref:

Autodocumented role callable.

class:

class_option

:badge:
role
role
:badge:

Role :badge:`readonly` or :badge:`risk:readonly` → axis badge.

class:

class_option

Extension entry point

sphinx_autodoc_fastmcp.setup(app)
function[source]
function[source]
sphinx_autodoc_fastmcp.setup(app)

Register the sphinx_autodoc_fastmcp extension.

Parameters:

app (Sphinx) – Sphinx application.

Returns:

Extension metadata (version, parallel flags).

Return type:

dict[str, Any]

Examples

>>> from sphinx_autodoc_fastmcp import setup
>>> callable(setup)
True