fix rebase issue of duplicate close

This commit is contained in:
Kent Wang
2025-09-16 16:52:07 +08:00
parent d32ef8ad6b
commit 10ccf8d5d9

View File

@@ -621,10 +621,8 @@ const closeMcpConnection = async (options: CommonMcpOptions) => {
const { requestId } = options;
const mcpClient = _getMcpClient(requestId);
if (mcpClient) {
await mcpClient.close();
try {
// Only terminate session if transport is StreamableHTTPClientTransport
if ('terminateSession' in mcpClient.transport) {
await mcpClient.transport.terminateSession();
}