@qwen-code/qwen-code 0.15.0-preview.0 → 0.15.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -153,6 +153,84 @@ qwen mcp add --transport sse sseServer http://localhost:8080/sse --timeout 30000
153
153
 
154
154
  - **Server trust** (`trust: true`): bypasses confirmation prompts for that server (use sparingly).
155
155
 
156
+ ### OAuth authentication
157
+
158
+ Qwen Code supports OAuth 2.0 authentication for MCP servers. This is useful when accessing remote servers that require authentication.
159
+
160
+ #### Basic usage
161
+
162
+ When you add an MCP server with OAuth credentials, Qwen Code will automatically handle the authentication flow:
163
+
164
+ ```bash
165
+ qwen mcp add --transport sse oauth-server https://api.example.com/sse/ \
166
+ --oauth-client-id your-client-id \
167
+ --oauth-redirect-uri https://your-server.com/oauth/callback \
168
+ --oauth-authorization-url https://provider.example.com/authorize \
169
+ --oauth-token-url https://provider.example.com/token
170
+ ```
171
+
172
+ #### Important: Redirect URI configuration
173
+
174
+ The OAuth flow requires a redirect URI where the authorization provider sends the authentication code.
175
+
176
+ - **Local development**: By default, Qwen Code uses `http://localhost:7777/oauth/callback`. This works when running Qwen Code on your local machine with a local browser.
177
+
178
+ - **Remote/cloud deployments**: When running Qwen Code on remote servers, cloud IDEs, or web terminals, the default `localhost` redirect will NOT work. You MUST configure `--oauth-redirect-uri` to point to a publicly accessible URL that can receive the OAuth callback.
179
+
180
+ Example for remote servers:
181
+
182
+ ```bash
183
+ qwen mcp add --transport sse remote-server https://api.example.com/sse/ \
184
+ --oauth-redirect-uri https://your-remote-server.example.com/oauth/callback
185
+ ```
186
+
187
+ #### Manual configuration via settings.json
188
+
189
+ You can also configure OAuth by editing `settings.json` directly:
190
+
191
+ ```json
192
+ {
193
+ "mcpServers": {
194
+ "oauthServer": {
195
+ "url": "https://api.example.com/sse/",
196
+ "oauth": {
197
+ "enabled": true,
198
+ "clientId": "your-client-id",
199
+ "clientSecret": "your-client-secret",
200
+ "authorizationUrl": "https://provider.example.com/authorize",
201
+ "tokenUrl": "https://provider.example.com/token",
202
+ "redirectUri": "https://your-server.com/oauth/callback",
203
+ "scopes": ["read", "write"]
204
+ }
205
+ }
206
+ }
207
+ }
208
+ ```
209
+
210
+ OAuth configuration properties:
211
+
212
+ | Property | Description |
213
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------- |
214
+ | `enabled` | Enable OAuth for this server (boolean) |
215
+ | `clientId` | OAuth client identifier (string, optional with dynamic registration) |
216
+ | `clientSecret` | OAuth client secret (string, optional for public clients) |
217
+ | `authorizationUrl` | OAuth authorization endpoint (string, auto-discovered if omitted) |
218
+ | `tokenUrl` | OAuth token endpoint (string, auto-discovered if omitted) |
219
+ | `scopes` | Required OAuth scopes (array of strings) |
220
+ | `redirectUri` | Custom redirect URI (string). **Critical for remote deployments**. Defaults to `http://localhost:7777/oauth/callback` |
221
+ | `tokenParamName` | Query parameter name for tokens in SSE URLs (string) |
222
+ | `audiences` | Audiences the token is valid for (array of strings) |
223
+
224
+ #### Token management
225
+
226
+ OAuth tokens are automatically:
227
+
228
+ - **Stored securely** in `~/.qwen/mcp-oauth-tokens.json`
229
+ - **Refreshed** when expired (if refresh tokens are available)
230
+ - **Validated** before each connection attempt
231
+
232
+ Use the `/mcp auth` command within Qwen Code to manage OAuth authentication interactively.
233
+
156
234
  ### Tool filtering (allow/deny tools per server)
157
235
 
