Skip to content

Commit 6423fc3

Browse files
fix: SSE MCP Invocation (#4251)
* only apply transport.start for stdio * instructions * formatting
1 parent c673569 commit 6423fc3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/services/mcp/McpHub.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,23 @@ export class McpHub {
598598
}
599599
await this.notifyWebviewOfServerChanges()
600600
}
601+
602+
transport.onclose = async () => {
603+
const connection = this.findConnection(name, source)
604+
if (connection) {
605+
connection.server.status = "disconnected"
606+
}
607+
await this.notifyWebviewOfServerChanges()
608+
}
601609
} else {
602-
// Correctly placed "unsupported type" else block
603610
// Should not happen if validateServerConfig is correct
604611
throw new Error(`Unsupported MCP server type: ${(configInjected as any).type}`)
605612
}
606-
// transport.start assignment moved after all type-specific initializations
607-
transport.start = async () => {} // No-op now, .connect() won't fail
613+
614+
// Only override transport.start for stdio transports that have already been started
615+
if (configInjected.type === "stdio") {
616+
transport.start = async () => {}
617+
}
608618

609619
const connection: McpConnection = {
610620
server: {

0 commit comments

Comments
 (0)