Chuyển tới nội dung chính

MCP

fluvius.mcp exposes eligible FastAPI operations as Streamable HTTP MCP tools.

from fluvius.fastapi import create_app
from fluvius.mcp import configure_mcp_server

app = create_app(pkginfo) | configure_mcp_server(
mount_path="/mcp",
mcp_auth=True,
)

Authentication is enabled by default and uses a short-lived JWT in the X-MCP-Token header. Set FLUVIUS_MCP_SECRET_KEY; tokens default to the mcp audience and a 900-second lifetime.

Stateless HTTP is the default and is required for multiple workers unless the deployment provides sticky mcp-session-id routing. Only operations explicitly eligible for MCP mounting should be exposed.