158
236
  Use `includeTools` / `excludeTools` to restrict tools exposed by a server (from Qwen Code’s perspective).
@@ -259,20 +337,28 @@ You can always configure MCP servers by manually editing `settings.json`, but th
259
337
  qwen mcp add [options] <name> <commandOrUrl> [args...]
260
338
  ```
261
339
 
262
- | Argument/Option | Description | Default | Example |
263
- | ------------------- | ------------------------------------------------------------------- | ------------------ | ----------------------------------------- |
264
- | `<name>` | A unique name for the server. | — | `example-server` |
265
- | `<commandOrUrl>` | The command to execute (for `stdio`) or the URL (for `http`/`sse`). | — | `/usr/bin/python` or `http://localhost:8` |
266
- | `[args...]` | Optional arguments for a `stdio` command. | — | `--port 5000` |
267
- | `-s`, `--scope` | Configuration scope (user or project). | `project` | `-s user` |
268
- | `-t`, `--transport` | Transport type (`stdio`, `sse`, `http`). | `stdio` | `-t sse` |
269
- | `-e`, `--env` | Set environment variables. | — | `-e KEY=value` |
270
- | `-H`, `--header` | Set HTTP headers for SSE and HTTP transports. | — | `-H "X-Api-Key: abc123"` |
271
- | `--timeout` | Set connection timeout in milliseconds. | — | `--timeout 30000` |
272
- | `--trust` | Trust the server (bypass all tool call confirmation prompts). | — (`false`) | `--trust` |
273
- | `--description` | Set the description for the server. | — | `--description "Local tools"` |
274
- | `--include-tools` | A comma-separated list of tools to include. | all tools included | `--include-tools mytool,othertool` |
275
- | `--exclude-tools` | A comma-separated list of tools to exclude. | none | `--exclude-tools mytool` |
340
+ | Argument/Option | Description | Default | Example |
341
+ | --------------------------- | ------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------ |
342
+ | `<name>` | A unique name for the server. | — | `example-server` |
343
+ | `<commandOrUrl>` | The command to execute (for `stdio`) or the URL (for `http`/`sse`). | — | `/usr/bin/python` or `http://localhost:8` |
344
+ | `[args...]` | Optional arguments for a `stdio` command. | — | `--port 5000` |
345
+ | `-s`, `--scope` | Configuration scope (user or project). | `project` | `-s user` |
346
+ | `-t`, `--transport` | Transport type (`stdio`, `sse`, `http`). | `stdio` | `-t sse` |
347
+ | `-e`, `--env` | Set environment variables. | — | `-e KEY=value` |
348
+ | `-H`, `--header` | Set HTTP headers for SSE and HTTP transports. | — | `-H "X-Api-Key: abc123"` |
349
+ | `--timeout` | Set connection timeout in milliseconds. | — | `--timeout 30000` |
350
+ | `--trust` | Trust the server (bypass all tool call confirmation prompts). | — (`false`) | `--trust` |
351
+ | `--description` | Set the description for the server. | — | `--description "Local tools"` |
352
+ | `--include-tools` | A comma-separated list of tools to include. | all tools included | `--include-tools mytool,othertool` |
353
+ | `--exclude-tools` | A comma-separated list of tools to exclude. | none | `--exclude-tools mytool` |
354
+ | `--oauth-client-id` | OAuth client ID for MCP server authentication. | — | `--oauth-client-id your-client-id` |
355
+ | `--oauth-client-secret` | OAuth client secret for MCP server authentication. | — | `--oauth-client-secret your-client-secret` |
356
+ | `--oauth-redirect-uri` | OAuth redirect URI for authentication callback. | `http://localhost:7777/oauth/callback` | `--oauth-redirect-uri https://your-server.com/oauth/callback` |
357
+ | `--oauth-authorization-url` | OAuth authorization URL. | — | `--oauth-authorization-url https://provider.example.com/authorize` |
358
+ | `--oauth-token-url` | OAuth token URL. | — | `--oauth-token-url https://provider.example.com/token` |
359
+ | `--oauth-scopes` | OAuth scopes (comma-separated). | — | `--oauth-scopes scope1,scope2` |
360
+
361
+ > `--oauth-*` flags apply only to `--transport sse` and `--transport http`. Combining them with `--transport stdio` is rejected.
276
362
 
