diff --git a/src/shared/mcp-config.test.ts b/src/shared/mcp-config.test.ts index a9f2b5412..e16dc9f36 100644 --- a/src/shared/mcp-config.test.ts +++ b/src/shared/mcp-config.test.ts @@ -92,6 +92,33 @@ describe('mcp-config', () => { ]) }) + it('marks declared transports without their target as invalid', () => { + const result = inspectMcpConfigContent( + workspaceCandidate, + JSON.stringify({ + mcpServers: { + remoteMissingUrl: { type: 'http' }, + localMissingCommand: { type: 'local' } + } + }) + ) + + expect(result.servers).toEqual([ + { + name: 'remoteMissingUrl', + transport: 'http', + status: 'invalid', + issue: 'Missing URL.' + }, + { + name: 'localMissingCommand', + transport: 'stdio', + status: 'invalid', + issue: 'Missing command.' + } + ]) + }) + it('masks env values that look sensitive by key or value', () => { expect( maskMcpEnv({ diff --git a/src/shared/mcp-config.ts b/src/shared/mcp-config.ts index 11ef0e669..369dd101f 100644 --- a/src/shared/mcp-config.ts +++ b/src/shared/mcp-config.ts @@ -210,6 +210,26 @@ function summarizeMcpServer(name: string, entry: unknown): McpServerSummary { } } + if (transport === 'http' && !url) { + return { + name, + transport, + status: 'invalid', + env, + issue: 'Missing URL.' + } + } + + if (transport === 'stdio' && !command) { + return { + name, + transport, + status: 'invalid', + env, + issue: 'Missing command.' + } + } + return { name, transport,