-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Unpack settings in FastMCP #1198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
debug: bool = False, | ||
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO", | ||
host: str = "127.0.0.1", | ||
port: int = 8000, | ||
mount_path: str = "/", | ||
sse_path: str = "/sse", | ||
message_path: str = "/messages/", | ||
streamable_http_path: str = "/mcp", | ||
json_response: bool = False, | ||
stateless_http: bool = False, | ||
warn_on_duplicate_resources: bool = True, | ||
warn_on_duplicate_tools: bool = True, | ||
warn_on_duplicate_prompts: bool = True, | ||
dependencies: Collection[str] = (), | ||
lifespan: Callable[[FastMCP[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None = None, | ||
auth: AuthSettings | None = None, | ||
transport_security: TransportSecuritySettings | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change. The rest is just to comply with those types.
port: int = 8000, | ||
mount_path: str = "/", | ||
sse_path: str = "/sse", | ||
message_path: str = "/messages/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message_path: str = "/messages/", | |
message_path: str = "/messages", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to trust AI nowadays. 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, actually, the AI didn't make a mistake.
The default on Settings.message_path
was added with the /
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea i know :(, is that correct tho?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that it doesn't follow the pattern, no. But also there's some redirect issues that people may be facing.
But should I really change it in this PR? It may affect people.
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO", | ||
host: str = "127.0.0.1", | ||
port: int = 8000, | ||
mount_path: str = "/", | ||
sse_path: str = "/sse", | ||
message_path: str = "/messages/", | ||
streamable_http_path: str = "/mcp", | ||
json_response: bool = False, | ||
stateless_http: bool = False, | ||
warn_on_duplicate_resources: bool = True, | ||
warn_on_duplicate_tools: bool = True, | ||
warn_on_duplicate_prompts: bool = True, | ||
dependencies: Collection[str] = (), | ||
lifespan: Callable[[FastMCP[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None = None, | ||
auth: AuthSettings | None = None, | ||
transport_security: TransportSecuritySettings | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main worry is that we now keep the defaults in sync between Settings
and this. I think ideally, but sadly a BC break would be to just accept settings: Settings = Settings()
here. Since I think that would be backwards incompatible. For now, since Settings is only used internally to FastMCP
should we remove the defaults from the Settings
class, such that we only provide it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, we should remove the defaults from Settings
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.