|
14 | 14 | from ruamel.yaml import YAML |
15 | 15 |
|
16 | 16 | from mcpm.core.schema import ServerConfig, STDIOServerConfig |
17 | | -from mcpm.utils.router_server import format_server_url |
18 | 17 |
|
19 | 18 | logger = logging.getLogger(__name__) |
20 | 19 |
|
@@ -134,33 +133,6 @@ def is_client_installed(self) -> bool: |
134 | 133 | """ |
135 | 134 | pass |
136 | 135 |
|
137 | | - @abc.abstractmethod |
138 | | - def activate_profile(self, profile_name: str, router_config: Dict[str, Any], alias_name: str | None = None) -> bool: |
139 | | - """ |
140 | | - Activate a profile in the client config |
141 | | -
|
142 | | - Args: |
143 | | - profile_name: Name of the profile |
144 | | - router_config: Router configuration |
145 | | - alias_name: Alias name for the router in client config |
146 | | -
|
147 | | - Returns: |
148 | | - bool: Success or failure |
149 | | - """ |
150 | | - pass |
151 | | - |
152 | | - @abc.abstractmethod |
153 | | - def deactivate_profile(self, profile_name: str) -> bool: |
154 | | - """ |
155 | | - Deactivate a profile in the client config |
156 | | -
|
157 | | - Args: |
158 | | - profile_name: Name of the profile |
159 | | -
|
160 | | - Returns: |
161 | | - bool: Success or failure |
162 | | - """ |
163 | | - pass |
164 | 136 |
|
165 | 137 | def get_associated_profiles(self) -> List[str]: |
166 | 138 | """ |
@@ -405,39 +377,6 @@ def is_client_installed(self) -> bool: |
405 | 377 | # Can be overridden by subclasses |
406 | 378 | return os.path.isdir(os.path.dirname(self.config_path)) |
407 | 379 |
|
408 | | - def activate_profile(self, profile_name: str, router_config: Dict[str, Any], alias_name: str | None = None) -> bool: |
409 | | - """Activate a profile in the client config |
410 | | -
|
411 | | - Args: |
412 | | - profile_name: Name of the profile |
413 | | - router_config: Router configuration |
414 | | - alias_name: Alias name for the router in client config |
415 | | -
|
416 | | - Returns: |
417 | | - bool: Success or failure |
418 | | - """ |
419 | | - host = router_config["host"] |
420 | | - port = router_config["port"] |
421 | | - |
422 | | - # Use streamable HTTP endpoint instead of the deprecated SSE one. |
423 | | - default_base_url = f"http://{host}:{port}/mcp/" |
424 | | - |
425 | | - server_config = self._format_router_server(profile_name, default_base_url, alias_name) |
426 | | - return self.add_server(server_config) |
427 | | - |
428 | | - def _format_router_server(self, profile_name, base_url, alias_name: str | None = None) -> ServerConfig: |
429 | | - return format_server_url(self.client_key, profile_name, base_url, alias_name) |
430 | | - |
431 | | - def deactivate_profile(self, profile_name: str) -> bool: |
432 | | - """Deactivate a profile in the client config |
433 | | -
|
434 | | - Args: |
435 | | - profile_name: Name of the profile |
436 | | -
|
437 | | - Returns: |
438 | | - bool: Success or failure |
439 | | - """ |
440 | | - return self.remove_server(profile_name) |
441 | 380 |
|
442 | 381 |
|
443 | 382 | class YAMLClientManager(BaseClientManager): |
@@ -679,33 +618,3 @@ def is_client_installed(self) -> bool: |
679 | 618 | # Check if the config directory exists |
680 | 619 | return os.path.isdir(os.path.dirname(self.config_path)) |
681 | 620 |
|
682 | | - def activate_profile(self, profile_name: str, router_config: Dict[str, Any], alias_name: str | None = None) -> bool: |
683 | | - """Activate a profile in the client config |
684 | | -
|
685 | | - Args: |
686 | | - profile_name: Name of the profile |
687 | | -
|
688 | | - Returns: |
689 | | - bool: Success or failure |
690 | | - """ |
691 | | - host = router_config["host"] |
692 | | - port = router_config["port"] |
693 | | - # Use streamable HTTP endpoint. |
694 | | - default_base_url = f"http://{host}:{port}/mcp/" |
695 | | - |
696 | | - server_config = self._format_router_server(profile_name, default_base_url, alias_name) |
697 | | - return self.add_server(server_config) |
698 | | - |
699 | | - def _format_router_server(self, profile_name, base_url, server_name: str | None = None) -> ServerConfig: |
700 | | - return format_server_url(self.client_key, profile_name, base_url, server_name) |
701 | | - |
702 | | - def deactivate_profile(self, profile_name: str) -> bool: |
703 | | - """Deactivate a profile in the client config |
704 | | -
|
705 | | - Args: |
706 | | - profile_name: Name of the profile |
707 | | -
|
708 | | - Returns: |
709 | | - bool: Success or failure |
710 | | - """ |
711 | | - return self.remove_server(profile_name) |
0 commit comments