Skip to content

Commit 17d1cc3

Browse files
author
LittleCoinCoin
committed
fix(cli): pass in expected mcp server configuration
Use the expected `servers` field of the data model `MCPServerConfig` - Remove spurrious runtime discovery of the appropriate field name - Fix to always use the correct field
1 parent fa273a4 commit 17d1cc3

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

hatch/cli_hatch.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -394,18 +394,8 @@ def handle_mcp_backup_restore(env_manager: HatchEnvironmentManager, host: str, b
394394
strategy = MCPHostRegistry.get_strategy(host_type)
395395
restored_config = strategy.read_configuration()
396396

397-
# Get servers dict from restored configuration
398-
if hasattr(restored_config, 'get_servers_dict'):
399-
restored_servers = restored_config.get_servers_dict()
400-
elif hasattr(restored_config, 'mcpServers'):
401-
# Handle Claude Desktop format
402-
restored_servers = restored_config.mcpServers or {}
403-
else:
404-
# Fallback - try to get servers as dict
405-
restored_servers = getattr(restored_config, 'servers', {})
406-
407397
# Update environment tracking to match restored state
408-
updates_count = env_manager.apply_restored_host_configuration_to_environments(host, restored_servers)
398+
updates_count = env_manager.apply_restored_host_configuration_to_environments(host, restored_config.servers)
409399
if updates_count > 0:
410400
print(f"Synchronized {updates_count} package entries with restored configuration")
411401

0 commit comments

Comments
 (0)