diff --git a/src/mcp_obsidian/obsidian.py b/src/mcp_obsidian/obsidian.py index 3133eb6..4eec13c 100644 --- a/src/mcp_obsidian/obsidian.py +++ b/src/mcp_obsidian/obsidian.py @@ -84,10 +84,19 @@ class Obsidian(): host = parsed.hostname or '127.0.0.1' port = parsed.port or (27124 if protocol == 'https' else 27123) else: - # Legacy hostname/IP only format - protocol = 'https' - host = host_config - port = 27124 + # Support legacy formats + # 1) hostname/IP only + # 2) hostname:port (no protocol) + if ':' in host_config: + # Treat as host:port and default protocol to https + parsed = urlparse(f'https://{host_config}') + protocol = 'https' + host = parsed.hostname or '127.0.0.1' + port = parsed.port or 27124 + else: + protocol = 'https' + host = host_config + port = 27124 return protocol, host, port