fix: flag incomplete mcp server transports (#4275)
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user