Skip to content

Commit 542c246

Browse files
reverting UI changes
1 parent 4ba3cc8 commit 542c246

File tree

5 files changed

+57
-110
lines changed

5 files changed

+57
-110
lines changed

src/core/prompts/system.ts.checks

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/core/webview/ClineProvider.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,14 @@ export class ClineProvider implements vscode.WebviewViewProvider {
648648
}
649649
break
650650
}
651+
case "toggleMcpServer": {
652+
try {
653+
await this.mcpHub?.toggleServerDisabled(message.serverName!, message.disabled!)
654+
} catch (error) {
655+
console.error(`Failed to toggle MCP server ${message.serverName}:`, error)
656+
}
657+
break
658+
}
651659
case "toggleToolAutoApprove": {
652660
try {
653661
await this.mcpHub?.toggleToolAutoApprove(message.serverName!, message.toolName!, message.autoApprove!)
@@ -668,18 +676,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
668676
await vscode.commands.executeCommand("workbench.action.openSettings", "@ext:saoudrizwan.claude-dev")
669677
break
670678
}
671-
case "getMcpEnabled": {
672-
const enabled = this.mcpHub?.isMcpEnabled() ?? true
673-
await this.postMessageToWebview({
674-
type: "mcpEnabled",
675-
enabled,
676-
})
677-
break
678-
}
679-
case "toggleMcp": {
680-
await vscode.workspace.getConfiguration("cline.mcp").update("enabled", message.enabled, true)
681-
break
682-
}
683679
// Add more switch case statements here as more webview message commands
684680
// are created within the webview context (i.e. inside media/main.js)
685681
}

src/services/mcp/McpHub.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ import * as path from "path"
1515
import * as vscode from "vscode"
1616
import { z } from "zod"
1717
import { ClineProvider, GlobalFileNames } from "../../core/webview/ClineProvider"
18-
import { McpMode, McpResource, McpResourceResponse, McpResourceTemplate, McpServer, McpTool, McpToolCallResponse } from "../../shared/mcp"
18+
import {
19+
McpMode,
20+
McpResource,
21+
McpResourceResponse,
22+
McpResourceTemplate,
23+
McpServer,
24+
McpTool,
25+
McpToolCallResponse,
26+
} from "../../shared/mcp"
1927
import { fileExistsAtPath } from "../../utils/fs"
2028
import { arePathsEqual } from "../../utils/path"
2129

