From 3c4045ba8948c648c4db22cce9952fe9e9e7b427 Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:25:34 +0000 Subject: [PATCH] feat: add one click install to cursor on connect to ai modal (#436) --- apps/web/components/connect-ai-modal.tsx | 215 +++++++++++++++++++---- 1 file changed, 176 insertions(+), 39 deletions(-) diff --git a/apps/web/components/connect-ai-modal.tsx b/apps/web/components/connect-ai-modal.tsx index 6500ba23b..2d29dd558 100644 --- a/apps/web/components/connect-ai-modal.tsx +++ b/apps/web/components/connect-ai-modal.tsx @@ -27,6 +27,7 @@ import { useEffect, useState } from "react" import { toast } from "sonner" import { z } from "zod/v4" import { analytics } from "@/lib/analytics" +import { cn } from "@lib/utils" const clients = { cursor: "Cursor", @@ -79,6 +80,9 @@ export function ConnectAIModal({ const setIsOpen = onOpenChange || setInternalIsOpen const [isMigrateDialogOpen, setIsMigrateDialogOpen] = useState(false) const [selectedProject, setSelectedProject] = useState("none") + const [cursorInstallTab, setCursorInstallTab] = useState< + "oneClick" | "manual" + >("oneClick") const projectId = localStorage.getItem("selectedProject") ?? "default" useEffect(() => { @@ -164,6 +168,10 @@ export function ConnectAIModal({ return command } + function getCursorDeeplink() { + return "https://cursor.com/en/install-mcp?name=supermemory-mcp&config=eyJjb21tYW5kIjoibnB4IC15IG1jcC1yZW1vdGUgaHR0cHM6Ly9hcGkuc3VwZXJtZW1vcnkuYWkvbWNwIn0%3D" + } + const copyToClipboard = () => { const command = generateInstallCommand() navigator.clipboard.writeText(command) @@ -252,21 +260,142 @@ export function ConnectAIModal({ - {/* Step 2: Project Selection or MCP URL */} + {/* Step 2: One-click Install for Cursor, Project Selection for others, or MCP URL */} {selectedClient && (
-
-
- 2 +
+
+
+ 2 +
+

+ {selectedClient === "cursor" + ? "Install Supermemory MCP" + : selectedClient === "mcp-url" + ? "MCP Server URL" + : "Select Target Project (Optional)"} +

+
+ +
+ {/* Tabs */} +
+
+ + +
+
-

- {selectedClient === "mcp-url" - ? "MCP Server URL" - : "Select Target Project (Optional)"} -

- {selectedClient === "mcp-url" ? ( + {selectedClient === "cursor" ? ( +
+ {/* Tab Content */} + {cursorInstallTab === "oneClick" ? ( +
+
+
+

+ Click the button below to automatically install and + configure Supermemory in Cursor +

+

+ This will install the MCP server without any + additional setup required +

+
+ { + analytics.mcpInstallCmdCopied() + toast.success("Opening Cursor installer...") + }} + > + Add Supermemory MCP server to Cursor + +
+

+ Make sure you have Cursor installed on your system +

+
+ ) : ( +
+

+ Choose a project and follow the installation steps below +

+
+ +
+
+ )} +
+ ) : selectedClient === "mcp-url" ? (
)} - {/* Step 3: Command Line */} - {selectedClient && selectedClient !== "mcp-url" && ( -
-
-
- 3 + {/* Step 3: Command Line - Show for manual installation or non-cursor clients */} + {selectedClient && + selectedClient !== "mcp-url" && + (selectedClient !== "cursor" || cursorInstallTab === "manual") && ( +
+
+
+ 3 +
+

+ {selectedClient === "cursor" && + cursorInstallTab === "manual" + ? "Manual Installation Command" + : "Installation Command"} +

-

Installation Command

-
-
- - -
+
+ + +
-

- Copy and run this command in your terminal to install the MCP - server -

-
- )} +

+ {selectedClient === "cursor" && cursorInstallTab === "manual" + ? "Copy and run this command in your terminal for manual installation (or switch to the one-click option above)" + : "Copy and run this command in your terminal to install the MCP server"} +

+
+ )} - {/* Blurred Command Placeholder */} + {/* Blurred Command Placeholder - Only show when no client selected */} {!selectedClient && (