Skip to content

Commit 45e1f58

Browse files
Feat: MCP Marketplace Setting (RooCodeInc#1877)
* feat-mc-marketplace-setting * add changeset * Fixes --------- Co-authored-by: Saoud Rizwan <[email protected]>
1 parent cd3f3e2 commit 45e1f58

File tree

6 files changed

+49
-80
lines changed

6 files changed

+49
-80
lines changed

.changeset/dry-ghosts-nail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
A new MCP Marketplace display setting has been added to VSCode settings. (It is defaulted to "true")

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@
181181
"type": "string",
182182
"default": null,
183183
"description": "Path to Chrome executable for browser use functionality. If not set, the extension will attempt to find or download it automatically."
184+
},
185+
"cline.mcpMarketplace.enabled": {
186+
"type": "boolean",
187+
"default": true,
188+
"description": "Controls whether the MCP Marketplace is enabled."
184189
}
185190
}
186191
}

src/core/webview/ClineProvider.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
240240
this.disposables,
241241
)
242242

243-
// Listen for when color changes
243+
// Listen for configuration changes
244244
vscode.workspace.onDidChangeConfiguration(
245245
async (e) => {
246246
if (e && e.affectsConfiguration("workbench.colorTheme")) {
@@ -250,6 +250,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
250250
text: JSON.stringify(await getTheme()),
251251
})
252252
}
253+
if (e && e.affectsConfiguration("cline.mcpMarketplace.enabled")) {
254+
// Update state when marketplace tab setting changes
255+
await this.postStateToWebview()
256+
}
253257
},
254258
null,
255259
this.disposables,
@@ -1581,6 +1585,7 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
15811585
chatSettings,
15821586
userInfo,
15831587
authToken,
1588+
mcpMarketplaceEnabled,
15841589
} = await this.getState()
15851590

15861591
return {
@@ -1599,6 +1604,7 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
15991604
chatSettings,
16001605
isLoggedIn: !!authToken,
16011606
userInfo,
1607+
mcpMarketplaceEnabled,
16021608
}
16031609
}
16041610

@@ -1776,6 +1782,8 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
17761782
.getConfiguration("cline.modelSettings.o3Mini")
17771783
.get("reasoningEffort", "medium")
17781784

1785+
const mcpMarketplaceEnabled = vscode.workspace.getConfiguration("cline").get<boolean>("mcpMarketplace.enabled", true)
1786+
17791787
return {
17801788
apiConfiguration: {
17811789
apiProvider,
@@ -1830,6 +1838,7 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
18301838
previousModeApiProvider,
18311839
previousModeModelId,
18321840
previousModeModelInfo,
1841+
mcpMarketplaceEnabled,
18331842
}
18341843
}
18351844

src/shared/ExtensionMessage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export interface ExtensionState {
8080
email: string | null
8181
photoURL: string | null
8282
}
83+
mcpMarketplaceEnabled?: boolean
8384
}
8485

8586
export interface ClineMessage {

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

Lines changed: 26 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,40 @@
11
import { VSCodeButton, VSCodeLink, VSCodePanels, VSCodePanelTab, VSCodePanelView } from "@vscode/webview-ui-toolkit/react"
2-
import { useState, useEffect } from "react"
3-
import { vscode } from "../../utils/vscode"
4-
import { useExtensionState } from "../../context/ExtensionStateContext"
5-
import { McpServer } from "../../../../src/shared/mcp"
6-
import McpToolRow from "./McpToolRow"
7-
import McpResourceRow from "./McpResourceRow"
8-
import McpMarketplaceView from "./marketplace/McpMarketplaceView"
2+
import { useEffect, useState } from "react"
93
import styled from "styled-components"
4+
import { McpServer } from "../../../../src/shared/mcp"
5+
import { useExtensionState } from "../../context/ExtensionStateContext"
106
import { getMcpServerDisplayName } from "../../utils/mcp"
7+
import { vscode } from "../../utils/vscode"
118
import DangerButton from "../common/DangerButton"
9+
import McpMarketplaceView from "./marketplace/McpMarketplaceView"
10+
import McpResourceRow from "./McpResourceRow"
11+
import McpToolRow from "./McpToolRow"
1212

1313
type McpViewProps = {
1414
onDone: () => void
1515
}
1616

1717
const McpView = ({ onDone }: McpViewProps) => {
18-
const { mcpServers: servers } = useExtensionState()
19-
const [activeTab, setActiveTab] = useState("marketplace")
18+
const { mcpServers: servers, mcpMarketplaceEnabled } = useExtensionState()
19+
const [activeTab, setActiveTab] = useState(mcpMarketplaceEnabled ? "marketplace" : "installed")
2020

2121
const handleTabChange = (tab: string) => {
2222
setActiveTab(tab)
2323
}
2424

2525
useEffect(() => {
26-
vscode.postMessage({ type: "silentlyRefreshMcpMarketplace" })
27-
vscode.postMessage({ type: "fetchLatestMcpServersFromHub" })
28-
}, [])
26+
if (!mcpMarketplaceEnabled && activeTab === "marketplace") {
27+
// If marketplace is disabled and we're on marketplace tab, switch to installed
28+
setActiveTab("installed")
29+
}
30+
}, [mcpMarketplaceEnabled, activeTab])
2931

