-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Load MCP servers from file #2698
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
base: main
Are you sure you want to change the base?
Conversation
Docs Preview
|
def __get_pydantic_core_schema__(cls, _: Any, __: Any) -> CoreSchema: | ||
return core_schema.no_info_after_validator_function( | ||
lambda dct: MCPServerStreamableHTTP(**dct), | ||
core_schema.typed_dict_schema({'url': core_schema.typed_dict_field(core_schema.str_schema())}), |
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.
We should support headers as well right?
] | ||
|
||
|
||
def load_mcp_servers(config_path: str | Path) -> list[MCPServerStdio | MCPServerStreamableHTTP | MCPServerSSE]: |
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.
def load_mcp_servers(config_path: str | Path) -> list[MCPServerStdio | MCPServerStreamableHTTP | MCPServerSSE]: | |
def load_mcp_servers(config_path: str | Path) -> list[MCPServer]: |
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 technically not correct given that it needs to have the __get_pydantic...
thing.
] | ||
|
||
|
||
def load_mcp_servers(config_path: str | Path) -> list[MCPServerStdio | MCPServerStreamableHTTP | MCPServerSSE]: |
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.
I'd prefer this to be a classmethod on MCPServer
, as it's basically an alternative bulk constructor.
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.
It's a bulk operation, but I think that's exactly what merits it being its own function
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.
@Kludex You win
Thanks to The Schema Expert (@Viicos) for the help 🙏