Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
252 changes: 123 additions & 129 deletions webview-ui/src/components/mcp/McpView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import { buildDocLink } from "@src/utils/docLinks"
import { Section } from "@src/components/settings/Section"
import { SectionHeader } from "@src/components/settings/SectionHeader"

import { TabContent } from "../common/Tab"

import McpToolRow from "./McpToolRow"
import McpResourceRow from "./McpResourceRow"
import McpEnabledToggle from "./McpEnabledToggle"
Expand All @@ -57,145 +55,141 @@ const McpView = () => {
</SectionHeader>

<Section>
<TabContent>
<div
style={{
color: "var(--vscode-foreground)",
fontSize: "13px",
marginBottom: "10px",
marginTop: "5px",
}}>
<Trans i18nKey="mcp:description">
<VSCodeLink
href={buildDocLink("features/mcp/using-mcp-in-roo", "mcp_settings")}
style={{ display: "inline" }}>
Learn More
</VSCodeLink>
</Trans>
</div>
<div
style={{
color: "var(--vscode-foreground)",
fontSize: "13px",
marginBottom: "10px",
marginTop: "5px",
}}>
<Trans i18nKey="mcp:description">
<VSCodeLink
href={buildDocLink("features/mcp/using-mcp-in-roo", "mcp_settings")}
style={{ display: "inline" }}>
Learn More
</VSCodeLink>
</Trans>
</div>

<McpEnabledToggle />
<McpEnabledToggle />

{mcpEnabled && (
<>
<div style={{ marginBottom: 15 }}>
<VSCodeCheckbox
checked={enableMcpServerCreation}
onChange={(e: any) => {
setEnableMcpServerCreation(e.target.checked)
vscode.postMessage({ type: "enableMcpServerCreation", bool: e.target.checked })
}}>
<span style={{ fontWeight: "500" }}>{t("mcp:enableServerCreation.title")}</span>
</VSCodeCheckbox>
<div
style={{
fontSize: "12px",
marginTop: "5px",
color: "var(--vscode-descriptionForeground)",
}}>
<Trans i18nKey="mcp:enableServerCreation.description">
<VSCodeLink
href={buildDocLink(
"features/mcp/using-mcp-in-roo#how-to-use-roo-to-create-an-mcp-server",
"mcp_server_creation",
)}
style={{ display: "inline" }}>
Learn about server creation
</VSCodeLink>
<strong>new</strong>
</Trans>
<p style={{ marginTop: "8px" }}>{t("mcp:enableServerCreation.hint")}</p>
</div>
{mcpEnabled && (
<>
<div style={{ marginBottom: 15 }}>
<VSCodeCheckbox
checked={enableMcpServerCreation}
onChange={(e: any) => {
setEnableMcpServerCreation(e.target.checked)
vscode.postMessage({ type: "enableMcpServerCreation", bool: e.target.checked })
}}>
<span style={{ fontWeight: "500" }}>{t("mcp:enableServerCreation.title")}</span>
</VSCodeCheckbox>
<div
style={{
fontSize: "12px",
marginTop: "5px",
color: "var(--vscode-descriptionForeground)",
}}>
<Trans i18nKey="mcp:enableServerCreation.description">
<VSCodeLink
href={buildDocLink(
"features/mcp/using-mcp-in-roo#how-to-use-roo-to-create-an-mcp-server",
"mcp_server_creation",
)}
style={{ display: "inline" }}>
Learn about server creation
</VSCodeLink>
<strong>new</strong>
</Trans>
<p style={{ marginTop: "8px" }}>{t("mcp:enableServerCreation.hint")}</p>
</div>
</div>

{/* Server List */}
{servers.length > 0 && (
<div style={{ display: "flex", flexDirection: "column", gap: "10px" }}>
{servers.map((server) => (
<ServerRow
key={`${server.name}-${server.source || "global"}`}
server={server}
alwaysAllowMcp={alwaysAllowMcp}
/>
))}
</div>
)}
{/* Server List */}
{servers.length > 0 && (
<div style={{ display: "flex", flexDirection: "column", gap: "10px" }}>
{servers.map((server) => (
<ServerRow
key={`${server.name}-${server.source || "global"}`}
server={server}
alwaysAllowMcp={alwaysAllowMcp}
/>
))}
</div>
)}

{/* Edit Settings Buttons */}
<div
style={{
marginTop: "10px",
width: "100%",
display: "grid",
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))",
gap: "10px",
{/* Edit Settings Buttons */}
<div
style={{
marginTop: "10px",
width: "100%",
display: "grid",
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))",
gap: "10px",
}}>
<Button
variant="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "openMcpSettings" })
}}>
<span className="codicon codicon-edit" style={{ marginRight: "6px" }}></span>
{t("mcp:editGlobalMCP")}
</Button>
<Button
variant="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "openProjectMcpSettings" })
}}>
<span className="codicon codicon-edit" style={{ marginRight: "6px" }}></span>
{t("mcp:editProjectMCP")}
</Button>
<Button
variant="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "refreshAllMcpServers" })
}}>
<span className="codicon codicon-refresh" style={{ marginRight: "6px" }}></span>
{t("mcp:refreshMCP")}
</Button>
<StandardTooltip content={t("mcp:marketplace")}>
<Button
variant="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "openMcpSettings" })
}}>
<span className="codicon codicon-edit" style={{ marginRight: "6px" }}></span>
{t("mcp:editGlobalMCP")}
</Button>
<Button
variant="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "openProjectMcpSettings" })
}}>
<span className="codicon codicon-edit" style={{ marginRight: "6px" }}></span>
{t("mcp:editProjectMCP")}
</Button>
<Button
variant="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "refreshAllMcpServers" })
window.postMessage(
{
type: "action",
action: "marketplaceButtonClicked",
values: { marketplaceTab: "mcp" },
},
"*",
)
}}>
<span className="codicon codicon-refresh" style={{ marginRight: "6px" }}></span>
{t("mcp:refreshMCP")}
<span className="codicon codicon-extensions" style={{ marginRight: "6px" }}></span>
{t("mcp:marketplace")}
</Button>
<StandardTooltip content={t("mcp:marketplace")}>
<Button
variant="secondary"
style={{ width: "100%" }}
onClick={() => {
window.postMessage(
{
type: "action",
action: "marketplaceButtonClicked",
values: { marketplaceTab: "mcp" },
},
"*",
)
}}>
<span
className="codicon codicon-extensions"
style={{ marginRight: "6px" }}></span>
{t("mcp:marketplace")}
</Button>
</StandardTooltip>
</div>
<div
style={{
marginTop: "15px",
fontSize: "12px",
color: "var(--vscode-descriptionForeground)",
}}>
<VSCodeLink
href={buildDocLink(
"features/mcp/using-mcp-in-roo#editing-mcp-settings-files",
"mcp_edit_settings",
)}
style={{ display: "inline" }}>
{t("mcp:learnMoreEditingSettings")}
</VSCodeLink>
</div>
</>
)}
</TabContent>
</StandardTooltip>
</div>
<div
style={{
marginTop: "15px",
fontSize: "12px",
color: "var(--vscode-descriptionForeground)",
}}>
<VSCodeLink
href={buildDocLink(
"features/mcp/using-mcp-in-roo#editing-mcp-settings-files",
"mcp_edit_settings",
)}
style={{ display: "inline" }}>
{t("mcp:learnMoreEditingSettings")}
</VSCodeLink>
</div>
</>
)}
</Section>
</div>
)
Expand Down
Loading
Loading