Skip to main content

Model Context Protocol for Unfazed

Project description

Unfazed MCP

Installation

pip install unfazed-mcp

Quick Start

Use in your project

# event.application.py

from unfazed.core import Unfazed
from unfazed.lifespan import BaseLifeSpan

from unfazed_mcp.backends import UnfazedFastMCP

from .endpoints import ping

event_mcp = UnfazedFastMCP(
    name="event",
)
event_mcp.tool(ping)

event_app = event_mcp.http_app(
    path="/mcp", transport="streamable-http"
)


class EventMCPLifespan(BaseLifeSpan):
    def __init__(self, app: Unfazed) -> None:
        super().__init__(app)
        self.mcp_lifespan_context = None

    async def on_startup(self) -> None:
        self.mcp_lifespan_context = event_app.lifespan(self.unfazed)
        if self.mcp_lifespan_context is not None:
            await self.mcp_lifespan_context.__aenter__()

    async def on_shutdown(self) -> None:
        if self.mcp_lifespan_context is not None:
            await self.mcp_lifespan_context.__aexit__(None, None, None)

Mount MCP appliction at root route

# entry.routes.py

from event.mcp import event_app
from unfazed.route import mount

patterns = [
    mount("/ping", app=event_app),
]

Add settings to your project

# settings.py

UNFAZED_SETTINGS = {
    "LIFESPAN": ["event.mcp.EventMCPLifespan"]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unfazed_mcp-0.0.1.tar.gz (73.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unfazed_mcp-0.0.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file unfazed_mcp-0.0.1.tar.gz.

File metadata

  • Download URL: unfazed_mcp-0.0.1.tar.gz
  • Upload date:
  • Size: 73.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for unfazed_mcp-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3b2e6dbbb48b9ea9007bf50b8e8b7d574cbdd5f701d441f743e0ee427257c16a
MD5 680a352b117718b6f562656e74503906
BLAKE2b-256 ee21c30ade979c7b6bd60eecea241b58e71c9173fdcb0c4a5dc4b426771f3c81

See more details on using hashes here.

File details

Details for the file unfazed_mcp-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for unfazed_mcp-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94e08f68f184b9b7e1e7edc647e4706e02f4dca6a5c568187d57a714a0ce6024
MD5 f52da3fd581482fdf4be2f113635050c
BLAKE2b-256 d34d905c53c139efdccf2f9298f045c3b48e663cfeb2565aac5f3cc3c8a4ce0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page