fastmcp.utilities.ui
Shared UI utilities for FastMCP HTML pages.
This module provides reusable HTML/CSS components for OAuth callbacks,
consent pages, and other user-facing interfaces.
Functions
create_page
content
: HTML content to place inside the pagetitle
: Page titleadditional_styles
: Extra CSS to includecsp_policy
: Content Security Policy header value
- Complete HTML page as string
create_logo
icon_url
: Optional custom icon URL. If not provided, uses the FastMCP logo.alt_text
: Alt text for the logo image.
- HTML for logo image tag.
create_status_message
message
: Status message textis_success
: True for success (✓), False for error (✕)
- HTML for status message
create_info_box
content
: HTML content for the info boxis_error
: True for error styling, False for normalcentered
: True to center the text, False for left-alignedmonospace
: True to use gray monospace font styling instead of blue
- HTML for info box
create_detail_box
rows
: List of (label, value) tuples
- HTML for detail box
create_button_group
buttons
: List of (text, value, css_class) tuples
- HTML for button group
create_secure_html_response
html
: HTML content to returnstatus_code
: HTTP status code
- HTMLResponse with security headers