UNPKG

@redocly/theme

Version:

Shared UI components lib

35 lines (31 loc) 1.03 kB
import type { MCPClientType, McpConnectionParams } from '../types'; function generateCursorMCPDeepLink(config: McpConnectionParams): string { const cursorConfig = { url: config.url, description: 'MCP Server', }; const encodedConfig = btoa(JSON.stringify(cursorConfig)); return `cursor://anysphere.cursor-deeplink/mcp/install?name=${config.serverName}&config=${encodedConfig}`; } function generateVSCodeMCPDeepLink(config: McpConnectionParams): string { const vscodeConfig = { name: config.serverName, url: config.url, type: 'http', }; const encodedConfig = encodeURIComponent(JSON.stringify(vscodeConfig)); return `vscode:mcp/install?${encodedConfig}`; } export function generateMCPDeepLink( clientType: MCPClientType, config: McpConnectionParams, ): string { switch (clientType) { case 'cursor': return generateCursorMCPDeepLink(config); case 'vscode': return generateVSCodeMCPDeepLink(config); default: return generateCursorMCPDeepLink(config); } }