mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Add warning for community made servers; open GitHub on click
This commit is contained in:
parent
ee50e9710a
commit
c126804bb0
5 changed files with 81 additions and 75 deletions
|
|
@ -801,41 +801,41 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
await this.silentlyRefreshMcpMarketplace()
|
||||
break
|
||||
}
|
||||
case "openMcpMarketplaceServerDetails": {
|
||||
if (message.mcpId) {
|
||||
const response = await fetch(`https://api.cline.bot/v1/mcp/marketplace/item?mcpId=${message.mcpId}`)
|
||||
const details: McpDownloadResponse = await response.json()
|
||||
// case "openMcpMarketplaceServerDetails": {
|
||||
// if (message.text) {
|
||||
// const response = await fetch(`https://api.cline.bot/v1/mcp/marketplace/item?mcpId=${message.mcpId}`)
|
||||
// const details: McpDownloadResponse = await response.json()
|
||||
|
||||
if (details.readmeContent) {
|
||||
// Disable markdown preview markers
|
||||
const config = vscode.workspace.getConfiguration("markdown")
|
||||
await config.update("preview.markEditorSelection", false, true)
|
||||
// if (details.readmeContent) {
|
||||
// // Disable markdown preview markers
|
||||
// const config = vscode.workspace.getConfiguration("markdown")
|
||||
// await config.update("preview.markEditorSelection", false, true)
|
||||
|
||||
// Create URI with base64 encoded markdown content
|
||||
const uri = vscode.Uri.parse(
|
||||
`${DIFF_VIEW_URI_SCHEME}:${details.name} README?${Buffer.from(details.readmeContent).toString("base64")}`,
|
||||
)
|
||||
// // Create URI with base64 encoded markdown content
|
||||
// const uri = vscode.Uri.parse(
|
||||
// `${DIFF_VIEW_URI_SCHEME}:${details.name} README?${Buffer.from(details.readmeContent).toString("base64")}`,
|
||||
// )
|
||||
|
||||
// close existing
|
||||
const tabs = vscode.window.tabGroups.all
|
||||
.flatMap((tg) => tg.tabs)
|
||||
.filter((tab) => tab.label && tab.label.includes("README") && tab.label.includes("Preview"))
|
||||
for (const tab of tabs) {
|
||||
await vscode.window.tabGroups.close(tab)
|
||||
}
|
||||
// // close existing
|
||||
// const tabs = vscode.window.tabGroups.all
|
||||
// .flatMap((tg) => tg.tabs)
|
||||
// .filter((tab) => tab.label && tab.label.includes("README") && tab.label.includes("Preview"))
|
||||
// for (const tab of tabs) {
|
||||
// await vscode.window.tabGroups.close(tab)
|
||||
// }
|
||||
|
||||
// Show only the preview
|
||||
await vscode.commands.executeCommand("markdown.showPreview", uri, {
|
||||
sideBySide: true,
|
||||
preserveFocus: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
// // Show only the preview
|
||||
// await vscode.commands.executeCommand("markdown.showPreview", uri, {
|
||||
// sideBySide: true,
|
||||
// preserveFocus: true,
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
this.postMessageToWebview({ type: "relinquishControl" })
|
||||
// this.postMessageToWebview({ type: "relinquishControl" })
|
||||
|
||||
break
|
||||
}
|
||||
// break
|
||||
// }
|
||||
case "toggleMcpServer": {
|
||||
try {
|
||||
await this.mcpHub?.toggleServerDisabled(message.serverName!, message.disabled!)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ export interface WebviewMessage {
|
|||
| "subscribeEmail"
|
||||
| "fetchMcpMarketplace"
|
||||
| "downloadMcp"
|
||||
| "openMcpMarketplaceServerDetails"
|
||||
| "silentlyRefreshMcpMarketplace"
|
||||
| "searchCommits"
|
||||
// | "relaunchChromeDebugMode"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useCallback, useState, useRef } from "react"
|
||||
import { useCallback, useState, useRef, useMemo } from "react"
|
||||
import styled from "styled-components"
|
||||
import { McpMarketplaceItem, McpServer } from "../../../../../src/shared/mcp"
|
||||
import { vscode } from "../../../utils/vscode"
|
||||
|
|
@ -29,6 +29,15 @@ const McpMarketplaceCard = ({ item, installedServers }: McpMarketplaceCardProps)
|
|||
|
||||
useEvent("message", handleMessage)
|
||||
|
||||
const githubAuthorUrl = useMemo(() => {
|
||||
const url = new URL(item.githubUrl)
|
||||
const pathParts = url.pathname.split("/")
|
||||
if (pathParts.length >= 2) {
|
||||
return `${url.origin}/${pathParts[1]}`
|
||||
}
|
||||
return item.githubUrl
|
||||
}, [item.githubUrl])
|
||||
|
||||
return (
|
||||
<>
|
||||
<style>
|
||||
|
|
@ -41,26 +50,17 @@ const McpMarketplaceCard = ({ item, installedServers }: McpMarketplaceCardProps)
|
|||
}
|
||||
`}
|
||||
</style>
|
||||
<div
|
||||
<a
|
||||
href={item.githubUrl}
|
||||
className="mcp-card"
|
||||
onClick={(e) => {
|
||||
if (githubLinkRef.current?.contains(e.target as Node)) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log("Card clicked:", item.mcpId)
|
||||
setIsLoading(true)
|
||||
vscode.postMessage({
|
||||
type: "openMcpMarketplaceServerDetails",
|
||||
mcpId: item.mcpId,
|
||||
})
|
||||
}}
|
||||
style={{
|
||||
padding: "14px 16px",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 12,
|
||||
cursor: isLoading ? "wait" : "pointer",
|
||||
textDecoration: "none",
|
||||
color: "inherit",
|
||||
}}>
|
||||
{/* Main container with logo and content */}
|
||||
<div style={{ display: "flex", gap: "12px" }}>
|
||||
|
|
@ -104,7 +104,8 @@ const McpMarketplaceCard = ({ item, installedServers }: McpMarketplaceCardProps)
|
|||
</h3>
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation() // Prevent card click when clicking install
|
||||
e.preventDefault() // Prevent card click when clicking install
|
||||
e.stopPropagation() // Stop event from bubbling up to parent link
|
||||
if (!isInstalled && !isDownloading) {
|
||||
setIsDownloading(true)
|
||||
vscode.postMessage({
|
||||
|
|
@ -125,31 +126,31 @@ const McpMarketplaceCard = ({ item, installedServers }: McpMarketplaceCardProps)
|
|||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "12px",
|
||||
gap: "8px",
|
||||
fontSize: "12px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
flexWrap: "wrap",
|
||||
minWidth: 0,
|
||||
rowGap: 0, // Add this to remove vertical gap
|
||||
rowGap: 0,
|
||||
}}>
|
||||
<a
|
||||
href={item.githubUrl}
|
||||
href={githubAuthorUrl}
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
color: "var(--vscode-foreground)",
|
||||
minWidth: 0,
|
||||
opacity: 0.5,
|
||||
opacity: 0.7,
|
||||
textDecoration: "none",
|
||||
border: "none !important",
|
||||
}}
|
||||
className="github-link"
|
||||
onMouseEnter={(e) => {
|
||||
e.currentTarget.style.opacity = "0.8"
|
||||
e.currentTarget.style.opacity = "1"
|
||||
e.currentTarget.style.color = "var(--link-active-foreground)"
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
e.currentTarget.style.opacity = "0.5"
|
||||
e.currentTarget.style.opacity = "0.7"
|
||||
e.currentTarget.style.color = "var(--vscode-foreground)"
|
||||
}}>
|
||||
<div style={{ display: "flex", gap: "4px", alignItems: "center" }} ref={githubLinkRef}>
|
||||
|
|
@ -190,15 +191,28 @@ const McpMarketplaceCard = ({ item, installedServers }: McpMarketplaceCardProps)
|
|||
{item.requiresApiKey && (
|
||||
<span className="codicon codicon-key" title="Requires API key" style={{ flexShrink: 0 }} />
|
||||
)}
|
||||
{item.isRecommended && (
|
||||
<span className="codicon codicon-verified" title="Recommended" style={{ flexShrink: 0 }} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Description and tags */}
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
|
||||
{!item.isRecommended && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "4px",
|
||||
fontSize: "12px",
|
||||
color: "var(--vscode-notificationsWarningIcon-foreground)",
|
||||
marginTop: -3,
|
||||
marginBottom: -3,
|
||||
}}>
|
||||
<span className="codicon codicon-warning" style={{ fontSize: "14px" }} />
|
||||
<span>Community Made (use at your own risk)</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p style={{ fontSize: "13px", margin: 0 }}>{item.description}</p>
|
||||
<div
|
||||
style={{
|
||||
|
|
@ -248,7 +262,7 @@ const McpMarketplaceCard = ({ item, installedServers }: McpMarketplaceCardProps)
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,6 @@ const McpMarketplaceView = () => {
|
|||
height: "100%",
|
||||
padding: "20px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
borderBottom: "1px solid var(--vscode-list-inactiveSelectionBackground)",
|
||||
}}>
|
||||
{searchQuery || selectedCategory
|
||||
? "No matching MCP servers found"
|
||||
|
|
|
|||
|
|
@ -5,20 +5,14 @@ const McpSubmitCard = () => {
|
|||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: "24px",
|
||||
padding: "32px 20px",
|
||||
marginTop: "16px",
|
||||
gap: "12px",
|
||||
padding: "15px",
|
||||
margin: "20px",
|
||||
backgroundColor: "var(--vscode-textBlockQuote-background)",
|
||||
borderRadius: "6px",
|
||||
}}>
|
||||
{/* Logo */}
|
||||
<img
|
||||
src="https://storage.googleapis.com/cline_public_images/cline.png"
|
||||
alt="Cline bot logo"
|
||||
style={{
|
||||
width: 64,
|
||||
height: 64,
|
||||
borderRadius: 8,
|
||||
}}
|
||||
/>
|
||||
{/* Icon */}
|
||||
<i className="codicon codicon-add" style={{ fontSize: "18px" }} />
|
||||
|
||||
{/* Content */}
|
||||
<div
|
||||
|
|
@ -26,22 +20,22 @@ const McpSubmitCard = () => {
|
|||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: "12px",
|
||||
gap: "4px",
|
||||
textAlign: "center",
|
||||
maxWidth: "480px",
|
||||
}}>
|
||||
<h3
|
||||
style={{
|
||||
margin: 0,
|
||||
fontSize: "16px",
|
||||
fontSize: "14px",
|
||||
fontWeight: 600,
|
||||
color: "var(--vscode-foreground)",
|
||||
}}>
|
||||
Is something missing?
|
||||
Submit MCP Server
|
||||
</h3>
|
||||
<p style={{ fontSize: "13px", margin: 0, color: "var(--vscode-descriptionForeground)" }}>
|
||||
Submit your own MCP servers to the marketplace by{" "}
|
||||
<a href="https://github.com/cline/mcp-marketplace">submitting an issue</a> on the official MCP Marketplace
|
||||
repo on GitHub.
|
||||
Help others discover great MCP servers by submitting an issue to{" "}
|
||||
<a href="https://github.com/cline/mcp-marketplace">github.com/cline/mcp-marketplace</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue