mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-12 07:01:09 -07:00
fix: add missing type field to MCPServerConfig (#15465)
This commit is contained in:
@@ -219,6 +219,60 @@ describe('settings-validation', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should validate mcpServers with type field for all transport types', () => {
|
||||||
|
const validSettings = {
|
||||||
|
mcpServers: {
|
||||||
|
'sse-server': {
|
||||||
|
url: 'https://example.com/sse',
|
||||||
|
type: 'sse',
|
||||||
|
headers: { 'X-API-Key': 'key' },
|
||||||
|
},
|
||||||
|
'http-server': {
|
||||||
|
url: 'https://example.com/mcp',
|
||||||
|
type: 'http',
|
||||||
|
},
|
||||||
|
'stdio-server': {
|
||||||
|
command: '/usr/bin/mcp-server',
|
||||||
|
type: 'stdio',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = validateSettings(validSettings);
|
||||||
|
expect(result.success).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reject invalid type values in mcpServers', () => {
|
||||||
|
const invalidSettings = {
|
||||||
|
mcpServers: {
|
||||||
|
'bad-server': {
|
||||||
|
url: 'https://example.com/mcp',
|
||||||
|
type: 'invalid-type',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = validateSettings(invalidSettings);
|
||||||
|
expect(result.success).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate mcpServers without type field', () => {
|
||||||
|
const validSettings = {
|
||||||
|
mcpServers: {
|
||||||
|
'stdio-server': {
|
||||||
|
command: '/usr/bin/mcp-server',
|
||||||
|
args: ['--port', '8080'],
|
||||||
|
},
|
||||||
|
'url-server': {
|
||||||
|
url: 'https://example.com/mcp',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = validateSettings(validSettings);
|
||||||
|
expect(result.success).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should validate complex nested customThemes configuration', () => {
|
it('should validate complex nested customThemes configuration', () => {
|
||||||
const invalidSettings = {
|
const invalidSettings = {
|
||||||
ui: {
|
ui: {
|
||||||
|
|||||||
@@ -1704,7 +1704,8 @@ export const SETTINGS_SCHEMA_DEFINITIONS: Record<
|
|||||||
},
|
},
|
||||||
url: {
|
url: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'SSE transport URL.',
|
description:
|
||||||
|
'URL for SSE or HTTP transport. Use with "type" field to specify transport type.',
|
||||||
},
|
},
|
||||||
httpUrl: {
|
httpUrl: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@@ -1719,6 +1720,12 @@ export const SETTINGS_SCHEMA_DEFINITIONS: Record<
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'TCP address for websocket transport.',
|
description: 'TCP address for websocket transport.',
|
||||||
},
|
},
|
||||||
|
type: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'Transport type. Use "stdio" for local command, "sse" for Server-Sent Events, or "http" for Streamable HTTP.',
|
||||||
|
enum: ['stdio', 'sse', 'http'],
|
||||||
|
},
|
||||||
timeout: {
|
timeout: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'Timeout in milliseconds for MCP requests.',
|
description: 'Timeout in milliseconds for MCP requests.',
|
||||||
|
|||||||
@@ -1599,7 +1599,7 @@
|
|||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "SSE transport URL."
|
"description": "URL for SSE or HTTP transport. Use with \"type\" field to specify transport type."
|
||||||
},
|
},
|
||||||
"httpUrl": {
|
"httpUrl": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1616,6 +1616,11 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "TCP address for websocket transport."
|
"description": "TCP address for websocket transport."
|
||||||
},
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Transport type. Use \"stdio\" for local command, \"sse\" for Server-Sent Events, or \"http\" for Streamable HTTP.",
|
||||||
|
"enum": ["stdio", "sse", "http"]
|
||||||
|
},
|
||||||
"timeout": {
|
"timeout": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Timeout in milliseconds for MCP requests."
|
"description": "Timeout in milliseconds for MCP requests."
|
||||||
|
|||||||
Reference in New Issue
Block a user