mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
[ide-mode] Create an IDE manager class to handle connecting to and exposing methods from the IDE server (#4797)
This commit is contained in:
@@ -24,11 +24,6 @@ import { ToolRegistry } from './tool-registry.js';
|
||||
import { MCPOAuthProvider } from '../mcp/oauth-provider.js';
|
||||
import { OAuthUtils } from '../mcp/oauth-utils.js';
|
||||
import { MCPOAuthTokenStorage } from '../mcp/oauth-token-storage.js';
|
||||
import {
|
||||
OpenFilesNotificationSchema,
|
||||
IDE_SERVER_NAME,
|
||||
ideContext,
|
||||
} from '../services/ideContext.js';
|
||||
import { getErrorMessage } from '../utils/errors.js';
|
||||
|
||||
export const MCP_DEFAULT_TIMEOUT_MSEC = 10 * 60 * 1000; // default to 10 minutes
|
||||
@@ -379,24 +374,11 @@ export async function connectAndDiscover(
|
||||
);
|
||||
try {
|
||||
updateMCPServerStatus(mcpServerName, MCPServerStatus.CONNECTED);
|
||||
|
||||
mcpClient.onerror = (error) => {
|
||||
console.error(`MCP ERROR (${mcpServerName}):`, error.toString());
|
||||
updateMCPServerStatus(mcpServerName, MCPServerStatus.DISCONNECTED);
|
||||
if (mcpServerName === IDE_SERVER_NAME) {
|
||||
ideContext.clearOpenFilesContext();
|
||||
}
|
||||
};
|
||||
|
||||
if (mcpServerName === IDE_SERVER_NAME) {
|
||||
mcpClient.setNotificationHandler(
|
||||
OpenFilesNotificationSchema,
|
||||
(notification) => {
|
||||
ideContext.setOpenFilesContext(notification.params);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const tools = await discoverTools(
|
||||
mcpServerName,
|
||||
mcpServerConfig,
|
||||
|
||||
Reference in New Issue
Block a user