feat(server): restore dependencies parameter on MCPServer (#2358)

This commit is contained in:
Max Isbey 2026-03-27 13:42:15 +00:00 • committed by GitHub
commit 3517a29c82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,6 +105,9 @@ class Settings(BaseSettings, Generic[LifespanResultT]):
# prompt settings
warn_on_duplicate_prompts: bool
dependencies: list[str]
"""List of dependencies to install in the server environment. Used by the `mcp install` and `mcp dev` CLI."""
lifespan: Callable[[MCPServer[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None
"""An async context manager that will be called when the server is started."""
@ -142,6 +145,7 @@ class MCPServer(Generic[LifespanResultT]):
warn_on_duplicate_resources: bool = True,
warn_on_duplicate_tools: bool = True,
warn_on_duplicate_prompts: bool = True,
dependencies: list[str] | None = None,
lifespan: Callable[[MCPServer[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None = None,
auth: AuthSettings | None = None,
):
@ -151,9 +155,11 @@ class MCPServer(Generic[LifespanResultT]):
warn_on_duplicate_resources=warn_on_duplicate_resources,
warn_on_duplicate_tools=warn_on_duplicate_tools,
warn_on_duplicate_prompts=warn_on_duplicate_prompts,
dependencies=dependencies or [],
lifespan=lifespan,
auth=auth,
)
self.dependencies = self.settings.dependencies
self._tool_manager = ToolManager(tools=tools, warn_on_duplicate_tools=self.settings.warn_on_duplicate_tools)
self._resource_manager = ResourceManager(warn_on_duplicate_resources=self.settings.warn_on_duplicate_resources)