Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(connections): sync Claude MCP state with config (#4460)

Ansh Grover321fa1b8d187
diff --git a/apps/screenpipe-app-tauri/components/onboarding/connect-apps.tsx b/apps/screenpipe-app-tauri/components/onboarding/connect-apps.tsx
index 2d552acf0..14393d294 100644
--- a/apps/screenpipe-app-tauri/components/onboarding/connect-apps.tsx
+++ b/apps/screenpipe-app-tauri/components/onboarding/connect-apps.tsx
@@ -9,6 +9,7 @@ import { Check, Loader, Lock } from "lucide-react";
import { motion, AnimatePresence } from "framer-motion";
import { commands } from "@/lib/utils/tauri";
import { useSettings } from "@/lib/hooks/use-settings";
+import { getClaudeConfigPath } from "@/lib/hooks/use-hardcoded-tiles";
import { localFetch } from "@/lib/api";
import { openUrl } from "@tauri-apps/plugin-opener";
import { readTextFile, writeFile, mkdir } from "@tauri-apps/plugin-fs";
@@ -136,19 +137,10 @@ async function installCursorMcp(): Promise<void> {
}
// Claude Desktop
-async function getClaudeMcpConfigPath(): Promise<string> {
- const home = await homeDir();
- const os = platform();
- console.log("[claude-mcp] platform:", os, "home:", home);
- if (os === "windows") {
- return join(home, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
- }
- return join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
-}
-
async function isClaudeMcpInstalled(): Promise<boolean> {
try {
- const configPath = await getClaudeMcpConfigPath();
+ const configPath = await getClaudeConfigPath();
+ if (!configPath) return false;
console.log("[claude-mcp] checking install at:", configPath);
const content = await readTextFile(configPath);
return !!JSON.parse(content)?.mcpServers?.screenpipe;
@@ -159,7 +151,8 @@ async function isClaudeMcpInstalled(): Promise<boolean> {
}
async function installClaudeMcp(): Promise<void> {
- const configPath = await getClaudeMcpConfigPath();
+ const configPath = await getClaudeConfigPath();
+ if (!configPath) throw new Error("unsupported platform");
console.log("[claude-mcp] installing to:", configPath);
const config = await readMcpConfig(configPath);
console.log("[claude-mcp] existing config:", JSON.stringify(config));
diff --git a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx b/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
index aa50c4387..70d6fc739 100644
--- a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
@@ -3776,12 +3776,9 @@ export function ConnectionsSection({
detectInstalledConnectionIds()
.then(setDetectedConnectionIds)
.catch(() => setDetectedConnectionIds(new Set()));
- getInstalledMcpVersion().then(v => {
- const installed = !!v || localStorage.getItem("screenpipe_claude_connected") === "true";
- setClaudeInstalled(installed);
- }).catch(() => {
- setClaudeInstalled(localStorage.getItem("screenpipe_claude_connected") === "true");
- });
+ getInstalledMcpVersion()
+ .then(v => setClaudeInstalled(!!v))
+ .catch(() => setClaudeInstalled(false));
isCursorMcpInstalled().then(setCursorInstalled).catch(() => {});
isCodexMcpInstalled().then(setCodexInstalled).catch(() => {});
isGrokMcpInstalled().then(setGrokInstalled).catch(() => {});
@@ -4030,8 +4027,8 @@ export function ConnectionsSection({
if (!selected) return null;
switch (selected) {
case "claude": return <ClaudePanel
- onConnected={() => { localStorage.setItem("screenpipe_claude_connected", "true"); setClaudeInstalled(true); }}
- onDisconnected={() => { localStorage.removeItem("screenpipe_claude_connected"); setClaudeInstalled(false); }}
+ onConnected={() => setClaudeInstalled(true)}
+ onDisconnected={() => setClaudeInstalled(false)}
/>;
case "cursor": return <CursorPanel
onConnected={() => setCursorInstalled(true)}
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts b/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts
index 37ce99606..42af4530d 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts
@@ -113,8 +113,8 @@ export function useHardcodedTiles(): HardcodedTile[] {
useEffect(() => {
getInstalledMcpVersion()
- .then(v => setClaudeInstalled(!!v || localStorage.getItem("screenpipe_claude_connected") === "true"))
- .catch(() => setClaudeInstalled(localStorage.getItem("screenpipe_claude_connected") === "true"));
+ .then(v => setClaudeInstalled(!!v))
+ .catch(() => setClaudeInstalled(false));
isCursorMcpInstalled().then(setCursorInstalled).catch(() => {});
isCodexMcpInstalled().then(setCodexInstalled).catch(() => {});