π The fast, Pythonic way to build MCP servers and clients.
Update CLI banner with FastMCP 3.0 notice (#2766)
Jeremiah Lowinc5a61a7e190b
diff --git a/src/fastmcp/server/server.py b/src/fastmcp/server/server.pyindex 32f19ccc5..8e863cdf1 100644--- a/src/fastmcp/server/server.py+++ b/src/fastmcp/server/server.py@@ -2060,10 +2060,7 @@ class FastMCP(Generic[LifespanResultT]):"""# Display server bannerif show_banner:- log_server_banner(- server=self,- transport="stdio",- )+ log_server_banner(server=self)with temporary_log_level(log_level):async with self._lifespan_manager():@@ -2126,22 +2123,9 @@ class FastMCP(Generic[LifespanResultT]):stateless_http=stateless_http,)- # Get the path for the server URL- server_path = (- app.state.path.lstrip("/")- if hasattr(app, "state") and hasattr(app.state, "path")- else path or ""- )-# Display server bannerif show_banner:- log_server_banner(- server=self,- transport=transport,- host=host,- port=port,- path=server_path,- )+ log_server_banner(server=self)uvicorn_config_from_user = uvicorn_config or {}config_kwargs: dict[str, Any] = {diff --git a/src/fastmcp/utilities/cli.py b/src/fastmcp/utilities/cli.pyindex 24a776616..6b7997b01 100644--- a/src/fastmcp/utilities/cli.py+++ b/src/fastmcp/utilities/cli.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport jsonimport osfrom pathlib import Path-from typing import TYPE_CHECKING, Any, Literal+from typing import TYPE_CHECKING, Anyfrom pydantic import ValidationErrorfrom rich.align import Align@@ -197,23 +197,8 @@ LOGO_ASCII_4 = ()-def log_server_banner(- server: FastMCP[Any],- transport: Literal["stdio", "http", "sse", "streamable-http"],- *,- host: str | None = None,- port: int | None = None,- path: str | None = None,-) -> None:- """Creates and logs a formatted banner with server information and logo.-- Args:- transport: The transport protocol being used- server_name: Optional server name to display- host: Host address (for HTTP transports)- port: Port number (for HTTP transports)- path: Server path (for HTTP transports)- """+def log_server_banner(server: FastMCP[Any]) -> None:+ """Creates and logs a formatted banner with server information and logo."""# Create the logo text# Use Text with no_wrap and markup disabled to preserve ANSI escape codes@@ -228,39 +213,34 @@ def log_server_banner(info_table.add_column(style="cyan", justify="left") # Label columninfo_table.add_column(style="dim", justify="left") # Value column- match transport:- case "http" | "streamable-http":- display_transport = "HTTP"- case "sse":- display_transport = "SSE"- case "stdio":- display_transport = "STDIO"-- info_table.add_row("π₯", "Server name:", Text(server.name + "\n", style="bold blue"))- info_table.add_row("π¦", "Transport:", display_transport)-- # Show connection info based on transport- if transport in ("http", "streamable-http", "sse") and host and port:- server_url = f"http://{host}:{port}"- if path:- server_url += f"/{path.lstrip('/')}"- info_table.add_row("π", "Server URL:", server_url)-- # Add documentation link- info_table.add_row("", "", "")- info_table.add_row("π", "Docs:", "https://gofastmcp.com")- info_table.add_row("π", "Hosting:", "https://fastmcp.cloud")+ info_table.add_row("π₯", "Server:", Text(server.name, style="dim"))+ info_table.add_row("π", "Deploy free:", "https://fastmcp.cloud")# Create panel with logo, title, and information using Group+ docs_url = Text("https://gofastmcp.com", style="dim")panel_content = Group(+ "",Align.center(logo_text),"",- Align.center(title_text),"",+ Align.center(title_text),+ Align.center(docs_url),"",Align.center(info_table),)+ # v3 notice banner (shown below main panel)+ v3_line1 = Text("β¨ FastMCP 3.0 is coming!", style="bold")+ v3_line2 = Text(+ "Pin fastmcp<3 in production, then upgrade when you're ready.", style="dim"+ )+ v3_notice = Panel(+ Group(Align.center(v3_line1), Align.center(v3_line2)),+ border_style="blue",+ padding=(0, 2),+ width=80,+ )+panel = Panel(panel_content,border_style="dim",@@ -270,5 +250,5 @@ def log_server_banner()console = Console(stderr=True)- # Center the panel itself- console.print(Group("\n", Align.center(panel), "\n"))+ # Center both panels+ console.print(Group("\n", Align.center(panel), Align.center(v3_notice), "\n"))