-
Notifications
You must be signed in to change notification settings - Fork 781
Remove server hostname function and simplify server naming #594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove server hostname function and simplify server naming #594
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRemoved URL-based hostname parsing and the Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as Install CLI
participant Client as mcp_client
participant User as User Output
rect rgb(230, 245, 255)
CLI->>Client: get_app(app_id) %% synchronous call (was async)
Client-->>CLI: app_info
end
rect rgb(245, 255, 230)
CLI->>CLI: resolve server_name (app_name or "mcp_agent")
Note right of CLI: removed _server_hostname(url)
end
CLI->>User: print install success
CLI->>User: print "restart reminder"
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
92f5c48 to
94f6cb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/mcp_agent/cli/commands/install.py (1)
324-329: Critical: Initializeapp_infoin exception handler to prevent NameError.If the
get_app()call on line 324 raises an exception,app_infois never assigned. The ChatGPT flow at line 334 then attempts to accessapp_info.unauthenticatedAccess, which will raise aNameError. While the outer try-catch (lines 333-366) will catch it, the error message will be confusing.Apply this diff to fix:
except Exception as e: print_info(f"Warning: Could not fetch app info: {e}") + app_info = None app_name = None
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/mcp_agent/cli/commands/install.py(3 hunks)tests/cli/commands/test_install.py(0 hunks)
💤 Files with no reviewable changes (1)
- tests/cli/commands/test_install.py
🔇 Additional comments (1)
src/mcp_agent/cli/commands/install.py (1)
519-522: LGTM! Helpful user notification.The restart reminder is a good UX improvement that helps users understand what action to take after installation to ensure the changes take effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
src/mcp_agent/cli/commands/install.py (1)
386-386: Consider the UX impact of potential duplicate server names.The fallback to a fixed
"mcp_agent"default can lead to duplicate name errors when:
- The
app_infofetch fails (line 329 setsapp_name = None), or- Multiple instances of the same app are installed from different URLs (same
app_name)Users will then be forced to use
--nameor--forceto proceed. While the duplicate check at lines 447-449 prevents silent overwrites, this is a UX regression from the previous URL-based unique name generation. If this trade-off is intentional for simplification, consider documenting it or providing a more helpful error message that suggests using--namewith a sample value.
🧹 Nitpick comments (1)
src/mcp_agent/cli/commands/install.py (1)
520-523: Good addition, though slightly redundant with existing restart messages.The generic restart reminder is helpful, but note that the success Panel above (lines 486-518) already includes client-specific restart instructions for Claude Desktop (line 489), VSCode (line 494), and Cursor (line 499). The additional reminder reinforces the message, which is fine for UX, but you could consider whether the generic message is needed given the specific instructions already shown.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/mcp_agent/cli/commands/install.py(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/mcp_agent/cli/commands/install.py (1)
src/mcp_agent/core/context.py (1)
name(193-196)
🔇 Additional comments (1)
src/mcp_agent/cli/commands/install.py (1)
324-330: No action needed—the async call handling is correct.The verification confirms that
run_async()properly wraps the asyncget_app()call. Both implementations ofget_app()inapi_client.pyandmock_client.pyare defined asasync def, andrun_async()insrc/mcp_agent/cli/core/utils.pycorrectly executes the coroutine usingasyncio.run(). The extensive test suite intest_install.pyconfirms the installation flow works end-to-end without issues, including app info fetching.
…ai#594) ### TL;DR Simplified server naming and added a restart notification for MCP client installations. ### What changed? - Removed the `_server_hostname()` function that generated server names from URLs - Replaced dynamic server naming with a simple default value of "mcp_agent" - Added a notification message informing users they may need to restart their MCP client after installation - Removed redundant app info fetching in the ChatGPT client flow <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a reminder after successful installation prompting users to restart the MCP client for changes to take effect. - **Refactor** - Simplified server name selection during installation; when no name is provided, it now defaults to the application name or "mcp_agent", reducing hostname derivation complexity. <!-- end of auto-generated comment: release notes by coderabbit.ai -->

TL;DR
Simplified server naming and added a restart notification for MCP client installations.
What changed?
_server_hostname()function that generated server names from URLsSummary by CodeRabbit
New Features
Refactor