60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
QR Code MCP App
An MCP App server that generates QR codes with an interactive viewer UI. Ported from the ext-apps QR server example to demonstrate FastMCP's MCP Apps support.
What it demonstrates
- Linking a tool to a
ui://resource viaAppConfig - Serving embedded HTML with the
@modelcontextprotocol/ext-appsJS SDK from CDN - Declaring CSP resource domains via
ResourceCSP - Returning
ImageContent(base64 PNG) from a tool
Setup
cd examples/apps/qr_server
uv sync
Usage
uv run python qr_server.py
Or install it into an MCP client:
fastmcp install stdio fastmcp.json
How it works
The server registers one tool (generate_qr) and one resource (ui://qr-server/view.html). The tool generates a QR code as a base64 PNG image. The resource serves an HTML page that uses the MCP Apps JS SDK to receive the tool result and display the image in a sandboxed iframe.
The HTML loads the ext-apps SDK from unpkg, so the resource declares csp=ResourceCSP(resource_domains=["https://unpkg.com"]) to allow the host to set the appropriate Content-Security-Policy.