feat: add /ws

This commit is contained in:
Sun-ZhenXing
2025-07-21 00:09:53 +08:00
parent bcb5994356
commit 48f2efef7a
10 changed files with 347 additions and 51 deletions

View File

@@ -6,12 +6,6 @@ class Settings(BaseSettings):
Configuration settings for the MCP template application.
"""
default_mcp: str = "math"
default_host: str = "127.0.0.1"
default_port: int = 3001
instructions: str | None = None
model_config = SettingsConfigDict(
env_prefix="MCP_",
env_file=".env",
@@ -19,5 +13,38 @@ class Settings(BaseSettings):
extra="allow",
)
app_title: str = "MCP Template Application"
"""Title of the MCP application, defaults to 'MCP Template Application'."""
app_description: str = "A template application for MCP using FastAPI."
"""Description of the MCP application, defaults to 'A template application for MCP using FastAPI.'"""
default_mcp: str = "math"
"""Default MCP to be used by the application."""
default_host: str = "127.0.0.1"
"""Default host for the MCP server, defaults to 127.0.0.1."""
default_port: int = 3001
"""Default port for the MCP server, defaults to 3001."""
instructions: str | None = None
"""Instructions to be used by the MCP server, defaults to None."""
enable_helpers_router: bool = True
"""Enable the helpers router for the MCP server."""
enable_sse: bool = True
"""Enable Server-Sent Events (SSE) for the MCP server."""
enable_streamable_http: bool = True
"""Enable streamable HTTP for the MCP server."""
enable_websocket: bool = False
"""Enable WebSocket for the MCP server."""
websocket_path: str = "/ws"
"""Path for the WebSocket endpoint."""
settings = Settings()