Skip to content

Commit ddb631f

Browse files
committed
refactor: use list[str] | None for dependencies parameter
Matches the convention used by other sequence parameters in the same constructor (icons, tools) and avoids the Collection[str] footgun where a bare string like dependencies="pandas" would be iterated as chars.
1 parent 3a9c97d commit ddb631f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mcp/server/mcpserver/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import inspect
77
import json
88
import re
9-
from collections.abc import AsyncIterator, Awaitable, Callable, Collection, Iterable, Sequence
9+
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence
1010
from contextlib import AbstractAsyncContextManager, asynccontextmanager
1111
from typing import Any, Generic, Literal, TypeVar, overload
1212

@@ -145,7 +145,7 @@ def __init__(
145145
warn_on_duplicate_resources: bool = True,
146146
warn_on_duplicate_tools: bool = True,
147147
warn_on_duplicate_prompts: bool = True,
148-
dependencies: Collection[str] = (),
148+
dependencies: list[str] | None = None,
149149
lifespan: Callable[[MCPServer[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None = None,
150150
auth: AuthSettings | None = None,
151151
):
@@ -155,7 +155,7 @@ def __init__(
155155
warn_on_duplicate_resources=warn_on_duplicate_resources,
156156
warn_on_duplicate_tools=warn_on_duplicate_tools,
157157
warn_on_duplicate_prompts=warn_on_duplicate_prompts,
158-
dependencies=list(dependencies),
158+
dependencies=dependencies or [],
159159
lifespan=lifespan,
160160
auth=auth,
161161
)

0 commit comments

Comments
 (0)