@@ -2,7 +2,7 @@ import { VSCodeButton, VSCodeLink, VSCodePanels, VSCodePanelTab, VSCodePanelView
22import { useState } from "react"
33import { vscode } from "../../utils/vscode"
44import { useExtensionState } from "../../context/ExtensionStateContext"
5- import { McpMode , McpServer } from "../../../../src/shared/mcp"
5+ import { McpServer } from "../../../../src/shared/mcp"
66import McpToolRow from "./McpToolRow"
77import McpResourceRow from "./McpResourceRow"
88
@@ -12,31 +12,7 @@ type McpViewProps = {
1212
1313const 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