forked from pathintegral-institute/mcpm.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqwen_cli.py
More file actions
61 lines (49 loc) · 1.9 KB
/
Copy pathqwen_cli.py
File metadata and controls
61 lines (49 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
Qwen CLI integration utilities for MCP
"""
import logging
import os
import shutil
from typing import Any, Dict
from mcpm.clients.base import JSONClientManager
logger = logging.getLogger(__name__)
class QwenCliManager(JSONClientManager):
"""Manages Qwen CLI MCP server configurations"""
# Client information
client_key = "qwen-cli"
display_name = "Qwen CLI"
download_url = "https://github.com/QwenLM/qwen-code"
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
"""
# Qwen CLI stores its settings in ~/.qwen/settings.json
self.config_path = os.path.expanduser("~/.qwen/settings.json")
super().__init__(config_path_override=config_path_override)
def _get_empty_config(self) -> Dict[str, Any]:
"""Get empty config structure for Qwen CLI"""
return {
"mcpServers": {},
# Include other default settings that Qwen CLI expects
"theme": "Qwen Dark",
"selectedAuthType": "openai",
}
def is_client_installed(self) -> bool:
"""Check if Qwen CLI is installed
Returns:
bool: True if qwen command is available, False otherwise
"""
qwen_executable = "qwen.exe" if self._system == "Windows" else "qwen"
return shutil.which(qwen_executable) is not None
def get_client_info(self) -> Dict[str, str]:
"""Get information about this client
Returns:
Dict: Information about the client including display name, download URL, and config path
"""
return {
"name": self.display_name,
"download_url": self.download_url,
"config_file": self.config_path,
"description": "Alibaba's Qwen CLI tool",
}