Skip to content

feat(sphinx-autodoc-fastmcp): FastMCP tool docs extension#13

Merged
tony merged 14 commits intomainfrom
api-fastmcp
Apr 7, 2026
Merged

feat(sphinx-autodoc-fastmcp): FastMCP tool docs extension#13
tony merged 14 commits intomainfrom
api-fastmcp

Conversation

@tony
Copy link
Copy Markdown
Member

@tony tony commented Apr 6, 2026

Summary

Adds sphinx-autodoc-fastmcp: a Sphinx extension for documenting FastMCP tools with card-style desc layouts (aligned with sphinx-autodoc-api-style), safety badges, MyST directives (fastmcp-tool, fastmcp-tool-input, fastmcp-toolsummary), and roles (:tool:, :toolref:, :badge:, etc.).

Commits (per AGENTS.md)

  1. feat: package source + tests/ext/fastmcp/
  2. chore(workspace): root pyproject.toml + uv.lock only
  3. docs: package page, redirects, CHANGES, package-reference tests

Checklist

  • uv run pytest
  • uv run ruff check

tony added 3 commits April 6, 2026 14:17
why: Reusable Sphinx extension for FastMCP tool cards, badges, directives,
and cross-reference roles (extracted from libtmux-mcp local _ext).
what:
- New package with collector, directives (desc-based cards), roles, transforms
- Unit tests under tests/ext/fastmcp/
why: Register the new package for workspace resolution, dev deps, ruff,
and pytest discovery; lockfile pairs with manifest per AGENTS.md.
what:
- tool.uv.sources and dev dependency for sphinx-autodoc-fastmcp
- ruff first-party and per-file ignores; doctest testpaths
- uv.lock
why: Publish package reference in docs; legacy extensions/* redirects;
CHANGES entry; doctest expectations for workspace discovery.
what:
- docs/packages/sphinx-autodoc-fastmcp.md and redirects.txt line
- package_reference doctest set; test_package_reference expected names
- CHANGES bullet for the new extension
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 53.60082% with 451 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.14%. Comparing base (bae5717) to head (1b087d2).

Files with missing lines Patch % Lines
...doc-fastmcp/src/sphinx_autodoc_fastmcp/_parsing.py 31.13% 115 Missing ⚠️
...-fastmcp/src/sphinx_autodoc_fastmcp/_transforms.py 11.71% 113 Missing ⚠️
...-fastmcp/src/sphinx_autodoc_fastmcp/_directives.py 21.23% 89 Missing ⚠️
...c-fastmcp/src/sphinx_autodoc_fastmcp/_collector.py 17.58% 75 Missing ⚠️
docs/_ext/sab_demo.py 17.54% 47 Missing ⚠️
...todoc-fastmcp/src/sphinx_autodoc_fastmcp/_roles.py 59.09% 9 Missing ⚠️
...doc-fastmcp/src/sphinx_autodoc_fastmcp/__init__.py 95.34% 2 Missing ⚠️
...odoc-badges/src/sphinx_autodoc_badges/_visitors.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
- Coverage   89.17%   85.14%   -4.04%     
==========================================
  Files          78       95      +17     
  Lines        7576     8495     +919     
==========================================
+ Hits         6756     7233     +477     
- Misses        820     1262     +442     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…PI-style/pytest

why: Unified BadgeNode API for consistent badge styling across autodoc plugins;
restore FastMCP tool sections and TOC sidebar compact badges.

what:
- Add sphinx-autodoc-badges package with BadgeNode, builders, shared CSS
- Migrate sphinx-autodoc-fastmcp, api-style, pytest-fixtures to shared badges
- Document new package; update redirects and package reference tests
@tony tony marked this pull request as ready for review April 6, 2026 22:27
why: Consolidate iterative CSS work into one logical change: gptheme parity for
safety and MCP tool badges, TOC layout, robust colors when theme CSS loads later,
and subtle inset depth on solid pills.
what:
- sphinx_autodoc_badges: --sab-* fallbacks, buff shadow, TOC compact badges with icons
- sphinx_autodoc_fastmcp: matte palette, borders, metrics, dark theme type tool
tony added 9 commits April 6, 2026 19:04
…CSS reference

why: The stub page lacked API docs, intersphinx links, badge demos, and
CSS variable/class documentation that sibling package pages provide.
what:
- conf.py: sys.path + sphinx_autodoc_badges + sab_demo extensions
- sab_demo.py: directive rendering every badge variant via real API
- sphinx-autodoc-badges.md: setup/intersphinx, autodoc API, live demos,
  CSS custom properties, class reference, context sizing, downstream table
why: Extensions and downstream docs need explicit size control that composes
with fill, style, and color classes without being overridden by context selectors.
what:
- CSS: sab-xs/sab-sm/sab-lg/sab-xl classes; context rules wrapped in :where()
- Python: badge_size param on BadgeNode, size param on build_badge()
- SAB constants: XS, SM, LG, XL
- Tests for size classes, invalid size ValueError, build_badge forwarding
why: Document the new xs/sm/lg/xl size API alongside existing badge demos.
what:
- sab_demo.py: size variants row (xs through xl side-by-side)
- sphinx-autodoc-badges.md: badge_size param, sab-xs–sab-xl in CSS table,
  note that explicit sizes override context selectors
…only

why: BadgeNode renders <span>, not <abbr>; the abbr.gas-badge / abbr.spf-badge
selectors no longer match, so border-color reinforcement was lost.
what:
- api_style.css: abbr.gas-* → .gas-*.gas-badge (element-agnostic)
- sphinx_autodoc_pytest_fixtures.css: abbr.spf-* → .spf-*.spf-badge
…grounds

why: sab-outline sets background:transparent at (0,2,0) specificity, which
overrides gas-type-*/spf-* background-color at (0,1,0). Production badges
are filled — the extension CSS provides the backgrounds, not sab.
what:
- api-style: type badges use default fill (filled); modifiers keep outline
- pytest-fixtures: all badges use default fill (CSS handles backgrounds)
why: The abbr→class migration dropped text-decoration: underline dotted
that was previously on abbr.gas-badge.
what:
- Add text-decoration: underline dotted to .gas-badge base rule
why: CI runs mypy . (whole workspace) but local ran mypy src tests;
dict return annotation needs generic args to pass strict type-arg check.
what:
- Add import typing as t
- Annotate setup() return type as dict[str, t.Any]
…e fix

why: Record the badges infrastructure, size API, and rendering regression fix.
what:
- Features: sphinx-autodoc-badges package, xs/sm/lg/xl size variants
- Bug fixes: badge colors/borders/underline after BadgeNode migration
- Workspace packages: sphinx-autodoc-badges entry
…ection

why: Undocumented autodoc objects left empty desc_content, producing blank
<dd> rows and extra vertical space in API cards.
what:
- Add _prune_empty_desc_content with doctest
- Invoke it from on_doctree_resolved for handled py desc nodes
- Add unit tests for direct prune, nonempty preserve, and pipeline
@tony tony merged commit 645b0ae into main Apr 7, 2026
32 checks passed
@tony tony deleted the api-fastmcp branch April 7, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants