Skip to content

Commit 9b41d16

Browse files
authored
Remove deprecated mount/import argument order and separator params (#2582)
1 parent 95fb8b4 commit 9b41d16

File tree

3 files changed

+1
-492
lines changed

3 files changed

+1
-492
lines changed

src/fastmcp/server/server.py

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,10 +2649,6 @@ def mount(
26492649
server: FastMCP[LifespanResultT],
26502650
prefix: str | None = None,
26512651
as_proxy: bool | None = None,
2652-
*,
2653-
tool_separator: str | None = None,
2654-
resource_separator: str | None = None,
2655-
prompt_separator: str | None = None,
26562652
) -> None:
26572653
"""Mount another FastMCP server on this server with an optional prefix.
26582654
@@ -2697,56 +2693,9 @@ def mount(
26972693
as_proxy: Whether to treat the mounted server as a proxy. If None (default),
26982694
automatically determined based on whether the server has a custom lifespan
26992695
(True if it has a custom lifespan, False otherwise).
2700-
tool_separator: Deprecated. Separator character for tool names.
2701-
resource_separator: Deprecated. Separator character for resource URIs.
2702-
prompt_separator: Deprecated. Separator character for prompt names.
27032696
"""
27042697
from fastmcp.server.proxy import FastMCPProxy
27052698

2706-
# Deprecated since 2.9.0
2707-
# Prior to 2.9.0, the first positional argument was the prefix and the
2708-
# second was the server. Here we swap them if needed now that the prefix
2709-
# is optional.
2710-
if isinstance(server, str):
2711-
if fastmcp.settings.deprecation_warnings:
2712-
warnings.warn(
2713-
"Mount prefixes are now optional and the first positional argument "
2714-
"should be the server you want to mount.",
2715-
DeprecationWarning,
2716-
stacklevel=2,
2717-
)
2718-
server, prefix = cast(FastMCP[Any], prefix), server
2719-
2720-
if tool_separator is not None:
2721-
# Deprecated since 2.4.0
2722-
if fastmcp.settings.deprecation_warnings:
2723-
warnings.warn(
2724-
"The tool_separator parameter is deprecated and will be removed in a future version. "
2725-
"Tools are now prefixed using 'prefix_toolname' format.",
2726-
DeprecationWarning,
2727-
stacklevel=2,
2728-
)
2729-
2730-
if resource_separator is not None:
2731-
# Deprecated since 2.4.0
2732-
if fastmcp.settings.deprecation_warnings:
2733-
warnings.warn(
2734-
"The resource_separator parameter is deprecated and ignored. "
2735-
"Resource prefixes are now added using the protocol://prefix/path format.",
2736-
DeprecationWarning,
2737-
stacklevel=2,
2738-
)
2739-
2740-
if prompt_separator is not None:
2741-
# Deprecated since 2.4.0
2742-
if fastmcp.settings.deprecation_warnings:
2743-
warnings.warn(
2744-
"The prompt_separator parameter is deprecated and will be removed in a future version. "
2745-
"Prompts are now prefixed using 'prefix_promptname' format.",
2746-
DeprecationWarning,
2747-
stacklevel=2,
2748-
)
2749-
27502699
# if as_proxy is not specified and the server has a custom lifespan,
27512700
# we should treat it as a proxy
27522701
if as_proxy is None:
@@ -2771,9 +2720,6 @@ async def import_server(
27712720
self,
27722721
server: FastMCP[LifespanResultT],
27732722
prefix: str | None = None,
2774-
tool_separator: str | None = None,
2775-
resource_separator: str | None = None,
2776-
prompt_separator: str | None = None,
27772723
) -> None:
27782724
"""
27792725
Import the MCP objects from another FastMCP server into this one,
@@ -2805,56 +2751,7 @@ async def import_server(
28052751
server: The FastMCP server to import
28062752
prefix: Optional prefix to use for the imported server's objects. If None,
28072753
objects are imported with their original names.
2808-
tool_separator: Deprecated. Separator for tool names.
2809-
resource_separator: Deprecated and ignored. Prefix is now
2810-
applied using the protocol://prefix/path format
2811-
prompt_separator: Deprecated. Separator for prompt names.
2812-
"""
2813-
2814-
# Deprecated since 2.9.0
2815-
# Prior to 2.9.0, the first positional argument was the prefix and the
2816-
# second was the server. Here we swap them if needed now that the prefix
2817-
# is optional.
2818-
if isinstance(server, str):
2819-
if fastmcp.settings.deprecation_warnings:
2820-
warnings.warn(
2821-
"Import prefixes are now optional and the first positional argument "
2822-
"should be the server you want to import.",
2823-
DeprecationWarning,
2824-
stacklevel=2,
2825-
)
2826-
server, prefix = cast(FastMCP[Any], prefix), server
2827-
2828-
if tool_separator is not None:
2829-
# Deprecated since 2.4.0
2830-
if fastmcp.settings.deprecation_warnings:
2831-
warnings.warn(
2832-
"The tool_separator parameter is deprecated and will be removed in a future version. "
2833-
"Tools are now prefixed using 'prefix_toolname' format.",
2834-
DeprecationWarning,
2835-
stacklevel=2,
2836-
)
2837-
2838-
if resource_separator is not None:
2839-
# Deprecated since 2.4.0
2840-
if fastmcp.settings.deprecation_warnings:
2841-
warnings.warn(
2842-
"The resource_separator parameter is deprecated and ignored. "
2843-
"Resource prefixes are now added using the protocol://prefix/path format.",
2844-
DeprecationWarning,
2845-
stacklevel=2,
2846-
)
2847-
2848-
if prompt_separator is not None:
2849-
# Deprecated since 2.4.0
2850-
if fastmcp.settings.deprecation_warnings:
2851-
warnings.warn(
2852-
"The prompt_separator parameter is deprecated and will be removed in a future version. "
2853-
"Prompts are now prefixed using 'prefix_promptname' format.",
2854-
DeprecationWarning,
2855-
stacklevel=2,
2856-
)
2857-
2754+
"""
28582755
# Import tools from the server
28592756
for key, tool in (await server.get_tools()).items():
28602757
if prefix:

0 commit comments

Comments
 (0)