Compare commits

...
Author SHA1 Message Date
Elephant Lumps cca22b0a1b changeset 2025-05-23 10:30:57 -07:00
Elephant Lumps a2883cfbd4 migrate openMcpSettings 2025-05-23 10:30:34 -07:00
8 changed files with 34 additions and 15 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": minor
---
Migrate openMcpSettings to protobus
+1
View File
@@ -15,6 +15,7 @@ service McpService {
rpc deleteMcpServer(StringRequest) returns (McpServers);
rpc toggleToolAutoApprove(ToggleToolAutoApproveRequest) returns (McpServers);
rpc refreshMcpMarketplace(EmptyRequest) returns (McpMarketplaceCatalog);
rpc openMcpSettings(EmptyRequest) returns (Empty);
}
message ToggleMcpServerRequest {
-7
View File
@@ -316,13 +316,6 @@ export class Controller {
await this.fetchUserCreditsData()
break
}
case "openMcpSettings": {
const mcpSettingsFilePath = await this.mcpHub?.getMcpSettingsFilePath()
if (mcpSettingsFilePath) {
await handleFileServiceRequest(this, "openFile", { value: mcpSettingsFilePath })
}
break
}
case "fetchMcpMarketplace": {
await this.fetchMcpMarketplace(message.bool)
break
@@ -0,0 +1,17 @@
import { Controller } from ".."
import { Empty, EmptyRequest } from "@shared/proto/common"
import { openFile as openFileIntegration } from "@integrations/misc/open-file"
/**
* Opens the MCP settings file in the editor
* @param controller The controller instance
* @param _request Empty request
* @returns Empty response
*/
export async function openMcpSettings(controller: Controller, _request: EmptyRequest): Promise<Empty> {
const mcpSettingsFilePath = await controller.mcpHub?.getMcpSettingsFilePath()
if (mcpSettingsFilePath) {
await openFileIntegration(mcpSettingsFilePath)
}
return Empty.create()
}
-1
View File
@@ -15,7 +15,6 @@ export interface WebviewMessage {
| "reportBug"
| "openInBrowser"
| "showChatView"
| "openMcpSettings"
| "openExtensionSettings"
| "requestVsCodeLmModels"
| "showAccountViewClicked"
@@ -1,7 +1,7 @@
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import { vscode } from "@/utils/vscode"
import styled from "styled-components"
import { LINKS } from "@/constants"
import { McpServiceClient } from "@/services/grpc-client"
type AddLocalServerFormProps = {
onServerAdded: () => void
@@ -22,7 +22,9 @@ const AddLocalServerForm = ({ onServerAdded }: AddLocalServerFormProps) => {
appearance="primary"
style={{ width: "100%", marginBottom: "5px", marginTop: 8 }}
onClick={() => {
vscode.postMessage({ type: "openMcpSettings" })
McpServiceClient.openMcpSettings({}).catch((error) => {
console.error("Error opening MCP settings:", error)
})
}}>
Open cline_mcp_settings.json
</VSCodeButton>
@@ -1,5 +1,4 @@
import { useRef, useState } from "react"
import { vscode } from "@/utils/vscode"
import { VSCodeButton, VSCodeLink, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
import { LINKS } from "@/constants"
import { McpServiceClient } from "@/services/grpc-client"
@@ -116,7 +115,9 @@ const AddRemoteServerForm = ({ onServerAdded }: { onServerAdded: () => void }) =
appearance="secondary"
style={{ width: "100%", marginBottom: "5px", marginTop: 15 }}
onClick={() => {
vscode.postMessage({ type: "openMcpSettings" })
McpServiceClient.openMcpSettings({}).catch((error) => {
console.error("Error opening MCP settings:", error)
})
}}>
Edit Configuration
</VSCodeButton>
@@ -1,8 +1,7 @@
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import { vscode } from "@/utils/vscode"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { UiServiceClient } from "@/services/grpc-client"
import { UiServiceClient, McpServiceClient } from "@/services/grpc-client"
import ServersToggleList from "./ServersToggleList"
const InstalledServersView = () => {
@@ -40,7 +39,9 @@ const InstalledServersView = () => {
appearance="secondary"
style={{ width: "100%", marginBottom: "5px" }}
onClick={() => {
vscode.postMessage({ type: "openMcpSettings" })
McpServiceClient.openMcpSettings({}).catch((error) => {
console.error("Error opening MCP settings:", error)
})
}}>
<span className="codicon codicon-server" style={{ marginRight: "6px" }}></span>
Configure MCP Servers