Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions docs/developers/tools/mcp-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -834,23 +834,25 @@ qwen mcp add --transport sse sse-server https://api.example.com/sse/
qwen mcp add --transport sse secure-sse https://api.example.com/sse/ --header "Authorization: Bearer abc123"
```

### Listing Servers (`qwen mcp list`)
### Managing Servers (`qwen mcp`)

To view all MCP servers currently configured, use the `list` command. It displays each server's name, configuration details, and connection status.
To view and manage all MCP servers currently configured, use the `manage` command or simply `qwen mcp`. This opens an interactive TUI dialog where you can:

- View all MCP servers with their connection status
- Enable/disable servers
- Reconnect to disconnected servers
- View tools and prompts provided by each server
- View server logs

**Command:**

```bash
qwen mcp list
qwen mcp
# or
qwen mcp manage
```

**Example Output:**

```sh
✓ stdio-server: command: python3 server.py (stdio) - Connected
✓ http-server: https://api.example.com/mcp (http) - Connected
✗ sse-server: https://api.example.com/sse (sse) - Disconnected
```
The management dialog provides a visual interface showing each server's name, configuration details, connection status, and available tools/prompts.

### Removing a Server (`qwen mcp remove`)

Expand Down
10 changes: 2 additions & 8 deletions docs/users/features/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Qwen Code loads MCP servers from `mcpServers` in your `settings.json`. You can c
qwen mcp add --transport http my-server http://localhost:3000/mcp
```

2. Verify it shows up:
2. Open MCP management dialog to view and manage servers:

```bash
qwen mcp list
qwen mcp
```

3. Restart Qwen Code in the same project (or start it if it wasn’t running yet), then ask the model to use tools from that server.
Expand Down Expand Up @@ -274,12 +274,6 @@ qwen mcp add [options] <name> <commandOrUrl> [args...]
| `--include-tools` | A comma-separated list of tools to include. | all tools included | `--include-tools mytool,othertool` |
| `--exclude-tools` | A comma-separated list of tools to exclude. | none | `--exclude-tools mytool` |

#### Listing servers (`qwen mcp list`)

```bash
qwen mcp list
```

#### Removing a server (`qwen mcp remove`)

