fix(cli): display 'http' type on mcp list (#16915)

Co-authored-by: Jack Wotherspoon <jackwoth@google.com>
This commit is contained in:
Panagiotis Mantafounis
2026-01-21 04:37:19 +02:00
committed by GitHub
parent 2455f939a3
commit 55c2783e6a
2 changed files with 18 additions and 2 deletions

View File

@@ -123,8 +123,13 @@ describe('mcp list command', () => {
...defaultMergedSettings,
mcpServers: {
'stdio-server': { command: '/path/to/server', args: ['arg1'] },
'sse-server': { url: 'https://example.com/sse' },
'sse-server': { url: 'https://example.com/sse', type: 'sse' },
'http-server': { httpUrl: 'https://example.com/http' },
'http-server-by-default': { url: 'https://example.com/http' },
'http-server-with-type': {
url: 'https://example.com/http',
type: 'http',
},
},
},
});
@@ -150,6 +155,16 @@ describe('mcp list command', () => {
'http-server: https://example.com/http (http) - Connected',
),
);
expect(debugLogger.log).toHaveBeenCalledWith(
expect.stringContaining(
'http-server-by-default: https://example.com/http (http) - Connected',
),
);
expect(debugLogger.log).toHaveBeenCalledWith(
expect.stringContaining(
'http-server-with-type: https://example.com/http (http) - Connected',
),
);
});
it('should display disconnected status when connection fails', async () => {

View File

@@ -144,7 +144,8 @@ export async function listMcpServers(): Promise<void> {
if (server.httpUrl) {
serverInfo += `${server.httpUrl} (http)`;
} else if (server.url) {
serverInfo += `${server.url} (sse)`;
const type = server.type || 'http';
serverInfo += `${server.url} (${type})`;
} else if (server.command) {
serverInfo += `${server.command} ${server.args?.join(' ') || ''} (stdio)`;
}