277
363
  #### Removing a server (`qwen mcp remove`)
278
364
 
@@ -60,10 +60,11 @@ Add a `statusLine` object under the `ui` key in `~/.qwen/settings.json`:
60
60
  }
61
61
  ```
62
62
 
63
- | Field | Type | Required | Description |
64
- | --------- | ----------- | -------- | --------------------------------------------------------------------------------------- |
65
- | `type` | `"command"` | Yes | Must be `"command"` |
66
- | `command` | string | Yes | Shell command to execute. Receives JSON via stdin, stdout is displayed (up to 2 lines). |
63
+ | Field | Type | Required | Description |
64
+ | ----------------- | ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
65
+ | `type` | `"command"` | Yes | Must be `"command"` |
66
+ | `command` | string | Yes | Shell command to execute. Receives JSON via stdin, stdout is displayed (up to 2 lines). |
67
+ | `refreshInterval` | number | No | Re-run the command every N seconds (minimum 1). Useful for data that changes without an Agent state event (clock, quota, uptime). |
67
68
 
68
69
  ## JSON input
69
70
 
@@ -188,6 +189,24 @@ Output: `my-project (main)`
188
189
 
189
190
  Output: `+120/-30 lines`
190
191
 
192
+ ### Live clock and git branch
193
+
194
+ Use `refreshInterval` when the statusline shows data that changes without an Agent event (e.g. the clock, uptime, or rate-limit counters):
195
+
196
+ ```json
197
+ {
198
+ "ui": {
199
+ "statusLine": {
200
+ "type": "command",
201
+ "command": "input=$(cat); branch=$(echo \"$input\" | jq -r '.git.branch // \"no-git\"'); echo \"$(date +%H:%M:%S) ($branch)\"",
202
+ "refreshInterval": 1
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ Output (refreshed every second): `14:32:07 (main)`
209
+
191
210
  ### Script file for complex commands
192
211
 
193
212
  For longer commands, save a script file at `~/.qwen/statusline-command.sh`:
@@ -225,7 +244,7 @@ Then reference it in settings:
225
244
 
226
245
  ## Behavior
227
246
 
228
- - **Update triggers**: The status line updates when the model changes, a new message is sent (token count changes), vim mode is toggled, git branch changes, tool calls complete, or file changes occur. Updates are debounced (300ms).
247
+ - **Update triggers**: The status line updates when the model changes, a new message is sent (token count changes), vim mode is toggled, git branch changes, tool calls complete, or file changes occur. Updates are debounced (300ms). Set `refreshInterval` (seconds) to additionally re-run the command on a timer — useful for data that changes without an Agent event (clock, rate limits, build status).
229
248
  - **Timeout**: Commands that take longer than 5 seconds are killed. The status line clears on failure.
230
249
  - **Output**: Multi-line output is supported (up to 2 lines; extra lines are discarded). Each line is rendered as a separate row with dimmed colors in the footer's left section. Lines that exceed the available width are truncated.
231
250
  - **Hot reload**: Changes to `ui.statusLine` in settings take effect immediately — no restart required.
@@ -238,5 +257,5 @@ Then reference it in settings:
238
257
  | ----------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
239
258
  | Status line not showing | Config at wrong path | Must be under `ui.statusLine`, not root-level `statusLine` |
240
259
  | Empty output | Command fails silently | Test manually: `echo '{"session_id":"test","version":"0.14.1","model":{"display_name":"test"},"context_window":{"context_window_size":0,"used_percentage":0,"remaining_percentage":100,"current_usage":0,"total_input_tokens":0,"total_output_tokens":0},"workspace":{"current_dir":"/tmp"},"metrics":{"models":{},"files":{"total_lines_added":0,"total_lines_removed":0}}}' \| sh -c 'your_command'` |
241
- | Stale data | No trigger fired | Send a message or switch models to trigger an update |
260
+ | Stale data | No trigger fired | Send a message or switch models to trigger an update — or set `refreshInterval` to re-run the command on a timer |
242
261
  | Command too slow | Complex script | Optimize the script or move heavy work to a background cache |