```bash
Expand Down
11 changes: 10 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions packages/cli/src/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1256,20 +1256,26 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
});
});

it('should read excludeMCPServers from settings', async () => {
it('should read excludeMCPServers from settings but still return all servers', async () => {
process.argv = ['node', 'script.js'];
const argv = await parseArguments();
const settings: Settings = {
...baseSettings,
mcp: { excluded: ['server1', 'server2'] },
};
const config = await loadCliConfig(settings, argv, undefined, []);
// getMcpServers() now returns all servers, use isMcpServerDisabled() to check status
expect(config.getMcpServers()).toEqual({
server1: { url: 'http://localhost:8080' },
server2: { url: 'http://localhost:8081' },
server3: { url: 'http://localhost:8082' },
});
expect(config.isMcpServerDisabled('server1')).toBe(true);
expect(config.isMcpServerDisabled('server2')).toBe(true);
expect(config.isMcpServerDisabled('server3')).toBe(false);
});

it('should override allowMCPServers with excludeMCPServers if overlapping', async () => {
it('should apply allowedMcpServers filter but excluded servers are still returned', async () => {
process.argv = ['node', 'script.js'];
const argv = await parseArguments();
const settings: Settings = {
Expand All @@ -1280,9 +1286,14 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
},
};
const config = await loadCliConfig(settings, argv, undefined, []);
// allowedMcpServers filters which servers are available
// but excluded servers are still returned by getMcpServers()
expect(config.getMcpServers()).toEqual({
server1: { url: 'http://localhost:8080' },
server2: { url: 'http://localhost:8081' },
});
expect(config.isMcpServerDisabled('server1')).toBe(true);
expect(config.isMcpServerDisabled('server2')).toBe(false);
});

it('should prioritize mcp server flag if set', async () => {
Expand Down
34 changes: 32 additions & 2 deletions packages/cli/src/i18n/locales/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default {
// ============================================================================
'Analyzes the project and creates a tailored QWEN.md file.':
'Analysiert das Projekt und erstellt eine maßgeschneiderte QWEN.md-Datei.',
'list available Qwen Code tools. Usage: /tools [desc]':
'List available Qwen Code tools. Usage: /tools [desc]':
'Verfügbare Qwen Code Werkzeuge auflisten. Verwendung: /tools [desc]',
'Available Qwen Code CLI tools:': 'Verfügbare Qwen Code CLI-Werkzeuge:',
'No tools available': 'Keine Werkzeuge verfügbar',
Expand Down Expand Up @@ -359,7 +359,9 @@ export default {
'Show tool-specific usage statistics.':
'Werkzeugspezifische Nutzungsstatistiken anzeigen.',
'exit the cli': 'CLI beenden',
'list configured MCP servers and tools, or authenticate with OAuth-enabled servers':
'Open MCP management dialog, or authenticate with OAuth-enabled servers':
'MCP-Verwaltungsdialog öffnen oder mit OAuth-fähigem Server authentifizieren',
'List configured MCP servers and tools, or authenticate with OAuth-enabled servers':
'Konfigurierte MCP-Server und Werkzeuge auflisten oder mit OAuth-fähigen Servern authentifizieren',
'Manage workspace directories': 'Arbeitsbereichsverzeichnisse verwalten',
'Add directories to the workspace. Use comma to separate multiple paths':
Expand Down Expand Up @@ -881,9 +883,37 @@ export default {
'Do you want to proceed?': 'Möchten Sie fortfahren?',
'Yes, allow once': 'Ja, einmal erlauben',
'Allow always': 'Immer erlauben',
Yes: 'Ja',
No: 'Nein',
'No (esc)': 'Nein (Esc)',
'Yes, allow always for this session': 'Ja, für diese Sitzung immer erlauben',

// MCP Management Dialog (translations for MCP UI components)
Disable: 'Deaktivieren',
Enable: 'Aktivieren',
Reconnect: 'Neu verbinden',
'View tools': 'Werkzeuge anzeigen',
'(disabled)': '(deaktiviert)',
'Error:': 'Fehler:',
Extension: 'Erweiterung',
tool: 'Werkzeug',
connected: 'verbunden',
connecting: 'verbindet',
disconnected: 'getrennt',
error: 'Fehler',
// Invalid tool related translations
'{{count}} invalid tools': '{{count}} ungültige Werkzeuge',
invalid: 'ungültig',
'invalid: {{reason}}': 'ungültig: {{reason}}',
'missing name': 'Name fehlt',
'missing description': 'Beschreibung fehlt',
'(unnamed)': '(unbenannt)',
unknown: 'unbekannt',
'Warning: This tool cannot be called by the LLM':
'Warnung: Dieses Werkzeug kann nicht vom LLM aufgerufen werden',
Reason: 'Grund',
'Tools must have both name and description to be used by the LLM.':
'Werkzeuge müssen sowohl einen Namen als auch eine Beschreibung haben, um vom LLM verwendet zu werden.',
'Modify in progress:': 'Änderung in Bearbeitung:',
'Save and close external editor to continue':
'Speichern und externen Editor schließen, um fortzufahren',
Expand Down
67 changes: 63 additions & 4 deletions packages/cli/src/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export default {
// ============================================================================
'Analyzes the project and creates a tailored QWEN.md file.':
'Analyzes the project and creates a tailored QWEN.md file.',
'list available Qwen Code tools. Usage: /tools [desc]':
'list available Qwen Code tools. Usage: /tools [desc]',
'List available Qwen Code tools. Usage: /tools [desc]':
'List available Qwen Code tools. Usage: /tools [desc]',
'Available Qwen Code CLI tools:': 'Available Qwen Code CLI tools:',
'No tools available': 'No tools available',
'View or change the approval mode for tool usage':
Expand Down Expand Up @@ -375,8 +375,10 @@ export default {
'Show tool-specific usage statistics.':
'Show tool-specific usage statistics.',
'exit the cli': 'exit the cli',
'list configured MCP servers and tools, or authenticate with OAuth-enabled servers':
'list configured MCP servers and tools, or authenticate with OAuth-enabled servers',
'Open MCP management dialog, or authenticate with OAuth-enabled servers':
'Open MCP management dialog, or authenticate with OAuth-enabled servers',
'List configured MCP servers and tools, or authenticate with OAuth-enabled servers':
'List configured MCP servers and tools, or authenticate with OAuth-enabled servers',
'Manage workspace directories': 'Manage workspace directories',
'Add directories to the workspace. Use comma to separate multiple paths':
'Add directories to the workspace. Use comma to separate multiple paths',
Expand Down Expand Up @@ -725,6 +727,7 @@ export default {
'List configured MCP servers and tools':
'List configured MCP servers and tools',
'Restarts MCP servers.': 'Restarts MCP servers.',
'Open MCP management dialog': 'Open MCP management dialog',
'Config not loaded.': 'Config not loaded.',
'Could not retrieve tool registry.': 'Could not retrieve tool registry.',
'No MCP servers configured with OAuth authentication.':
Expand All @@ -741,6 +744,61 @@ export default {
"Re-discovering tools from '{{name}}'...":
"Re-discovering tools from '{{name}}'...",

// ============================================================================
// MCP Management Dialog
// ============================================================================
'Manage MCP servers': 'Manage MCP servers',
'Server Detail': 'Server Detail',
'Disable Server': 'Disable Server',
Tools: 'Tools',
'Tool Detail': 'Tool Detail',
'MCP Management': 'MCP Management',
'Unknown step': 'Unknown step',
'↑↓ to navigate · Enter to select · Esc to close':
'↑↓ to navigate · Enter to select · Esc to close',
'↑↓ to navigate · Enter to select · Esc to back':
'↑↓ to navigate · Enter to select · Esc to back',
'↑↓ to navigate · Enter to confirm · Esc to back':
'↑↓ to navigate · Enter to confirm · Esc to back',
'User Settings (global)': 'User Settings (global)',
'Workspace Settings (project-specific)':
'Workspace Settings (project-specific)',
'Disable server:': 'Disable server:',
'Select where to add the server to the exclude list:':
'Select where to add the server to the exclude list:',
'Press Enter to confirm, Esc to cancel':
'Press Enter to confirm, Esc to cancel',
'View tools': 'View tools',
Reconnect: 'Reconnect',
Enable: 'Enable',
Disable: 'Disable',
'Status:': 'Status:',
'Command:': 'Command:',
'Working Directory:': 'Working Directory:',
'Capabilities:': 'Capabilities:',
prompts: 'prompts',
'(disabled)': '(disabled)',
'Error:': 'Error:',
Extension: 'Extension',
tool: 'tool',
connected: 'connected',
connecting: 'connecting',
disconnected: 'disconnected',
error: 'error',
// Invalid tool related translations
'{{count}} invalid tools': '{{count}} invalid tools',
invalid: 'invalid',
'invalid: {{reason}}': 'invalid: {{reason}}',
'missing name': 'missing name',
'missing description': 'missing description',
'(unnamed)': '(unnamed)',
unknown: 'unknown',
'Warning: This tool cannot be called by the LLM':
'Warning: This tool cannot be called by the LLM',
Reason: 'Reason',
'Tools must have both name and description to be used by the LLM.':
'Tools must have both name and description to be used by the LLM.',

// ============================================================================
// Commands - Chat
// ============================================================================
Expand Down Expand Up @@ -873,6 +931,7 @@ export default {
'Do you want to proceed?': 'Do you want to proceed?',
'Yes, allow once': 'Yes, allow once',
'Allow always': 'Allow always',
Yes: 'Yes',
No: 'No',
'No (esc)': 'No (esc)',
'Yes, allow always for this session': 'Yes, allow always for this session',
Expand Down
34 changes: 32 additions & 2 deletions packages/cli/src/i18n/locales/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default {
// ============================================================================
'Analyzes the project and creates a tailored QWEN.md file.':
'プロジェクトを分析し、カスタマイズされた QWEN.md ファイルを作成',
'list available Qwen Code tools. Usage: /tools [desc]':
'List available Qwen Code tools. Usage: /tools [desc]':
'利用可能な Qwen Code ツールを一覧表示。使い方: /tools [desc]',
'Available Qwen Code CLI tools:': '利用可能な Qwen Code CLI ツール:',
'No tools available': '利用可能なツールはありません',
Expand Down Expand Up @@ -316,7 +316,9 @@ export default {
'セッション統計を確認。使い方: /stats [model|tools]',
'Show model-specific usage statistics.': 'モデル別の使用統計を表示',
'Show tool-specific usage statistics.': 'ツール別の使用統計を表示',
'list configured MCP servers and tools, or authenticate with OAuth-enabled servers':
'Open MCP management dialog, or authenticate with OAuth-enabled servers':
'MCP管理ダイアログを開く、またはOAuth対応サーバーで認証',
'List configured MCP servers and tools, or authenticate with OAuth-enabled servers':
'設定済みのMCPサーバーとツールを一覧表示、またはOAuth対応サーバーで認証',
'Manage workspace directories': 'ワークスペースディレクトリを管理',
'Add directories to the workspace. Use comma to separate multiple paths':
Expand Down Expand Up @@ -621,9 +623,37 @@ export default {
'Do you want to proceed?': '続行しますか?',
'Yes, allow once': 'はい(今回のみ許可)',
'Allow always': '常に許可する',
Yes: 'はい',
No: 'いいえ',
'No (esc)': 'いいえ (Esc)',
'Yes, allow always for this session': 'はい、このセッションで常に許可',

// MCP Management - Core translations
Disable: '無効化',
Enable: '有効化',
Reconnect: '再接続',
'View tools': 'ツールを表示',
'(disabled)': '(無効)',
'Error:': 'エラー:',
Extension: '拡張機能',
tool: 'ツール',
connected: '接続済み',
connecting: '接続中',
disconnected: '切断済み',
error: 'エラー',
// Invalid tool related translations
'{{count}} invalid tools': '{{count}} 個の無効なツール',
invalid: '無効',
'invalid: {{reason}}': '無効: {{reason}}',
'missing name': '名前なし',
'missing description': '説明なし',
'(unnamed)': '(名前なし)',
unknown: '不明',
'Warning: This tool cannot be called by the LLM':
'警告: このツールはLLMによって呼び出すことができません',
Reason: '理由',
'Tools must have both name and description to be used by the LLM.':
'ツールはLLMによって使用されるには名前と説明の両方が必要です。',
'Modify in progress:': '変更中:',
'Save and close external editor to continue':
'続行するには外部エディタを保存して閉じてください',
Expand Down
Loading