diff --git a/mcp-server/server.py b/mcp-server/server.py index 905625d..c289745 100644 --- a/mcp-server/server.py +++ b/mcp-server/server.py @@ -30,7 +30,8 @@ except ImportError: class FastMCP: """Import-time fallback used by tests when fastmcp is not installed.""" - def __init__(self, *args, **kwargs): + def __init__(self, name: str): + self.name = name self.tools = [] def tool(self): @@ -56,7 +57,7 @@ def strip_local_prefix(lib_id: str) -> str: # Create FastMCP instance with tools -mcp = FastMCP("context7-docs", root_path="/app") +mcp = FastMCP("context7-docs") @mcp.tool() diff --git a/tests/test_mcp_server.py b/tests/test_mcp_server.py index e1e7708..a35c288 100644 --- a/tests/test_mcp_server.py +++ b/tests/test_mcp_server.py @@ -108,6 +108,17 @@ class TestMcpServerStructure: except ImportError as e: pytest.skip(f"fastmcp not installed: {e}") + def test_fastmcp_constructor_uses_supported_arguments(self): + """The server should not pass removed options to FastMCP.""" + from pathlib import Path + + source = ( + Path(__file__).resolve().parents[1] / "mcp-server" / "server.py" + ).read_text() + + assert 'FastMCP("context7-docs")' in source + assert "root_path=" not in source + class TestMcpServerToolsExistence: """Tests to verify MCP server has expected tools defined."""