30-
// const [servers, setServers] = useState<McpServer[]>([
31-
// // Add some mock servers for testing
32-
// {
33-
// name: "local-tools",
34-
// config: JSON.stringify({
35-
// mcpServers: {
36-
// "local-tools": {
37-
// command: "npx",
38-
// args: ["-y", "@modelcontextprotocol/server-tools"],
39-
// },
40-
// },
41-
// }),
42-
// status: "connected",
43-
// tools: [
44-
// {
45-
// name: "execute_command",
46-
// description: "Run a shell command on the local system",
47-
// },
48-
// {
49-
// name: "read_file",
50-
// description: "Read contents of a file from the filesystem",
51-
// },
52-
// ],
53-
// },
54-
// {
55-
// name: "postgres-db",
56-
// config: JSON.stringify({
57-
// mcpServers: {
58-
// "postgres-db": {
59-
// command: "npx",
60-
// args: ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"],
61-
// },
62-
// },
63-
// }),
64-
// status: "disconnected",
65-
// error: "Failed to connect to database: Connection refused",
66-
// },
67-
// {
68-
// name: "github-tools",
69-
// config: JSON.stringify({
70-
// mcpServers: {
71-
// "github-tools": {
72-
// command: "npx",
73-
// args: ["-y", "@modelcontextprotocol/server-github"],
74-
// },
75-
// },
76-
// }),
77-
// status: "connecting",
78-
// resources: [
79-
// {
80-
// uri: "github://repo/issues",
81-
// name: "Repository Issues",
82-
// },
83-
// {
84-
// uri: "github://repo/pulls",
85-
// name: "Pull Requests",
86-
// },
87-
// ],
88-
// },
89-
// ])
32+
useEffect(() => {
33+
if (mcpMarketplaceEnabled) {
34+
vscode.postMessage({ type: "silentlyRefreshMcpMarketplace" })
35+
vscode.postMessage({ type: "fetchLatestMcpServersFromHub" })
36+
}
37+
}, [mcpMarketplaceEnabled])
9038

9139
return (
9240
<div
@@ -119,17 +67,19 @@ const McpView = ({ onDone }: McpViewProps) => {
11967
padding: "0 20px 0 20px",
12068
borderBottom: "1px solid var(--vscode-panel-border)",
12169
}}>
122-
<TabButton isActive={activeTab === "marketplace"} onClick={() => handleTabChange("marketplace")}>
123-
Marketplace
124-
</TabButton>
70+
{mcpMarketplaceEnabled && (
71+
<TabButton isActive={activeTab === "marketplace"} onClick={() => handleTabChange("marketplace")}>
72+
Marketplace
73+
</TabButton>
74+
)}
12575
<TabButton isActive={activeTab === "installed"} onClick={() => handleTabChange("installed")}>
12676
Installed
12777
</TabButton>
12878
</div>
12979

13080
{/* Content container */}
13181
<div style={{ width: "100%" }}>
132-
{activeTab === "marketplace" && <McpMarketplaceView />}
82+
{mcpMarketplaceEnabled && activeTab === "marketplace" && <McpMarketplaceView />}
13383
{activeTab === "installed" && (
13484
<div style={{ padding: "16px 20px" }}>
13585
<div
@@ -472,7 +422,6 @@ const ServerRow = ({ server }: { server: McpServer }) => {
472422
</VSCodeButton>
473423

474424
<DangerButton
475-
// appearance="secondary"
476425
onClick={handleDelete}
477426
disabled={isDeleting}
478427
style={{

0 commit comments

Comments
 (0)