Skip to main content

FastUCP ⚡️

The "FastAPI" for the Universal Commerce Protocol (UCP).

FastUCP is a high-performance, developer-friendly Python framework for building UCP-compliant Merchant Servers and Commerce Agents. It combines the strict compliance of Google's Official UCP SDK models with the intuitive developer experience of FastAPI.

Python License Status

🌟 Why FastUCP?

The Universal Commerce Protocol involves complex JSON schemas, rigorous validation rules, and deep object nesting. FastUCP abstracts this complexity away.

  • 🧱 Official Models: Built directly on top of Google's auto-generated Pydantic models for 100% protocol compliance.
  • 🚀 Developer Experience: No more manual JSON construction. Use our CheckoutBuilder to write business logic, not boilerplate.
  • 🔍 Auto-Discovery: Automatically generates the /.well-known/ucp manifest based on your registered endpoints.
  • 🔌 Facade Pattern: Access all complex UCP types from a single, clean import: fastucp.types.

📦 Installation

Requires Python 3.10+

# Using pip
pip install fastucp-python

# Using uv (Recommended)
uv add fastucp-python

⚡️ Quick Start

Here is a minimal Merchant Server ("Hello World") that sells a single item. FastUCP handles the manifest generation, endpoint routing, and protocol headers automatically.

# main.py
from fastucp import FastUCP
from fastucp.shortcuts import CheckoutBuilder
from fastucp.types import CheckoutCreateRequest

# 1. Initialize the App
app = FastUCP(
    title="Hello World Store", 
    base_url="http://127.0.0.1:8000"
)

@app.checkout("/checkout-sessions")
def create_session(payload: CheckoutCreateRequest):
    

    cart = CheckoutBuilder(app, session_id="demo_session_1")
    
    
    cart.add_item(
        item_id="sku_1",
        title="Hello World T-Shirt",
        price=2000, 
        quantity=1,
        img_url="https://placehold.co/400"
    )
    
    
    return cart.build()

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="127.0.0.1", port=8000)

Run the Server

python main.py

Your server is now live and UCP Compliant!

Manifest: http://127.0.0.1:8000/.well-known/ucp Checkout: http://127.0.0.1:8000/checkout-sessions

🧩 Key Features

  1. The Builder Pattern Instead of dealing with nested Pydantic models like LineItemResponse(totals=[TotalResponse(...)]), you simply use:
cart.add_item(..., price=500, quantity=2)

FastUCP handles the calculations and structure for you.

  1. Payment Presets Easily integrate supported payment handlers without digging into schema details:
from fastucp.presets import GooglePay

app.add_payment_handler(
    GooglePay(merchant_id="123", gateway="stripe", ...)
)
  1. AI Agent Ready (MCP) FastUCP servers are designed to be easily consumed by LLM Agents (Claude, Gemini, OpenAI) via the Model Context Protocol (MCP), bridging the gap between traditional e-commerce and AI Agents.

Metadata

Release files for fastucp-python 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastucp-python 0.1.2
File Size Uploaded Provenance Actions
fastucp_python-0.1.2.tar.gz 36.1 kB Without provenance Details for fastucp_python-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastucp-python 0.1.2
File Interpreter ABI Platform Actions
fastucp_python-0.1.2-py3-none-any.whl Python 3 none any Details for fastucp_python-0.1.2-py3-none-any.whl

Total release size: 141.5 kB

Release files / fastucp_python-0.1.2.tar.gz

Download URL fastucp_python-0.1.2.tar.gz
Size 36.1 kB
Tags Source
SHA-256 checksum
How to use checksums
70d27f00777c9a29151953eb77be5bc6f904b6530aa7a5ad6cf35f79541457e1
BLAKE2b-256 checksum
How to use checksums
e1b8b401e4c93190bd31339f2a4643036ea71f016d8b0a39a0a5ee5e5684f89c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release files / fastucp_python-0.1.2-py3-none-any.whl

Download URL fastucp_python-0.1.2-py3-none-any.whl
Size 105.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fe140fc21e701d4ecaac5070759222acfaa62936555dca3bd8a9a328ef13542
BLAKE2b-256 checksum
How to use checksums
fc0fd83662a80bb5496df557dc656269ec10769db0f8acc0e186417c11ec6422
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Security for fastucp-python 0.1.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page