|
10 | 10 |
|
11 | 11 | import anyio |
12 | 12 | import pydantic_core |
13 | | -from pydantic import BaseModel, Field |
| 13 | +from pydantic import BaseModel |
14 | 14 | from pydantic.networks import AnyUrl |
15 | 15 | from pydantic_settings import BaseSettings, SettingsConfigDict |
16 | 16 | from starlette.applications import Starlette |
@@ -68,43 +68,42 @@ class Settings(BaseSettings, Generic[LifespanResultT]): |
68 | 68 | ) |
69 | 69 |
|
70 | 70 | # 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"] |
73 | 73 |
|
74 | 74 | # 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 |
81 | 81 |
|
82 | 82 | # 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.""" |
85 | 86 |
|
86 | 87 | # resource settings |
87 | | - warn_on_duplicate_resources: bool = True |
| 88 | + warn_on_duplicate_resources: bool |
88 | 89 |
|
89 | 90 | # tool settings |
90 | | - warn_on_duplicate_tools: bool = True |
| 91 | + warn_on_duplicate_tools: bool |
91 | 92 |
|
92 | 93 | # prompt settings |
93 | | - warn_on_duplicate_prompts: bool = True |
| 94 | + warn_on_duplicate_prompts: bool |
94 | 95 |
|
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.""" |
99 | 99 |
|
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.""" |
103 | 102 |
|
104 | | - auth: AuthSettings | None = None |
| 103 | + auth: AuthSettings | None |
105 | 104 |
|
106 | 105 | # Transport security settings (DNS rebinding protection) |
107 | | - transport_security: TransportSecuritySettings | None = None |
| 106 | + transport_security: TransportSecuritySettings | None |
108 | 107 |
|
109 | 108 |
|
110 | 109 | def lifespan_wrapper( |
|
0 commit comments