2424from mcpm .profile .profile_config import ProfileConfigManager
2525from mcpm .schemas .server_config import ServerConfig
2626from mcpm .utils .config import (
27- PROMPT_SPLITOR , RESOURCE_SPLITOR , RESOURCE_TEMPLATE_SPLITOR , TOOL_SPLITOR ,
28- ConfigManager , DEFAULT_HOST , DEFAULT_PORT , DEFAULT_SHARE_ADDRESS
27+ DEFAULT_HOST ,
28+ DEFAULT_PORT ,
29+ DEFAULT_SHARE_ADDRESS ,
30+ PROMPT_SPLITOR ,
31+ RESOURCE_SPLITOR ,
32+ RESOURCE_TEMPLATE_SPLITOR ,
33+ TOOL_SPLITOR ,
34+ ConfigManager ,
2935)
3036
3137from .client_connection import ServerConnection
@@ -39,29 +45,29 @@ class MCPRouter:
3945 """
4046 A router that aggregates multiple MCP servers (SSE/STDIO) and
4147 exposes them as a single SSE server.
42-
48+
4349 Example:
4450 ```python
4551 # Initialize with a custom API key
4652 router = MCPRouter(api_key="your-api-key")
47-
53+
4854 # Initialize with custom router configuration
4955 router_config = {
5056 "host": "localhost",
5157 "port": 8080,
5258 "share_address": "custom.share.address:8080"
5359 }
5460 router = MCPRouter(api_key="your-api-key", router_config=router_config)
55-
61+
5662 # Create a global config from the router's configuration
5763 router.create_global_config()
5864 ```
5965 """
6066
6167 def __init__ (
62- self ,
63- reload_server : bool = False ,
64- profile_path : str | None = None ,
68+ self ,
69+ reload_server : bool = False ,
70+ profile_path : str | None = None ,
6571 strict : bool = False ,
6672 api_key : str | None = None ,
6773 router_config : dict | None = None
@@ -91,7 +97,7 @@ def __init__(
9197 self .strict : bool = strict
9298 self .api_key = api_key
9399 self .router_config = router_config
94-
100+
95101 def create_global_config (self ) -> None :
96102 """
97103 Create a global configuration from the router's configuration.
@@ -102,7 +108,7 @@ def create_global_config(self) -> None:
102108 config_manager = ConfigManager ()
103109 # Save the API key to the global config
104110 config_manager .save_share_config (api_key = self .api_key )
105-
111+
106112 # If router_config is provided, save it to the global config
107113 if self .router_config is not None :
108114 host = self .router_config .get ("host" , DEFAULT_HOST )
0 commit comments