fastmcp-apps-sdk
Widgets SDK for FastMCP targeting OpenAI Apps SDK. It provides a simple @widget(...) decorator and helpers to:
- Register a
text/html+skybridgeresource with CSP hints - Expose a tool with
openai/outputTemplateand widget metadata - Return structured content + narration with
build_widget_tool_response
Install
- pip:
pip install fastmcp-apps-sdk - uv:
uv add fastmcp-apps-sdk
Usage
from fastmcp import FastMCP
from fastmcp_apps_sdk import widget, build_widget_tool_response, register_decorated_widgets
@widget(
identifier="hello-widget",
title="Hello Widget",
template_uri="ui://widget/hello.html",
invoking="Saying hello",
invoked="Said hello",
html='<div id="hello-root"></div><script type="module" src="https://example.com/hello.js"></script>',
)
def hello(name: str = "world"):
return build_widget_tool_response(
response_text=f"Hello {name}!",
structured_content={"name": name},
)
mcp = FastMCP(name="demo", instructions="Demo widgets")
register_decorated_widgets(mcp)
mcp.run(transport="http", host="0.0.0.0", port=8080)
Examples
- See
examples/for Solar System and Pizza widgets. - Run locally (with uv):
uv pip install -e .(orpip install -e .)uv run examples/server.pyngrok http 8080and use the HTTPS URL as the MCP endpoint.
Publish to PyPI
- Ensure your version in
pyproject.tomlis updated. - Build with uv:
uv build(creates wheel and sdist underdist/) - Publish with uv:
uv publish --token <pypi-token> - Alternative with Twine:
python -m pip install build twinepython -m buildtwine upload dist/*
Notes
- No auth, env vars, or external tools are included in this package.
- The example server intentionally runs without authentication for easy testing.
Metadata
Release files for fastmcp-apps-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastmcp_apps_sdk-1.0.0.tar.gz | 59.7 kB | Without provenance | Details for fastmcp_apps_sdk-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastmcp_apps_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for fastmcp_apps_sdk-1.0.0-py3-none-any.whl |
Total release size: 64.4 kB
Release files / fastmcp_apps_sdk-1.0.0.tar.gz
| Download URL | fastmcp_apps_sdk-1.0.0.tar.gz |
|---|---|
| Size | 59.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f6ae701e7bb528094a0c3daffe0b3edad68eef9e4db9bd5bfd611bf9916eea0
|
|
BLAKE2b-256 checksum How to use checksums |
f50804247317835a256a99d5cbef2743f9e3fcc0b599535439e82d9f06672201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Release files / fastmcp_apps_sdk-1.0.0-py3-none-any.whl
| Download URL | fastmcp_apps_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b6acf407bb8c16cfe50484fbdba7bac25cd93f77606787279555f0cce79077d
|
|
BLAKE2b-256 checksum How to use checksums |
301066610aeb95511eb3eac3b8c6b0a38099361dd95de5fd970be2e4fbb56097
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Security for fastmcp-apps-sdk 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.