-
Notifications
You must be signed in to change notification settings - Fork 82
feat: add Qwen CLI client manager support #268
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a Qwen CLI client manager implementation, exposes it in the managers package, registers it in the client registry, adds unit tests for its behavior, and introduces a one-line QWEN.md reference file. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Registry as ClientRegistry
participant Manager as QwenCliManager
participant OS as OS/Shutil
User->>Registry: request manager("qwen-cli")
Registry->>Manager: instantiate (config path default or override)
User->>Manager: is_client_installed()
Manager->>OS: which("qwen" or "qwen.exe")
OS-->>Manager: path | none
Manager-->>User: True | False
User->>Manager: get_client_info()
Manager-->>User: {name, download_url, config_file, description}
User->>Manager: _get_empty_config()
Manager-->>User: {mcpServers: {}, theme: "Qwen Dark", selectedAuthType: "openai"}
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧬 Code graph analysis (3)src/mcpm/clients/managers/__init__.py (1)
src/mcpm/clients/managers/qwen_cli.py (2)
src/mcpm/clients/client_registry.py (1)
🔇 Additional comments (10)
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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
🧹 Nitpick comments (1)
src/mcpm/clients/managers/qwen_cli.py (1)
23-35
: Simplify config path assignment.The conditional assignment of
config_path
is redundant because the parentJSONClientManager.__init__
does not setself.config_path
, so the explicit check and assignment in lines 31-32 are unnecessary.Apply this diff to simplify the logic:
def __init__(self, config_path_override: str | None = None): """Initialize the Qwen CLI client manager Args: config_path_override: Optional path to override the default config file location """ super().__init__(config_path_override=config_path_override) - if config_path_override: - self.config_path = config_path_override - else: - # Qwen CLI stores its settings in ~/.qwen/settings.json - self.config_path = os.path.expanduser("~/.qwen/settings.json") + # Qwen CLI stores its settings in ~/.qwen/settings.json + self.config_path = config_path_override or os.path.expanduser("~/.qwen/settings.json")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
QWEN.md
(1 hunks)src/mcpm/clients/client_registry.py
(2 hunks)src/mcpm/clients/managers/__init__.py
(2 hunks)src/mcpm/clients/managers/qwen_cli.py
(1 hunks)tests/test_clients/test_qwen_cli.py
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Always format Python code with
ruff
.
Files:
src/mcpm/clients/managers/__init__.py
tests/test_clients/test_qwen_cli.py
src/mcpm/clients/client_registry.py
src/mcpm/clients/managers/qwen_cli.py
🧠 Learnings (1)
📚 Learning: 2025-08-06T08:20:03.609Z
Learnt from: CR
PR: pathintegral-institute/mcpm.sh#0
File: GEMINI.md:0-0
Timestamp: 2025-08-06T08:20:03.609Z
Learning: Reference `CLAUDE.md` for project conventions.
Applied to files:
QWEN.md
🧬 Code graph analysis (4)
src/mcpm/clients/managers/__init__.py (1)
src/mcpm/clients/managers/qwen_cli.py (1)
QwenCliManager
(15-65)
tests/test_clients/test_qwen_cli.py (2)
src/mcpm/clients/managers/qwen_cli.py (4)
QwenCliManager
(15-65)_get_empty_config
(37-44)is_client_installed
(46-52)get_client_info
(54-65)src/mcpm/clients/client_registry.py (1)
get_client_info
(97-110)
src/mcpm/clients/client_registry.py (1)
src/mcpm/clients/managers/qwen_cli.py (1)
QwenCliManager
(15-65)
src/mcpm/clients/managers/qwen_cli.py (2)
src/mcpm/clients/base.py (1)
JSONClientManager
(164-379)src/mcpm/clients/client_registry.py (1)
get_client_info
(97-110)
🔇 Additional comments (13)
QWEN.md (1)
1-1
: LGTM! Follows project conventions.The reference to
CLAUDE.md
aligns with the established documentation pattern for client integrations.Based on learnings.
src/mcpm/clients/client_registry.py (2)
22-22
: LGTM! Import follows project conventions.The import is correctly placed in alphabetical order with other manager imports.
54-54
: LGTM! Registry entry is correctly structured.The registration of
QwenCliManager
under the key "qwen-cli" follows the established pattern for CLI-based clients and maintains alphabetical ordering.src/mcpm/clients/managers/__init__.py (2)
16-16
: LGTM! Import is correctly positioned.The import maintains alphabetical ordering with the other client manager imports.
30-30
: LGTM! Public API export is correct.The addition to
__all__
properly exposesQwenCliManager
and maintains alphabetical ordering.tests/test_clients/test_qwen_cli.py (4)
12-24
: LGTM! Initialization tests are thorough.The test correctly validates both default config path behavior and custom config path override, covering the key initialization scenarios.
27-34
: LGTM! Empty config structure is validated.The test correctly verifies all expected keys in the empty config, including the MCP-specific
mcpServers
and Qwen-specific defaults.
37-47
: LGTM! Installation detection is properly tested.The test effectively uses mocking to verify both installed and uninstalled states, ensuring the
is_client_installed
method behaves correctly.
50-57
: LGTM! Client info metadata is validated.The test verifies all expected metadata fields returned by
get_client_info
, ensuring consistency with the manager's class attributes.src/mcpm/clients/managers/qwen_cli.py (4)
1-12
: LGTM! Module structure is clean.The imports and docstring follow the project's conventions for client manager modules.
15-21
: LGTM! Class attributes are well-defined.The client metadata (key, display name, download URL) follows the established pattern and provides clear identification for the Qwen CLI integration.
46-52
: LGTM! Installation check is correctly implemented.The method properly handles platform differences (Windows vs. Unix-like systems) for the executable name and uses
shutil.which
appropriately.
54-65
: LGTM! Client info is comprehensive.The method returns all expected metadata fields, including the Qwen-specific description, which aligns with the project's client info pattern.
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
🧹 Nitpick comments (2)
src/mcpm/clients/managers/qwen_cli.py (1)
12-12
: Consider removing unused logger or adding log statements.The logger is instantiated but never used in this implementation. Consider removing it or adding appropriate log statements in methods like
is_client_installed
orget_client_info
for debugging purposes.tests/test_clients/test_qwen_cli.py (1)
27-34
: Consider merging with test_qwen_cli_manager_get_empty_config_structure.This test overlaps significantly with
test_qwen_cli_manager_get_empty_config_structure
(lines 68-81), which provides more comprehensive validation. Consider merging them to avoid duplication.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
QWEN.md
(1 hunks)src/mcpm/clients/client_registry.py
(2 hunks)src/mcpm/clients/managers/__init__.py
(2 hunks)src/mcpm/clients/managers/qwen_cli.py
(1 hunks)tests/test_clients/test_qwen_cli.py
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- QWEN.md
- src/mcpm/clients/client_registry.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Always format Python code with
ruff
.
Files:
src/mcpm/clients/managers/__init__.py
tests/test_clients/test_qwen_cli.py
src/mcpm/clients/managers/qwen_cli.py
🧬 Code graph analysis (3)
src/mcpm/clients/managers/__init__.py (1)
src/mcpm/clients/managers/qwen_cli.py (1)
QwenCliManager
(15-61)
tests/test_clients/test_qwen_cli.py (1)
src/mcpm/clients/managers/qwen_cli.py (4)
QwenCliManager
(15-61)_get_empty_config
(33-40)is_client_installed
(42-48)get_client_info
(50-61)
src/mcpm/clients/managers/qwen_cli.py (2)
src/mcpm/clients/base.py (1)
JSONClientManager
(164-379)src/mcpm/clients/client_registry.py (1)
get_client_info
(97-110)
🔇 Additional comments (12)
src/mcpm/clients/managers/qwen_cli.py (5)
50-61
: LGTM! Good extension of parent's get_client_info.The method appropriately extends the parent's
get_client_info
by adding adescription
field, providing additional context about the client.
47-47
: Incorrect issue—_system
is defined
self._system
is initialized in BaseClientManager (src/mcpm/clients/base.py:37), so no verification is needed.Likely an incorrect or invalid review comment.
21-21
: download_url confirmed The URL points to the official Qwen Code CLI repository, which includes installation instructions and releases.
33-40
: Confirm Qwen CLI default values
Please verify that thetheme
("Qwen Dark") andselectedAuthType
("openai") defaults in_get_empty_config
match the built-in defaults defined by Qwen Code CLI’s settings.json or adjust them to align with the official documentation.
23-31
: Initialization order is correct; no changes necessary.QwenCliManager sets the default
config_path
before callingsuper().__init__
, and BaseClientManager’s__init__
will overrideself.config_path
only ifconfig_path_override
is provided—otherwise the default remains intact.Likely an incorrect or invalid review comment.
src/mcpm/clients/managers/__init__.py (2)
16-16
: LGTM!The import is correctly placed in alphabetical order and follows the established pattern.
30-30
: LGTM!The export is correctly placed in alphabetical order within
__all__
.tests/test_clients/test_qwen_cli.py (5)
12-24
: LGTM!The test provides comprehensive coverage of initialization scenarios, including both default and custom config paths.
37-49
: LGTM!The test properly mocks
shutil.which
and validates both installed and uninstalled scenarios with appropriate assertions.
52-65
: LGTM!The test properly validates Windows-specific executable detection by mocking the
_system
attribute and verifying thatqwen.exe
is checked instead ofqwen
.
68-81
: LGTM!Comprehensive validation of the empty config structure with specific value checks.
84-91
: LGTM!The test thoroughly validates all fields returned by
get_client_info
, including the customdescription
field.
User description
Added QwenCliManager to handle Qwen CLI MCP server configurations
Includes implementation and tests for Qwen CLI integration
PR Type
Enhancement
Description
Add Qwen CLI client manager support
Integrate QwenCliManager into client registry
Include comprehensive test coverage
Add project reference documentation
Diagram Walkthrough
File Walkthrough
client_registry.py
Register Qwen CLI in client registry
src/mcpm/clients/client_registry.py
__init__.py
Export QwenCliManager in package init
src/mcpm/clients/managers/init.py
qwen_cli.py
Implement Qwen CLI manager class
src/mcpm/clients/managers/qwen_cli.py
test_qwen_cli.py
Add comprehensive Qwen CLI manager tests
tests/test_clients/test_qwen_cli.py
QWEN.md
Add Qwen project reference documentation
QWEN.md
Summary by CodeRabbit
New Features
Documentation
Tests