@@ -201,8 +201,6 @@ public static JObject GetPackageJson()
201201 /// Gets the package source for the MCP server (used with uvx --from).
202202 /// Checks for EditorPrefs override first (supports git URLs, file:// paths, etc.),
203203 /// then falls back to PyPI package reference.
204- /// When the override is a local path, auto-corrects to the "Server" subdirectory
205- /// if the path doesn't contain pyproject.toml but Server/pyproject.toml exists.
206204 /// </summary>
207205 /// <returns>Package source string for uvx --from argument</returns>
208206 public static string GetMcpServerPackageSource ( )
@@ -211,14 +209,7 @@ public static string GetMcpServerPackageSource()
211209 string sourceOverride = EditorPrefs . GetString ( EditorPrefKeys . GitUrlOverride , "" ) ;
212210 if ( ! string . IsNullOrEmpty ( sourceOverride ) )
213211 {
214- string resolved = ResolveLocalServerPath ( sourceOverride ) ;
215- // Persist the corrected path so future reads are consistent
216- if ( resolved != sourceOverride )
217- {
218- EditorPrefs . SetString ( EditorPrefKeys . GitUrlOverride , resolved ) ;
219- McpLog . Info ( $ "Auto-corrected server source override from '{ sourceOverride } ' to '{ resolved } '") ;
220- }
221- return resolved ;
212+ return sourceOverride ;
222213 }
223214
224215 // Default to PyPI package (avoids Windows long path issues with git clone)
@@ -232,59 +223,6 @@ public static string GetMcpServerPackageSource()
232223 return $ "mcpforunityserver=={ version } ";
233224 }
234225
235- /// <summary>
236- /// Validates and auto-corrects a local server source path to ensure it points to the
237- /// directory containing pyproject.toml. If the path points to a parent directory
238- /// (e.g. the repo root "unity-mcp") instead of the Python package directory ("Server"),
239- /// this checks for a "Server" subdirectory with pyproject.toml and returns that path.
240- /// Non-local paths (URLs, PyPI references) are returned unchanged.
241- /// </summary>
242- internal static string ResolveLocalServerPath ( string path )
243- {
244- if ( string . IsNullOrEmpty ( path ) )
245- return path ;
246-
247- // Skip non-local paths (git URLs, PyPI package names, etc.)
248- if ( path . StartsWith ( "http://" , StringComparison . OrdinalIgnoreCase ) ||
249- path . StartsWith ( "https://" , StringComparison . OrdinalIgnoreCase ) ||
250- path . StartsWith ( "git+" , StringComparison . OrdinalIgnoreCase ) ||
251- path . StartsWith ( "ssh://" , StringComparison . OrdinalIgnoreCase ) )
252- {
253- return path ;
254- }
255-
256- // If it looks like a PyPI package reference (no path separators), skip
257- if ( ! path . Contains ( '/' ) && ! path . Contains ( '\\ ' ) && ! path . StartsWith ( "file:" , StringComparison . OrdinalIgnoreCase ) )
258- {
259- return path ;
260- }
261-
262- // Strip file:// prefix for filesystem checks, preserve for return value
263- string checkPath = path ;
264- string prefix = string . Empty ;
265- if ( checkPath . StartsWith ( "file://" , StringComparison . OrdinalIgnoreCase ) )
266- {
267- prefix = checkPath . Substring ( 0 , 7 ) ; // preserve original casing
268- checkPath = checkPath . Substring ( 7 ) ;
269- }
270-
271- // Already correct — pyproject.toml exists at this path
272- if ( System . IO . File . Exists ( System . IO . Path . Combine ( checkPath , "pyproject.toml" ) ) )
273- {
274- return path ;
275- }
276-
277- // Check if "Server" subdirectory contains pyproject.toml
278- string serverSubDir = System . IO . Path . Combine ( checkPath , "Server" ) ;
279- if ( System . IO . File . Exists ( System . IO . Path . Combine ( serverSubDir , "pyproject.toml" ) ) )
280- {
281- return prefix + serverSubDir ;
282- }
283-
284- // Return as-is; uvx will report the error if the path is truly invalid
285- return path ;
286- }
287-
288226 /// <summary>
289227 /// Deprecated: Use GetMcpServerPackageSource() instead.
290228 /// Kept for backwards compatibility.
0 commit comments