Skip to content

Commit 2222463

Browse files
committed
Drop defaults from Settings
1 parent a6f413d commit 2222463

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

src/mcp/server/fastmcp/server.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import anyio
1212
import pydantic_core
13-
from pydantic import BaseModel, Field
13+
from pydantic import BaseModel
1414
from pydantic.networks import AnyUrl
1515
from pydantic_settings import BaseSettings, SettingsConfigDict
1616
from starlette.applications import Starlette
@@ -68,43 +68,42 @@ class Settings(BaseSettings, Generic[LifespanResultT]):
6868
)
6969

7070
# Server settings
71-
debug: bool = False
72-
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO"
71+
debug: bool
72+
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
7373

7474
# HTTP settings
75-
host: str = "127.0.0.1"
76-
port: int = 8000
77-
mount_path: str = "/" # Mount path (e.g. "/github", defaults to root path)
78-
sse_path: str = "/sse"
79-
message_path: str = "/messages/"
80-
streamable_http_path: str = "/mcp"
75+
host: str
76+
port: int
77+
mount_path: str
78+
sse_path: str
79+
message_path: str
80+
streamable_http_path: str
8181

8282
# StreamableHTTP settings
83-
json_response: bool = False
84-
stateless_http: bool = False # If True, uses true stateless mode (new transport per request)
83+
json_response: bool
84+
stateless_http: bool
85+
"""Define if the server should create a new transport per request."""
8586

8687
# resource settings
87-
warn_on_duplicate_resources: bool = True
88+
warn_on_duplicate_resources: bool
8889

8990
# tool settings
90-
warn_on_duplicate_tools: bool = True
91+
warn_on_duplicate_tools: bool
9192

9293
# prompt settings
93-
warn_on_duplicate_prompts: bool = True
94+
warn_on_duplicate_prompts: bool
9495

95-
dependencies: list[str] = Field(
96-
default_factory=list,
97-
description="List of dependencies to install in the server environment",
98-
)
96+
# TODO(Marcelo): Investigate if this is used. If it is, it's probably a good idea to remove it.
97+
dependencies: list[str]
98+
"""A list of dependencies to install in the server environment."""
9999

100-
lifespan: Callable[[FastMCP[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None = Field(
101-
None, description="Lifespan context manager"
102-
)
100+
lifespan: Callable[[FastMCP[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None
101+
"""A async context manager that will be called when the server is started."""
103102

104-
auth: AuthSettings | None = None
103+
auth: AuthSettings | None
105104

106105
# Transport security settings (DNS rebinding protection)
107-
transport_security: TransportSecuritySettings | None = None
106+
transport_security: TransportSecuritySettings | None
108107

109108

110109
def lifespan_wrapper(

0 commit comments

Comments
 (0)