Skip to content

Commit 4b8cd86

Browse files
niechenclaude
andcommitted
Remove router and active profile functionality, preserve v2 commands
Remove legacy router daemon and active profile concepts while maintaining all v2 command functionalities. Profiles now work as virtual tags only. ## Major Changes ### Removed Router Infrastructure - Router command and all subcommands (mcpm router on/off/status/set/share/unshare) - Router daemon functionality (/src/mcpm/router/ directory) - Router configuration management methods - Router-based tunneling and sharing ### Removed Active Profile Concept - activate_profile() and deactivate_profile() methods from client managers - client_add_profile() function that used router for profile activation - Router server formatting utilities ### Preserved Core Functionality - All v2 commands work as before (mcpm install, mcpm profile, mcpm share, etc.) - Profile system now works as virtual tags only - FastMCP-based sharing via mcpm share and mcpm profile share - Client configuration management ### Backward Compatibility - Created minimal RouterConfig class for FastMCP middleware compatibility - Created simple Tunnel class to replace router-based tunneling - Updated imports throughout codebase - Fixed all tests (113 passing) ### Technical Details - No daemon processes required anymore - Sharing uses FastMCP proxies directly - Profile activation shows proper error message for v2.0 - Updated connection URLs to show streamable HTTP and SSE endpoints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f0321ac commit 4b8cd86

30 files changed

+131
-2691
lines changed

src/mcpm/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
"""
44

55
# Import version from internal module
6-
# Import router module
7-
from . import router
8-
from .router.router import MCPRouter
9-
from .router.router_config import RouterConfig
106
from .version import __version__
117

128
# Define what symbols are exported from this package
13-
__all__ = ["__version__", "router", "MCPRouter", "RouterConfig"]
9+
__all__ = ["__version__"]

src/mcpm/cli.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
list,
2121
profile,
2222
remove,
23-
router,
2423
run,
2524
search,
2625
usage,
@@ -225,7 +224,6 @@ def main(ctx, help_flag, version):
225224
# Keep these for now but they could be simplified later
226225
main.add_command(client.client)
227226
main.add_command(inspector.inspector, name="inspector")
228-
main.add_command(router.router, name="router")
229227

230228
if __name__ == "__main__":
231229
main()

src/mcpm/clients/base.py

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from ruamel.yaml import YAML
1515

1616
from mcpm.core.schema import ServerConfig, STDIOServerConfig
17-
from mcpm.utils.router_server import format_server_url
1817

1918
logger = logging.getLogger(__name__)
2019

@@ -134,33 +133,6 @@ def is_client_installed(self) -> bool:
134133
"""
135134
pass
136135

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
164136

165137
def get_associated_profiles(self) -> List[str]:
166138
"""
@@ -405,39 +377,6 @@ def is_client_installed(self) -> bool:
405377
# Can be overridden by subclasses
406378
return os.path.isdir(os.path.dirname(self.config_path))
407379

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)
441380

442381

443382
class YAMLClientManager(BaseClientManager):
@@ -679,33 +618,3 @@ def is_client_installed(self) -> bool:
679618
# Check if the config directory exists
680619
return os.path.isdir(os.path.dirname(self.config_path))
681620

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)

src/mcpm/clients/managers/claude_desktop.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from mcpm.clients.base import JSONClientManager
1010
from mcpm.core.schema import RemoteServerConfig, ServerConfig
11-
from mcpm.utils.router_server import format_server_url_with_proxy_headers
1211

1312
logger = logging.getLogger(__name__)
1413

@@ -113,21 +112,6 @@ def is_server_disabled(self, server_name: str) -> bool:
113112
config = self._load_config()
114113
return "disabledServers" in config and server_name in config["disabledServers"]
115114

116-
def _format_router_server(
117-
self, profile_name: str, base_url: str, alias_name: str | None = None
118-
) -> ServerConfig:
119-
"""Construct a ServerConfig for a router entry.
120-
121-
The parent JSONClientManager passes in an optional ``alias_name`` which
122-
should be used as the final server name inside the client config when
123-
provided. Accepting the parameter keeps the overriding method
124-
signature compatible with the base implementation and prevents the
125-
``TypeError`` that occurred when ``activate_profile`` tried to forward
126-
three arguments.
127-
"""
128-
return format_server_url_with_proxy_headers(
129-
self.client_key, profile_name, base_url, alias_name
130-
)
131115

132116
def to_client_format(self, server_config: ServerConfig) -> Dict[str, Any]:
133117
if isinstance(server_config, RemoteServerConfig):

src/mcpm/clients/managers/continue_extension.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from mcpm.clients.base import YAMLClientManager
1212
from mcpm.core.schema import ServerConfig, STDIOServerConfig
13-
from mcpm.utils.router_server import format_server_url_with_proxy_headers
1413

1514
logger = logging.getLogger(__name__)
1615

@@ -203,5 +202,3 @@ def from_client_format(self, server_name: str, client_config: Dict[str, Any]) ->
203202
server_data.update(client_config)
204203
return TypeAdapter(ServerConfig).validate_python(server_data)
205204

206-
def _format_router_server(self, profile_name, base_url) -> ServerConfig:
207-
return format_server_url_with_proxy_headers(self.client_key, profile_name, base_url)

src/mcpm/commands/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"list",
1515
"profile",
1616
"remove",
17-
"router",
1817
"run",
1918
"search",
2019
"usage",
@@ -33,7 +32,6 @@
3332
inspector,
3433
list,
3534
profile,
36-
router,
3735
run,
3836
search,
3937
usage,

src/mcpm/commands/profile/share.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
from mcpm.fastmcp_integration.proxy import create_mcpm_proxy
1010
from mcpm.profile.profile_config import ProfileConfigManager
11-
from mcpm.router.router_config import RouterConfig
12-
from mcpm.router.share import Tunnel
11+
from mcpm.core.router_config import RouterConfig
12+
from mcpm.core.tunnel import Tunnel
1313
from mcpm.utils.config import DEFAULT_SHARE_ADDRESS
1414

1515
console = Console()

0 commit comments

Comments
 (0)