Skip to content

Commit 55b0c5c

Browse files
fix(patch): cherry-pick e9a601c to release/v0.23.0-preview.3-pr-15465 to patch version v0.23.0-preview.3 and create version 0.23.0-preview.4 (#15682)
Co-authored-by: Jack Wotherspoon <jackwoth@google.com>
1 parent dbcad90 commit 55b0c5c

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

packages/cli/src/config/settings-validation.test.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,60 @@ describe('settings-validation', () => {
219219
}
220220
});
221221

222+
it('should validate mcpServers with type field for all transport types', () => {
223+
const validSettings = {
224+
mcpServers: {
225+
'sse-server': {
226+
url: 'https://example.com/sse',
227+
type: 'sse',
228+
headers: { 'X-API-Key': 'key' },
229+
},
230+
'http-server': {
231+
url: 'https://example.com/mcp',
232+
type: 'http',
233+
},
234+
'stdio-server': {
235+
command: '/usr/bin/mcp-server',
236+
type: 'stdio',
237+
},
238+
},
239+
};
240+
241+
const result = validateSettings(validSettings);
242+
expect(result.success).toBe(true);
243+
});
244+
245+
it('should reject invalid type values in mcpServers', () => {
246+
const invalidSettings = {
247+
mcpServers: {
248+
'bad-server': {
249+
url: 'https://example.com/mcp',
250+
type: 'invalid-type',
251+
},
252+
},
253+
};
254+
255+
const result = validateSettings(invalidSettings);
256+
expect(result.success).toBe(false);
257+
});
258+
259+
it('should validate mcpServers without type field', () => {
260+
const validSettings = {
261+
mcpServers: {
262+
'stdio-server': {
263+
command: '/usr/bin/mcp-server',
264+
args: ['--port', '8080'],
265+
},
266+
'url-server': {
267+
url: 'https://example.com/mcp',
268+
},
269+
},
270+
};
271+
272+
const result = validateSettings(validSettings);
273+
expect(result.success).toBe(true);
274+
});
275+
222276
it('should validate complex nested customThemes configuration', () => {
223277
const invalidSettings = {
224278
ui: {

packages/cli/src/config/settingsSchema.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,8 @@ export const SETTINGS_SCHEMA_DEFINITIONS: Record<
16621662
},
16631663
url: {
16641664
type: 'string',
1665-
description: 'SSE transport URL.',
1665+
description:
1666+
'URL for SSE or HTTP transport. Use with "type" field to specify transport type.',
16661667
},
16671668
httpUrl: {
16681669
type: 'string',
@@ -1677,6 +1678,12 @@ export const SETTINGS_SCHEMA_DEFINITIONS: Record<
16771678
type: 'string',
16781679
description: 'TCP address for websocket transport.',
16791680
},
1681+
type: {
1682+
type: 'string',
1683+
description:
1684+
'Transport type. Use "stdio" for local command, "sse" for Server-Sent Events, or "http" for Streamable HTTP.',
1685+
enum: ['stdio', 'sse', 'http'],
1686+
},
16801687
timeout: {
16811688
type: 'number',
16821689
description: 'Timeout in milliseconds for MCP requests.',

schemas/settings.schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@
15621562
},
15631563
"url": {
15641564
"type": "string",
1565-
"description": "SSE transport URL."
1565+
"description": "URL for SSE or HTTP transport. Use with \"type\" field to specify transport type."
15661566
},
15671567
"httpUrl": {
15681568
"type": "string",
@@ -1579,6 +1579,11 @@
15791579
"type": "string",
15801580
"description": "TCP address for websocket transport."
15811581
},
1582+
"type": {
1583+
"type": "string",
1584+
"description": "Transport type. Use \"stdio\" for local command, \"sse\" for Server-Sent Events, or \"http\" for Streamable HTTP.",
1585+
"enum": ["stdio", "sse", "http"]
1586+
},
15821587
"timeout": {
15831588
"type": "number",
15841589
"description": "Timeout in milliseconds for MCP requests."

0 commit comments

Comments
 (0)