π The fast, Pythonic way to build MCP servers and clients.
add server name to mounted server warnings (#1147)
Aidanebe817601c48
diff --git a/src/fastmcp/prompts/prompt_manager.py b/src/fastmcp/prompts/prompt_manager.pyindex 0f7d216f8..c373d01d1 100644--- a/src/fastmcp/prompts/prompt_manager.py+++ b/src/fastmcp/prompts/prompt_manager.py@@ -78,7 +78,7 @@ class PromptManager:except Exception as e:# Skip failed mounts silently, matches existing behaviorlogger.warning(- f"Failed to get prompts from mounted server '{mounted.prefix}': {e}"+ f"Failed to get prompts from server: {mounted.server.name!r}, mounted at: {mounted.prefix!r}: {e}")continuediff --git a/src/fastmcp/resources/resource_manager.py b/src/fastmcp/resources/resource_manager.pyindex 8620d4114..aa6198111 100644--- a/src/fastmcp/resources/resource_manager.py+++ b/src/fastmcp/resources/resource_manager.py@@ -109,7 +109,7 @@ class ResourceManager:except Exception as e:# Skip failed mounts silently, matches existing behaviorlogger.warning(- f"Failed to get resources from mounted server '{mounted.prefix}': {e}"+ f"Failed to get resources from server: {mounted.server.name!r}, mounted at: {mounted.prefix!r}: {e}")continue@@ -157,7 +157,7 @@ class ResourceManager:except Exception as e:# Skip failed mounts silently, matches existing behaviorlogger.warning(- f"Failed to get templates from mounted server '{mounted.prefix}': {e}"+ f"Failed to get templates from server: {mounted.server.name!r}, mounted at: {mounted.prefix!r}: {e}")continuediff --git a/src/fastmcp/tools/tool_manager.py b/src/fastmcp/tools/tool_manager.pyindex 29bb956c3..90737984b 100644--- a/src/fastmcp/tools/tool_manager.py+++ b/src/fastmcp/tools/tool_manager.py@@ -76,7 +76,7 @@ class ToolManager:except Exception as e:# Skip failed mounts silently, matches existing behaviorlogger.warning(- f"Failed to get tools from mounted server '{mounted.prefix}': {e}"+ f"Failed to get tools from server: {mounted.server.name!r}, mounted at: {mounted.prefix!r}: {e}")continuediff --git a/tests/server/test_mount.py b/tests/server/test_mount.pyindex baf4086a4..56369ebb8 100644--- a/tests/server/test_mount.py+++ b/tests/server/test_mount.py@@ -317,15 +317,18 @@ class TestMultipleServerMount:record.message for record in caplog.records if record.levelname == "WARNING"]assert any(- "Failed to get tools from mounted server 'unreachable'" in msg+ "Failed to get tools from server: 'FastMCP', mounted at: 'unreachable'"+ in msgfor msg in warning_messages)assert any(- "Failed to get resources from mounted server 'unreachable'" in msg+ "Failed to get resources from server: 'FastMCP', mounted at: 'unreachable'"+ in msgfor msg in warning_messages)assert any(- "Failed to get prompts from mounted server 'unreachable'" in msg+ "Failed to get prompts from server: 'FastMCP', mounted at: 'unreachable'"+ in msgfor msg in warning_messages)