diff --git a/design/mcp-autodetect-status-bar.pen b/design/mcp-autodetect-status-bar.pen new file mode 100644 index 00000000..747b5ab3 --- /dev/null +++ b/design/mcp-autodetect-status-bar.pen @@ -0,0 +1 @@ +{"children":[],"variables":{}} diff --git a/src-tauri/src/mcp.rs b/src-tauri/src/mcp.rs index 1015cf8f..4348f78e 100644 --- a/src-tauri/src/mcp.rs +++ b/src-tauri/src/mcp.rs @@ -193,7 +193,11 @@ pub fn check_mcp_status() -> McpStatus { } // Verify the referenced index.js actually exists on disk - if let Some(index_js) = entry["args"].as_array().and_then(|a| a.first()).and_then(|v| v.as_str()) { + if let Some(index_js) = entry["args"] + .as_array() + .and_then(|a| a.first()) + .and_then(|v| v.as_str()) + { if !Path::new(index_js).exists() { return McpStatus::NotInstalled; } @@ -381,7 +385,10 @@ mod tests { // On CI without Claude it might be NoClaudeCli. Either way it must not panic. let status = check_mcp_status(); assert!( - matches!(status, McpStatus::Installed | McpStatus::NotInstalled | McpStatus::NoClaudeCli), + matches!( + status, + McpStatus::Installed | McpStatus::NotInstalled | McpStatus::NoClaudeCli + ), "unexpected status: {:?}", status ); diff --git a/src/hooks/useMcpRegistration.ts b/src/hooks/useMcpRegistration.ts deleted file mode 100644 index 847a7649..00000000 --- a/src/hooks/useMcpRegistration.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { useEffect, useRef } from 'react' -import { invoke } from '@tauri-apps/api/core' -import { isTauri, mockInvoke } from '../mock-tauri' - -function tauriCall(command: string, args: Record): Promise { - return isTauri() ? invoke(command, args) : mockInvoke(command, args) -} - -/** - * Registers Laputa as an MCP server in Claude Code and Cursor config files. - * Fires once per vault path (skips duplicates). - */ -export function useMcpRegistration( - vaultPath: string, - onToast: (msg: string) => void, -) { - const registeredRef = useRef(null) - - useEffect(() => { - if (registeredRef.current === vaultPath) return - registeredRef.current = vaultPath - - tauriCall('register_mcp_tools', { vaultPath }) - .then((status) => { - if (status === 'registered') { - onToast('Laputa registered as MCP tool for Claude Code') - } - }) - .catch(() => { - // Silently ignore — not critical for app operation - }) - }, [vaultPath]) // eslint-disable-line react-hooks/exhaustive-deps -- onToast is stable via ref -}