This commit is contained in:
Matt Rubens
2025-01-02 21:36:05 -08:00
parent 8cb44aa695
commit d32c5f805e
2 changed files with 6 additions and 5 deletions

View File

@@ -780,7 +780,10 @@ export class Cline {
async *attemptApiRequest(previousApiReqIndex: number): ApiStream { async *attemptApiRequest(previousApiReqIndex: number): ApiStream {
let mcpHub: McpHub | undefined let mcpHub: McpHub | undefined
if (this.providerRef.deref()?.mcpEnabled ?? true) {
const { mcpEnabled } = await this.providerRef.deref()?.getState() ?? {}
if (mcpEnabled ?? true) {
mcpHub = this.providerRef.deref()?.mcpHub mcpHub = this.providerRef.deref()?.mcpHub
if (!mcpHub) { if (!mcpHub) {
throw new Error("MCP hub not available") throw new Error("MCP hub not available")

View File

@@ -96,7 +96,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
private workspaceTracker?: WorkspaceTracker private workspaceTracker?: WorkspaceTracker
mcpHub?: McpHub mcpHub?: McpHub
private latestAnnouncementId = "dec-10-2024" // update to some unique identifier when we add a new announcement private latestAnnouncementId = "dec-10-2024" // update to some unique identifier when we add a new announcement
mcpEnabled: boolean = true
constructor( constructor(
readonly context: vscode.ExtensionContext, readonly context: vscode.ExtensionContext,
@@ -131,7 +130,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
this.workspaceTracker = undefined this.workspaceTracker = undefined
this.mcpHub?.dispose() this.mcpHub?.dispose()
this.mcpHub = undefined this.mcpHub = undefined
this.mcpEnabled = true
this.outputChannel.appendLine("Disposed all disposables") this.outputChannel.appendLine("Disposed all disposables")
ClineProvider.activeInstances.delete(this) ClineProvider.activeInstances.delete(this)
} }
@@ -609,8 +607,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
break break
} }
case "mcpEnabled": case "mcpEnabled":
this.mcpEnabled = message.bool ?? true const mcpEnabled = message.bool ?? true
await this.updateGlobalState("mcpEnabled", this.mcpEnabled) await this.updateGlobalState("mcpEnabled", mcpEnabled)
await this.postStateToWebview() await this.postStateToWebview()
break break
case "playSound": case "playSound":