Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
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 @@ -1322,20 +1322,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 @@ -1346,9 +1352,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
98 changes: 96 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 @@ -360,7 +360,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 @@ -882,9 +884,101 @@ 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)
'Manage MCP servers': 'MCP-Server verwalten',
'Server Detail': 'Serverdetails',
'Disable Server': 'Server deaktivieren',
Tools: 'Werkzeuge',
'Tool Detail': 'Werkzeugdetails',
'MCP Management': 'MCP-Verwaltung',
'Loading...': 'Lädt...',
'Unknown step': 'Unbekannter Schritt',
'Esc to back': 'Esc zurück',
'↑↓ to navigate · Enter to select · Esc to close':
'↑↓ navigieren · Enter auswählen · Esc schließen',
'↑↓ to navigate · Enter to select · Esc to back':
'↑↓ navigieren · Enter auswählen · Esc zurück',
'↑↓ to navigate · Enter to confirm · Esc to back':
'↑↓ navigieren · Enter bestätigen · Esc zurück',
'User Settings (global)': 'Benutzereinstellungen (global)',
'Workspace Settings (project-specific)':
'Arbeitsbereichseinstellungen (projektspezifisch)',
'Disable server:': 'Server deaktivieren:',
'Select where to add the server to the exclude list:':
'Wählen Sie, wo der Server zur Ausschlussliste hinzugefügt werden soll:',
'Press Enter to confirm, Esc to cancel':
'Enter zum Bestätigen, Esc zum Abbrechen',
Disable: 'Deaktivieren',
Enable: 'Aktivieren',
Reconnect: 'Neu verbinden',
'View tools': 'Werkzeuge anzeigen',
'Status:': 'Status:',
'Command:': 'Befehl:',
'Working Directory:': 'Arbeitsverzeichnis:',
'Capabilities:': 'Fähigkeiten:',
'No server selected': 'Kein Server ausgewählt',
'(disabled)': '(deaktiviert)',
'Error:': 'Fehler:',
Extension: 'Erweiterung',
tool: 'Werkzeug',
tools: 'Werkzeuge',
connected: 'verbunden',
connecting: 'verbindet',
disconnected: 'getrennt',
error: 'Fehler',

// MCP Server List
'User MCPs': 'Benutzer-MCPs',
'Project MCPs': 'Projekt-MCPs',
'Extension MCPs': 'Erweiterungs-MCPs',
server: 'Server',
servers: 'Server',
'Add MCP servers to your settings to get started.':
'Fügen Sie MCP-Server zu Ihren Einstellungen hinzu, um zu beginnen.',
'Run qwen --debug to see error logs':
'Führen Sie qwen --debug aus, um Fehlerprotokolle anzuzeigen',

// MCP Tool List
'No tools available for this server.':
'Keine Werkzeuge für diesen Server verfügbar.',
destructive: 'destruktiv',
'read-only': 'schreibgeschützt',
'open-world': 'offene Welt',
idempotent: 'idempotent',
'Tools for {{name}}': 'Werkzeuge für {{name}}',
'{{current}}/{{total}}': '{{current}}/{{total}}',

// MCP Tool Detail
required: 'erforderlich',
Type: 'Typ',
Enum: 'Aufzählung',
Parameters: 'Parameter',
'No tool selected': 'Kein Werkzeug ausgewählt',
Annotations: 'Anmerkungen',
Title: 'Titel',
'Read Only': 'Schreibgeschützt',
Destructive: 'Destruktiv',
Idempotent: 'Idempotent',
'Open World': 'Offene Welt',
Server: 'Server',

// 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)',
'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
104 changes: 100 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 @@ -376,8 +376,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 @@ -726,6 +728,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 @@ -742,6 +745,98 @@ 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',
'Loading...': 'Loading...',
'Unknown step': 'Unknown step',
'Esc to back': 'Esc to back',
'↑↓ 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:',
'No server selected': 'No server selected',
prompts: 'prompts',
'(disabled)': '(disabled)',
'Error:': 'Error:',
Extension: 'Extension',
tool: 'tool',
tools: 'tools',
connected: 'connected',
connecting: 'connecting',
disconnected: 'disconnected',
error: 'error',

// MCP Server List
'User MCPs': 'User MCPs',
'Project MCPs': 'Project MCPs',
'Extension MCPs': 'Extension MCPs',
server: 'server',
servers: 'servers',
'Add MCP servers to your settings to get started.':
'Add MCP servers to your settings to get started.',
'Run qwen --debug to see error logs': 'Run qwen --debug to see error logs',

// MCP Tool List
'No tools available for this server.': 'No tools available for this server.',
destructive: 'destructive',
'read-only': 'read-only',
'open-world': 'open-world',
idempotent: 'idempotent',
'Tools for {{name}}': 'Tools for {{name}}',
'{{current}}/{{total}}': '{{current}}/{{total}}',

// MCP Tool Detail
required: 'required',
Type: 'Type',
Enum: 'Enum',
Parameters: 'Parameters',
'No tool selected': 'No tool selected',
Annotations: 'Annotations',
Title: 'Title',
'Read Only': 'Read Only',
Destructive: 'Destructive',
Idempotent: 'Idempotent',
'Open World': 'Open World',
Server: 'Server',

// 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)',
'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 @@ -874,6 +969,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
Loading