Merge branch 'main' into a-better-martian

This commit is contained in:
William Easton 2025-10-03 15:06:28 -05:00 committed by GitHub
commit 528b3d47b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 27 additions and 24 deletions

View file

@ -155,38 +155,38 @@ class Client(Generic[ClientTransportT]):
"""
@overload
def __init__(self: Client[T], transport: T, *args, **kwargs) -> None: ...
def __init__(self: Client[T], transport: T, *args: Any, **kwargs: Any) -> None: ...
@overload
def __init__(
self: Client[SSETransport | StreamableHttpTransport],
transport: AnyUrl,
*args,
**kwargs,
*args: Any,
**kwargs: Any,
) -> None: ...
@overload
def __init__(
self: Client[FastMCPTransport],
transport: FastMCP | FastMCP1Server,
*args,
**kwargs,
*args: Any,
**kwargs: Any,
) -> None: ...
@overload
def __init__(
self: Client[PythonStdioTransport | NodeStdioTransport],
transport: Path,
*args,
**kwargs,
*args: Any,
**kwargs: Any,
) -> None: ...
@overload
def __init__(
self: Client[MCPConfigTransport],
transport: MCPConfig | dict[str, Any],
*args,
**kwargs,
*args: Any,
**kwargs: Any,
) -> None: ...
@overload
@ -198,8 +198,8 @@ class Client(Generic[ClientTransportT]):
| StreamableHttpTransport
],
transport: str,
*args,
**kwargs,
*args: Any,
**kwargs: Any,
) -> None: ...
def __init__(

View file

@ -89,7 +89,10 @@ class ProxyDCRClient(OAuthClientInformationFull):
"""
def __init__(
self, *args, allowed_redirect_uri_patterns: list[str] | None = None, **kwargs
self,
*args: Any,
allowed_redirect_uri_patterns: list[str] | None = None,
**kwargs: Any,
):
"""Initialize with allowed redirect URI patterns.

View file

@ -12,7 +12,7 @@ from mcp.server.models import InitializationOptions
class LowLevelServer(_Server[LifespanResultT, RequestT]):
def __init__(self, *args, **kwargs):
def __init__(self, *args: Any, **kwargs: Any):
super().__init__(*args, **kwargs)
# FastMCP servers support notifications for all components
self.notification_options = NotificationOptions(

View file

@ -69,7 +69,7 @@ class ProxyManagerMixin:
class ProxyToolManager(ToolManager, ProxyManagerMixin):
"""A ToolManager that sources its tools from a remote client in addition to local and mounted tools."""
def __init__(self, client_factory: ClientFactoryT, **kwargs):
def __init__(self, client_factory: ClientFactoryT, **kwargs: Any):
super().__init__(**kwargs)
self.client_factory = client_factory
@ -123,7 +123,7 @@ class ProxyToolManager(ToolManager, ProxyManagerMixin):
class ProxyResourceManager(ResourceManager, ProxyManagerMixin):
"""A ResourceManager that sources its resources from a remote client in addition to local and mounted resources."""
def __init__(self, client_factory: ClientFactoryT, **kwargs):
def __init__(self, client_factory: ClientFactoryT, **kwargs: Any):
super().__init__(**kwargs)
self.client_factory = client_factory
@ -204,7 +204,7 @@ class ProxyResourceManager(ResourceManager, ProxyManagerMixin):
class ProxyPromptManager(PromptManager, ProxyManagerMixin):
"""A PromptManager that sources its prompts from a remote client in addition to local and mounted prompts."""
def __init__(self, client_factory: ClientFactoryT, **kwargs):
def __init__(self, client_factory: ClientFactoryT, **kwargs: Any):
super().__init__(**kwargs)
self.client_factory = client_factory
@ -258,7 +258,7 @@ class ProxyTool(Tool, MirroredComponent):
A Tool that represents and executes a tool on a remote server.
"""
def __init__(self, client: Client, **kwargs):
def __init__(self, client: Client, **kwargs: Any):
super().__init__(**kwargs)
self._client = client
@ -354,7 +354,7 @@ class ProxyTemplate(ResourceTemplate, MirroredComponent):
A ResourceTemplate that represents and creates resources from a remote server template.
"""
def __init__(self, client: Client, **kwargs):
def __init__(self, client: Client, **kwargs: Any):
super().__init__(**kwargs)
self._client = client
@ -640,7 +640,7 @@ class StatefulProxyClient(ProxyClient[ClientTransportT]):
Note that it is essential to ensure that the proxy server itself is also stateful.
"""
def __init__(self, *args, **kwargs):
def __init__(self, *args: Any, **kwargs: Any):
super().__init__(*args, **kwargs)
self._caches: dict[ServerSession, Client[ClientTransportT]] = {}

View file

@ -34,7 +34,7 @@ _current_tool: ContextVar[TransformedTool | None] = ContextVar( # type: ignore[
)
async def forward(**kwargs) -> ToolResult:
async def forward(**kwargs: Any) -> ToolResult:
"""Forward to parent tool with argument transformation applied.
This function can only be called from within a transformed tool's custom
@ -64,7 +64,7 @@ async def forward(**kwargs) -> ToolResult:
return await tool.forwarding_fn(**kwargs)
async def forward_raw(**kwargs) -> ToolResult:
async def forward_raw(**kwargs: Any) -> ToolResult:
"""Forward directly to parent tool without transformation.
This function bypasses all argument transformation and validation, calling the parent
@ -681,7 +681,7 @@ class TransformedTool(Tool):
schema = compress_schema(schema, prune_defs=True)
# Create forwarding function that closes over everything it needs
async def _forward(**kwargs):
async def _forward(**kwargs: Any):
# Validate arguments
valid_args = set(new_props.keys())
provided_args = set(kwargs.keys())

View file

@ -75,11 +75,11 @@ def _run_server(mcp_server: FastMCP, transport: Literal["sse"], port: int) -> No
@contextmanager
def run_server_in_process(
server_fn: Callable[..., None],
*args,
*args: Any,
provide_host_and_port: bool = True,
host: str = "127.0.0.1",
port: int | None = None,
**kwargs,
**kwargs: Any,
) -> Generator[str, None, None]:
"""
Context manager that runs a FastMCP server in a separate process and