src/shared/WebviewMessage.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ export interface WebviewMessage {
3434
| "checkpointRestore"
3535
| "taskCompletionViewChanges"
3636
| "openExtensionSettings"
37-
| "getMcpEnabled"
38-
| "toggleMcp"
37+
| "requestVsCodeLmModels"
38+
| "toggleToolAutoApprove"
39+
| "toggleMcpServer"
40+
| "getLatestState"
41+
| "accountLoginClicked"
42+
| "accountLogoutClicked"
3943
// | "relaunchChromeDebugMode"
4044
text?: string
4145
disabled?: boolean
@@ -46,7 +50,12 @@ export interface WebviewMessage {
4650
number?: number
4751
autoApprovalSettings?: AutoApprovalSettings
4852
browserSettings?: BrowserSettings
49-
enabled?: boolean // For toggleMcp message
53+
chatSettings?: ChatSettings
54+
55+
// For toggleToolAutoApprove
56+
serverName?: string
57+
toolName?: string
58+
autoApprove?: boolean
5059
}
5160

5261
export type ClineAskResponse = "yesButtonClicked" | "noButtonClicked" | "messageResponse"

webview-ui/src/components/mcp/McpView.tsx

Lines changed: 28 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { VSCodeButton, VSCodeLink, VSCodePanels, VSCodePanelTab, VSCodePanelView
22
import { useState } from "react"
33
import { vscode } from "../../utils/vscode"
44
import { useExtensionState } from "../../context/ExtensionStateContext"
5-
import { McpMode, McpServer } from "../../../../src/shared/mcp"
5+
import { McpServer } from "../../../../src/shared/mcp"
66
import McpToolRow from "./McpToolRow"
77
import McpResourceRow from "./McpResourceRow"
88

@@ -12,31 +12,7 @@ type McpViewProps = {
1212

1313
const McpView = ({ onDone }: McpViewProps) => {
1414
const { mcpServers: servers } = useExtensionState()
15-
const [isMcpEnabled, setIsMcpEnabled] = useState(true)
1615

17-
useEffect(() => {
18-
// Get initial MCP enabled state
19-
vscode.postMessage({ type: "getMcpEnabled" })
20-
}, [])
21-
22-
useEffect(() => {
23-
const handler = (event: MessageEvent) => {
24-
const message = event.data
25-
if (message.type === "mcpEnabled") {
26-
setIsMcpEnabled(message.enabled)
27-
}
28-
}
29-
window.addEventListener("message", handler)
30-
return () => window.removeEventListener("message", handler)
31-
}, [])
32-
33-
const toggleMcp = () => {
34-
vscode.postMessage({
35-
type: "toggleMcp",
36-
enabled: !isMcpEnabled,
37-
})
38-
setIsMcpEnabled(!isMcpEnabled)
39-
}
4016
// const [servers, setServers] = useState<McpServer[]>([
4117
// // Add some mock servers for testing
4218
// {
@@ -143,58 +119,7 @@ const McpView = ({ onDone }: McpViewProps) => {
143119
</VSCodeLink>
144120
</div>
145121

146-
{/* MCP Toggle Section */}
147-
<div
148-
style={{
149-
marginBottom: "16px",
150-
paddingBottom: "16px",
151-
borderBottom: "1px solid var(--vscode-textSeparator-foreground)",
152-
}}>
153-
<div>
154-
<VSCodeCheckbox
155-
checked={isMcpEnabled}
156-
onChange={toggleMcp}
157-
style={{
158-
display: "flex",
159-
alignItems: "center",
160-
gap: "8px",
161-
padding: "4px 0",
162-
cursor: "pointer",
163-
fontSize: "13px",
164-
}}>
165-
Enable MCP
166-
</VSCodeCheckbox>
167-
{isMcpEnabled && (
168-
<div
169-
style={{
170-
marginTop: "4px",
171-
marginLeft: "24px",
172-
color: "var(--vscode-descriptionForeground)",
173-
fontSize: "12px",
174-
}}>
175-
Disabling MCP will save on tokens passed in the context.
176-
</div>
177-
)}
178-
{!isMcpEnabled && (
179-
<div
180-
style={{
181-
padding: "8px 12px",
182-
marginTop: "8px",
183-
background: "var(--vscode-textBlockQuote-background)",
184-
border: "1px solid var(--vscode-textBlockQuote-border)",
185-
borderRadius: "4px",
186-
color: "var(--vscode-descriptionForeground)",
187-
fontSize: "12px",
188-
lineHeight: "1.4",
189-
}}>
190-
MCP is currently disabled. Enable MCP to use MCP servers and tools. Enabling MCP will use
191-
additional tokens.
192-
</div>
193-
)}
194-
</div>
195-
</div>
196-
197-
{servers.length > 0 && isMcpEnabled && (
122+
{servers.length > 0 && (
198123
<div
199124
style={{
200125
display: "flex",
@@ -208,19 +133,32 @@ const McpView = ({ onDone }: McpViewProps) => {
208133
)}
209134

210135
{/* Server Configuration Button */}
211-
{isMcpEnabled && (
212-
<div style={{ marginTop: "10px", width: "100%" }}>
213-
<VSCodeButton
214-
appearance="secondary"
215-
style={{ width: "100%" }}
216-
onClick={() => {
217-
vscode.postMessage({ type: "openMcpSettings" })
218-
}}>
219-
<span className="codicon codicon-server" style={{ marginRight: "6px" }}></span>
220-
Configure MCP Servers
221-
</VSCodeButton>
222-
</div>
223-
)}
136+
137+
<div style={{ marginTop: "10px", width: "100%" }}>
138+
<VSCodeButton
139+
appearance="secondary"
140+
style={{ width: "100%" }}
141+
onClick={() => {
142+
vscode.postMessage({ type: "openMcpSettings" })
143+
}}>
144+
<span className="codicon codicon-server" style={{ marginRight: "6px" }}></span>
145+
Configure MCP Servers
146+
</VSCodeButton>
147+
</div>
148+
149+
{/* Advanced Settings Link */}
150+
<div style={{ textAlign: "center", marginTop: "5px" }}>
151+
<VSCodeLink
152+
onClick={() => {
153+
vscode.postMessage({
154+
type: "openExtensionSettings",
155+
text: "cline.mcp",
156+
})
157+
}}
158+
style={{ fontSize: "12px" }}>
159+
Advanced MCP Settings
160+
</VSCodeLink>
161+
</div>
224162

225163
{/* Bottom padding */}
226164
<div style={{ height: "20px" }} />

0 commit comments

Comments
 (0)