mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
fix(cli): accept uppercase URL schemes in mcp add transport detection (#5426)
Some checks are pending
Qwen Code CI / Classify PR (push) Waiting to run
Qwen Code CI / Lint (push) Blocked by required conditions
Qwen Code CI / Test (macos-latest, Node 22.x) (push) Blocked by required conditions
Qwen Code CI / Test (ubuntu-latest, Node 22.x) (push) Blocked by required conditions
Qwen Code CI / Test (windows-latest, Node 22.x) (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Blocked by required conditions
Qwen Code CI / Integration Tests (CLI, No Sandbox) (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
Some checks are pending
Qwen Code CI / Classify PR (push) Waiting to run
Qwen Code CI / Lint (push) Blocked by required conditions
Qwen Code CI / Test (macos-latest, Node 22.x) (push) Blocked by required conditions
Qwen Code CI / Test (ubuntu-latest, Node 22.x) (push) Blocked by required conditions
Qwen Code CI / Test (windows-latest, Node 22.x) (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Blocked by required conditions
Qwen Code CI / Integration Tests (CLI, No Sandbox) (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
This commit is contained in:
parent
18cc73ce05
commit
196670a356
2 changed files with 11 additions and 5 deletions
|
|
@ -115,6 +115,16 @@ describe('mcp add command', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should auto-detect http transport when commandOrUrl uses an uppercase URL scheme', async () => {
|
||||
await parser.parseAsync('add http-server HTTPS://example.com/mcp');
|
||||
|
||||
expect(mockSetValue).toHaveBeenCalledWith(SettingScope.User, 'mcpServers', {
|
||||
'http-server': {
|
||||
httpUrl: 'HTTPS://example.com/mcp',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should respect explicit transport even when commandOrUrl is a URL', async () => {
|
||||
await parser.parseAsync(
|
||||
'add --transport sse sse-server https://example.com/sse-endpoint',
|
||||
|
|
|
|||
|
|
@ -302,11 +302,7 @@ export const addCommand: CommandModule = {
|
|||
// Auto-detect transport from URL if not explicitly specified
|
||||
if (!argv['transport']) {
|
||||
const commandOrUrl = argv['commandOrUrl'] as string;
|
||||
if (
|
||||
commandOrUrl &&
|
||||
(commandOrUrl.startsWith('http://') ||
|
||||
commandOrUrl.startsWith('https://'))
|
||||
) {
|
||||
if (commandOrUrl && /^https?:\/\//i.test(commandOrUrl)) {
|
||||
argv['transport'] = 'http';
|
||||
} else {
|
||||
argv['transport'] = 'stdio';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue