feat: Add MCP server installation via URL protocol (#5351)

* Add MCP server installation via URL protocol

Implement handler for cherrystudio://mcp/install URLs to add MCP servers
from encoded configuration data. Supports multiple server configuration
formats and adds a new IPC channel for server addition.

* feat: Enhance MCP protocol handling and navigation

- Implemented navigation to the '/settings/mcp' page using executeJavaScript in the MCP protocol URL handler.
- Updated NavigationService to expose the navigate function globally for easier access in the application.
- Added NavigateFunction type to the global environment for improved type safety in navigation operations.

---------

Co-authored-by: kangfenmao <kangfenmao@qq.com>
This commit is contained in:
LiuVaayne
2025-04-26 11:09:58 +08:00
committed by GitHub
parent 0744e42be9
commit bf17e71445
6 changed files with 90 additions and 0 deletions
+7
View File
@@ -1,3 +1,4 @@
import { handleMcpProtocolUrl } from './urlschema/mcp-install'
import { windowService } from './WindowService'
export const CHERRY_STUDIO_PROTOCOL = 'cherrystudio'
@@ -22,6 +23,12 @@ export function handleProtocolUrl(url: string) {
const urlObj = new URL(url)
const params = new URLSearchParams(urlObj.search)
switch (urlObj.hostname.toLowerCase()) {
case 'mcp':
handleMcpProtocolUrl(urlObj)
return
}
// You can send the data to your renderer process
const mainWindow = windowService.getMainWindow()