|
28 | 28 | from copy import deepcopy |
29 | 29 | from pathlib import Path |
30 | 30 | from typing import Optional |
31 | | -from urllib.parse import urlparse |
32 | 31 |
|
33 | 32 | import typer |
34 | 33 | from rich.panel import Panel |
@@ -182,36 +181,6 @@ def _write_json(path: Path, data: dict) -> None: |
182 | 181 | pass |
183 | 182 |
|
184 | 183 |
|
185 | | -def _server_hostname(server_url: str, app_name: Optional[str] = None) -> str: |
186 | | - """ |
187 | | - Generate a friendly server name from the URL. |
188 | | -
|
189 | | - Extracts the subdomain or hostname to create a short, readable name. |
190 | | - For example, "https://abc123.deployments.mcp-agent.com/sse" -> "abc123" |
191 | | -
|
192 | | - Args: |
193 | | - server_url: The server URL |
194 | | - app_name: Optional app name from API (preferred if available) |
195 | | -
|
196 | | - Returns: |
197 | | - A friendly server name |
198 | | - """ |
199 | | - if app_name: |
200 | | - return app_name |
201 | | - |
202 | | - parsed = urlparse(server_url) |
203 | | - hostname = parsed.hostname or "" |
204 | | - |
205 | | - parts = hostname.split(".") |
206 | | - if len(parts) > 2 and "deployments" in hostname: |
207 | | - return parts[0] |
208 | | - |
209 | | - if len(parts) >= 2: |
210 | | - return ".".join(parts[:-1]) |
211 | | - |
212 | | - return hostname or "mcp-server" |
213 | | - |
214 | | - |
215 | 184 | def _build_server_config( |
216 | 185 | server_url: str, |
217 | 186 | transport: str = "http", |
@@ -363,9 +332,6 @@ def install( |
363 | 332 | # For ChatGPT, check if server has unauthenticated access enabled |
364 | 333 | if client_lc == "chatgpt": |
365 | 334 | try: |
366 | | - if not app_info: |
367 | | - app_info = run_async(mcp_client.get_app(server_url=server_url)) |
368 | | - |
369 | 335 | has_unauth_access = app_info.unauthenticatedAccess is True or ( |
370 | 336 | app_info.appServerInfo |
371 | 337 | and app_info.appServerInfo.unauthenticatedAccess is True |
@@ -417,7 +383,7 @@ def install( |
417 | 383 | ) |
418 | 384 | return |
419 | 385 |
|
420 | | - server_name = name or _server_hostname(server_url, app_name) |
| 386 | + server_name = name or app_name or "mcp_agent" |
421 | 387 |
|
422 | 388 | transport = "sse" if server_url.rstrip("/").endswith("/sse") else "http" |
423 | 389 |
|
@@ -550,3 +516,8 @@ def install( |
550 | 516 | border_style="green", |
551 | 517 | ) |
552 | 518 | ) |
| 519 | + |
| 520 | + console.print( |
| 521 | + "\n💡 You may need to restart your MCP client for the changes to take effect.", |
| 522 | + style="dim", |
| 523 | + ) |
0 commit comments