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

feat(app): add always-on-top shortcut reminder overlay

Louis Beaumont88d0c2aedc2f
diff --git a/screenpipe-app-tauri/app/onboarding/page.tsx b/screenpipe-app-tauri/app/onboarding/page.tsx
index f0fa7c6eb..3e1be5865 100644
--- a/screenpipe-app-tauri/app/onboarding/page.tsx
+++ b/screenpipe-app-tauri/app/onboarding/page.tsx
@@ -207,22 +207,6 @@ export default function OnboardingPage() {
}
};
- const handleSkip = async () => {
- if (isTransitioning) return;
-
- try {
- setIsTransitioning(true);
- trackOnboardingStep("completed", { skipped: true });
-
- // Removed success toast to avoid spam
- await handleEnd();
- } catch (error) {
- console.error("Error skipping onboarding:", error);
- showErrorToast("Failed to skip onboarding");
- setIsTransitioning(false);
- }
- };
-
const handleEnd = async () => {
try {
setIsTransitioning(true);
@@ -267,15 +251,6 @@ export default function OnboardingPage() {
<div className="flex flex-col w-full h-screen overflow-hidden bg-background">
{/* Minimal header with drag region */}
<div className="w-full bg-background p-4" data-tauri-drag-region>
- <div className="flex items-center justify-end max-w-4xl mx-auto">
- <button
- onClick={handleSkip}
- disabled={isTransitioning}
- className="font-mono text-xs text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors"
- >
- skip
- </button>
- </div>
</div>
{/* Main content container */}
diff --git a/screenpipe-app-tauri/app/shortcut-reminder/layout.tsx b/screenpipe-app-tauri/app/shortcut-reminder/layout.tsx
new file mode 100644
index 000000000..c6ed246ee
--- /dev/null
+++ b/screenpipe-app-tauri/app/shortcut-reminder/layout.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import "../globals.css";
+
+export default function ShortcutReminderLayout({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <html lang="en" style={{ background: "transparent" }}>
+ <head>
+ <style>{`
+ html, body {
+ background: transparent !important;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ }
+ `}</style>
+ </head>
+ <body style={{ background: "transparent", margin: 0, padding: 0 }}>
+ {children}
+ </body>
+ </html>
+ );
+}
diff --git a/screenpipe-app-tauri/app/shortcut-reminder/page.tsx b/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
index 12e089167..fb64ba48f 100644
--- a/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
+++ b/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
@@ -6,69 +6,126 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
import posthog from "posthog-js";
export default function ShortcutReminderPage() {
- const [shortcut, setShortcut] = useState("⌘ ⌃ S");
+ const [shortcut, setShortcut] = useState("⌘⌃S");
const [visible, setVisible] = useState(true);
+ const [hovered, setHovered] = useState(false);
+
+ const hideWindow = async () => {
+ posthog.capture("shortcut_reminder_dismissed");
+ setVisible(false);
+ setTimeout(async () => {
+ const window = getCurrentWindow();
+ await window.hide();
+ }, 200);
+ };
useEffect(() => {
- // Listen for shortcut info from main process
const unlistenShortcut = listen<string>("shortcut-reminder-update", (event) => {
setShortcut(formatShortcut(event.payload));
});
- // Listen for hide event
- const unlistenHide = listen("shortcut-reminder-hide", () => {
- setVisible(false);
- setTimeout(async () => {
- const window = getCurrentWindow();
- await window.hide();
- }, 300);
- });
+ const unlistenHide = listen("shortcut-reminder-hide", hideWindow);
- // Track that reminder was shown
- posthog.capture("shortcut_reminder_shown", { type: "native_window" });
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.key === "Escape") hideWindow();
+ };
+ window.addEventListener("keydown", handleKeyDown);
+
+ posthog.capture("shortcut_reminder_shown");
return () => {
unlistenShortcut.then((fn) => fn());
unlistenHide.then((fn) => fn());
+ window.removeEventListener("keydown", handleKeyDown);
};
}, []);
- const handleClick = async () => {
- posthog.capture("shortcut_reminder_dismissed", { type: "native_window" });
- setVisible(false);
- setTimeout(async () => {
- const window = getCurrentWindow();
- await window.hide();
- }, 300);
- };
-
return (
<div
- className={`w-full h-full flex items-center justify-center transition-opacity duration-300 ${
- visible ? "opacity-100" : "opacity-0"
- }`}
+ className="w-full h-full flex items-center justify-center"
style={{ background: "transparent" }}
>
<div
- onClick={handleClick}
- className="bg-black/90 text-white px-5 py-3 rounded-full flex items-center gap-2 cursor-pointer hover:bg-black/80 transition-colors shadow-2xl backdrop-blur-sm border border-white/10"
+ data-tauri-drag-region
+ onMouseEnter={() => setHovered(true)}
+ onMouseLeave={() => setHovered(false)}
+ className={`
+ select-none
+ transition-all duration-300 ease-out
+ ${visible ? "opacity-100 scale-100" : "opacity-0 scale-95"}
+ `}
+ style={{ cursor: "grab" }}
>
- <span className="text-sm text-white/70">Press</span>
- <span className="font-mono text-sm font-semibold text-pink-400">
- {shortcut}
- </span>
- <span className="text-sm text-white/70">to open screenpipe</span>
+ <div className="relative" data-tauri-drag-region>
+ {/* Subtle glow */}
+ <div
+ data-tauri-drag-region
+ className={`absolute inset-0 bg-pink-500/30 rounded-full blur-md transition-opacity duration-300 ${hovered ? 'opacity-100' : 'opacity-50'}`}
+ />
+
+ {/* Main pill */}
+ <div
+ data-tauri-drag-region
+ className={`
+ relative flex items-center gap-2 py-1.5 px-3
+ bg-black/85 backdrop-blur-xl rounded-full
+ border border-white/10 shadow-2xl
+ transition-all duration-300 ease-out
+ `}
+ >
+ {/* Pulsing dot */}
+ <span className="relative flex h-1.5 w-1.5 flex-shrink-0" data-tauri-drag-region>
+ <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-pink-400 opacity-75" />
+ <span className="relative inline-flex rounded-full h-1.5 w-1.5 bg-pink-500" />
+ </span>
+
+ {/* Shortcut */}
+ <span
+ data-tauri-drag-region
+ className="font-mono text-[11px] font-semibold text-white/90 tracking-wide"
+ >
+ {shortcut}
+ </span>
+
+ {/* Expanded text on hover */}
+ <span
+ data-tauri-drag-region
+ className={`
+ text-[10px] text-white/60 whitespace-nowrap overflow-hidden
+ transition-all duration-300 ease-out
+ ${hovered ? 'max-w-[150px] opacity-100 ml-0.5' : 'max-w-0 opacity-0'}
+ `}
+ >
+ open screenpipe
+ </span>
+
+ {/* Close button on hover */}
+ <button
+ onClick={(e) => {
+ e.stopPropagation();
+ hideWindow();
+ }}
+ className={`
+ ml-1 text-white/40 hover:text-white/80
+ transition-all duration-200
+ ${hovered ? 'opacity-100 w-4' : 'opacity-0 w-0'}
+ `}
+ >
+ ×
+ </button>
+ </div>
+ </div>
</div>
</div>
);
}
function formatShortcut(shortcut: string): string {
- if (!shortcut) return "⌘ ⌃ S";
+ if (!shortcut) return "⌘⌃S";
return shortcut
.replace(/Super|Command|Cmd/gi, "⌘")
.replace(/Ctrl|Control/gi, "⌃")
.replace(/Alt|Option/gi, "⌥")
.replace(/Shift/gi, "⇧")
- .replace(/\+/g, " ");
+ .replace(/\+/g, "");
}
diff --git a/screenpipe-app-tauri/components/onboarding/personalize.tsx b/screenpipe-app-tauri/components/onboarding/personalize.tsx
index d9400e55e..a40c53519 100644
--- a/screenpipe-app-tauri/components/onboarding/personalize.tsx
+++ b/screenpipe-app-tauri/components/onboarding/personalize.tsx
@@ -1,5 +1,4 @@
import React from "react";
-import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import {
Brain,
CircleCheck,
@@ -107,7 +106,7 @@ const OnboardingPersonalize: React.FC<OnboardingPersonalizeProps> = ({
}) => {
return (
<div className={`${className} flex flex-col h-full`}>
- <DialogHeader className="flex flex-col px-2 justify-center items-center mb-6">
+ <div className="flex flex-col px-2 justify-center items-center mb-6">
<motion.img
className="w-20 h-20 justify-center mb-4"
src="/128x128.png"
@@ -116,13 +115,13 @@ const OnboardingPersonalize: React.FC<OnboardingPersonalizeProps> = ({
animate={{ scale: 1, opacity: 1 }}
transition={{ duration: 0.5 }}
/>
- <DialogTitle className="text-center text-2xl font-bold">
+ <h2 className="text-center text-2xl font-bold">
Choose your AI assistance level
- </DialogTitle>
+ </h2>
<p className="text-center text-muted-foreground mt-2 max-w-md">
screenpipe uses AI to help you find and understand your recorded data. Choose how much AI assistance you&apos;d like.
</p>
- </DialogHeader>
+ </div>
<div className="flex-1 flex flex-col items-center justify-center">
<div className="flex flex-wrap justify-center gap-4 max-w-6xl">
diff --git a/screenpipe-app-tauri/components/onboarding/status.tsx b/screenpipe-app-tauri/components/onboarding/status.tsx
index 4123233ef..eaa19e865 100644
--- a/screenpipe-app-tauri/components/onboarding/status.tsx
+++ b/screenpipe-app-tauri/components/onboarding/status.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from "react";
-import { Check, Monitor, Mic, Command } from "lucide-react";
+import { Check, Monitor, Mic } from "lucide-react";
import { Button } from "../ui/button";
import { invoke } from "@tauri-apps/api/core";
import posthog from "posthog-js";
diff --git a/screenpipe-app-tauri/components/onboarding/usecases-selection.tsx b/screenpipe-app-tauri/components/onboarding/usecases-selection.tsx
index 34d370ff3..a7de16e50 100644
--- a/screenpipe-app-tauri/components/onboarding/usecases-selection.tsx
+++ b/screenpipe-app-tauri/components/onboarding/usecases-selection.tsx
@@ -1,5 +1,4 @@
import React from "react";
-import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import {
Brain,
CircleCheck,
@@ -25,38 +24,38 @@ const OPTIONS = [
{
key: "memory",
icon: Brain,
- label: "Personal memory",
- description: "I forget things and want to search my past screen activity",
+ label: "personal memory",
+ description: "i forget things and want to search my past screen activity",
},
{
key: "meetings",
icon: Calendar,
- label: "Meeting summaries",
- description: "I need help remembering what was discussed in meetings",
+ label: "meeting summaries",
+ description: "i need help remembering what was discussed in meetings",
},
{
key: "productivity",
icon: Search,
- label: "Productivity tracking",
- description: "I want to understand how I spend my time on my computer",
+ label: "productivity tracking",
+ description: "i want to understand how i spend my time on my computer",
},
{
key: "developer",
icon: Code,
- label: "Building/developing",
- description: "I'm a developer and want to build on top of Screenpipe",
+ label: "building/developing",
+ description: "i'm a developer and want to build on top of screenpipe",
},
{
key: "privacy",
icon: Shield,
- label: "Privacy-focused alternative",
- description: "I want a local/private alternative to cloud services",
+ label: "privacy-focused alternative",
+ description: "i want a local/private alternative to cloud services",
},
{
key: "curious",
icon: Sparkles,
- label: "Just curious",
- description: "Trying it out to see what it does",
+ label: "just curious",
+ description: "trying it out to see what it does",
},
];
@@ -114,7 +113,7 @@ const OnboardingSelection: React.FC<OnboardingSelectionProps> = ({
return (
<div className={`${className} flex flex-col h-full`}>
- <DialogHeader className="flex flex-col px-2 justify-center items-center mb-6">
+ <div className="flex flex-col px-2 justify-center items-center mb-6">
<motion.img
className="w-20 h-20 justify-center mb-4"
src="/128x128.png"
@@ -123,13 +122,13 @@ const OnboardingSelection: React.FC<OnboardingSelectionProps> = ({
animate={{ scale: 1, opacity: 1 }}
transition={{ duration: 0.5 }}
/>
- <DialogTitle className="text-center text-2xl font-bold">
- What brought you to Screenpipe?
- </DialogTitle>
+ <h2 className="text-center text-2xl font-bold">
+ what brought you to screenpipe?
+ </h2>
<p className="text-center text-muted-foreground mt-2">
- Help us understand what you&apos;re looking for (select all that apply)
+ help us understand what you&apos;re looking for (select all that apply)
</p>
- </DialogHeader>
+ </div>
<div className="flex-1 flex flex-col items-center justify-center overflow-y-auto">
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 max-w-3xl w-full px-4">
diff --git a/screenpipe-app-tauri/components/rewind/search-command.tsx b/screenpipe-app-tauri/components/rewind/search-command.tsx
index 614b97c8b..73fa0a850 100644
--- a/screenpipe-app-tauri/components/rewind/search-command.tsx
+++ b/screenpipe-app-tauri/components/rewind/search-command.tsx
@@ -37,22 +37,15 @@ export function SearchCommand() {
: state,
);
+ // Listen for Rust-level open-search event (Cmd+K / Ctrl+K global shortcut)
React.useEffect(() => {
- const down = (e: KeyboardEvent) => {
- if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
- e.preventDefault();
- setOpen((open) => !open);
- }
- // Always close on escape when dialog is open
- if (e.key === "Escape" && open) {
- e.preventDefault();
- e.stopPropagation();
- setOpen(false);
- }
+ const unlisten = listen("open-search", () => {
+ setOpen((open) => !open);
+ });
+ return () => {
+ unlisten.then((fn) => fn());
};
- document.addEventListener("keydown", down, true); // Use capture phase
- return () => document.removeEventListener("keydown", down, true);
- }, [open]);
+ }, []);
// Close dialog when Tauri window loses focus
React.useEffect(() => {
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index ae7adce6f..4fb8e75eb 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -547,17 +547,6 @@ dependencies = [
"tower-service",
]
-[[package]]
-name = "axum-macros"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.90",
-]
-
[[package]]
name = "backtrace"
version = "0.3.73"
@@ -5640,12 +5629,11 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "2.0.6"
+version = "2.0.7"
dependencies = [
"anyhow",
"async-stream",
"axum",
- "axum-macros",
"base64 0.22.1",
"chrono",
"cocoa 0.26.0",
diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rs
index bd0942f77..81f5ab672 100644
--- a/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -363,8 +363,11 @@ pub async fn show_shortcut_reminder(
let label = "shortcut-reminder";
+ info!("show_shortcut_reminder called");
+
// If window exists, just show it and update shortcut
if let Some(window) = app_handle.get_webview_window(label) {
+ info!("shortcut-reminder window exists, showing and focusing");
let _ = app_handle.emit_to(label, "shortcut-reminder-update", &shortcut);
let _ = window.show();
return Ok(());
@@ -379,42 +382,84 @@ pub async fn show_shortcut_reminder(
let screen_size = monitor.size();
let scale_factor = monitor.scale_factor();
- // Window dimensions
- let window_width = 350.0;
- let window_height = 60.0;
+ // Compact window dimensions (wider for hover state)
+ let window_width = 280.0;
+ let window_height = 40.0;
- // Position at bottom center of screen
+ // Position at top center of screen
let x = ((screen_size.width as f64 / scale_factor) - window_width) / 2.0;
- let y = (screen_size.height as f64 / scale_factor) - window_height - 100.0; // 100px from bottom
+ let y = 12.0; // 12px from top
+
+ // CRITICAL: Set Accessory activation policy for fullscreen support on macOS
+ #[cfg(target_os = "macos")]
+ {
+ let _ = app_handle.set_activation_policy(tauri::ActivationPolicy::Accessory);
+ }
- let _window = WebviewWindowBuilder::new(
+ info!("Creating new shortcut-reminder window");
+ let window = WebviewWindowBuilder::new(
&app_handle,
label,
tauri::WebviewUrl::App("shortcut-reminder".into()),
)
- .title("Shortcut Reminder")
+ .title("")
.inner_size(window_width, window_height)
.position(x, y)
- .decorations(false)
- .transparent(true)
+ .visible_on_all_workspaces(true)
.always_on_top(true)
- .resizable(false)
+ .decorations(false)
.skip_taskbar(true)
.focused(false)
- .visible(true)
+ .transparent(true)
+ .visible(false)
+ .shadow(false)
+ .resizable(false)
.build()
.map_err(|e| format!("Failed to create shortcut reminder window: {}", e))?;
+ info!("shortcut-reminder window created");
+
+ // Convert to NSPanel on macOS for fullscreen support
+ #[cfg(target_os = "macos")]
+ {
+ use tauri_nspanel::WebviewWindowExt;
+ use tauri_nspanel::ManagerExt;
+
+ if let Ok(_panel) = window.to_panel() {
+ info!("Successfully converted shortcut-reminder to panel");
+
+ let app_clone = app_handle.clone();
+ let _ = app_handle.run_on_main_thread(move || {
+ use tauri_nspanel::cocoa::appkit::NSWindowCollectionBehavior;
+
+ if let Ok(panel) = app_clone.get_webview_panel(label) {
+ // Level 1001 = above CGShieldingWindowLevel, shows over fullscreen
+ panel.set_level(1001);
+ panel.set_style_mask(0);
+ panel.set_collection_behaviour(
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorCanJoinAllSpaces |
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorIgnoresCycle |
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorFullScreenAuxiliary |
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorStationary
+ );
+ // Order front regardless to show above fullscreen
+ panel.order_front_regardless();
+ info!("Panel configured for fullscreen support");
+ }
+ });
+ } else {
+ error!("Failed to convert shortcut-reminder to panel");
+ }
+ }
+
+ #[cfg(not(target_os = "macos"))]
+ {
+ let _ = window.show();
+ }
+
// Send the shortcut info to the window
let _ = app_handle.emit_to(label, "shortcut-reminder-update", &shortcut);
- // Set up auto-hide after 10 seconds
- let app_handle_clone = app_handle.clone();
- tokio::spawn(async move {
- tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
- let _ = app_handle_clone.emit_to("shortcut-reminder", "shortcut-reminder-hide", ());
- });
-
Ok(())
}
diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rs
index 508e59d64..618ca126c 100755
--- a/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -275,6 +275,49 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
)
.await?;
+ // Register Escape shortcut to hide the main timeline window
+ let escape_shortcut = Shortcut::new(None, Code::Escape);
+ if let Err(e) = global_shortcut.on_shortcut(escape_shortcut, |app, _, event| {
+ if matches!(event.state, ShortcutState::Pressed) {
+ info!("Escape pressed, hiding main window");
+ hide_main_window(app);
+ }
+ }) {
+ warn!("Failed to register Escape shortcut: {}", e);
+ }
+
+ // Register Cmd+K (macOS) / Ctrl+K (Windows/Linux) to open search when main window is visible
+ #[cfg(target_os = "macos")]
+ let search_shortcut = Shortcut::new(Some(Modifiers::SUPER), Code::KeyK);
+ #[cfg(not(target_os = "macos"))]
+ let search_shortcut = Shortcut::new(Some(Modifiers::CONTROL), Code::KeyK);
+
+ if let Err(e) = global_shortcut.on_shortcut(search_shortcut, |app, _, event| {
+ if matches!(event.state, ShortcutState::Pressed) {
+ // Only open search if main window is visible
+ #[cfg(target_os = "macos")]
+ {
+ if let Ok(window) = app.get_webview_panel("main") {
+ if window.is_visible() {
+ info!("Cmd+K pressed, opening search");
+ let _ = app.emit("open-search", ());
+ }
+ }
+ }
+ #[cfg(not(target_os = "macos"))]
+ {
+ if let Some(window) = app.get_webview_window("main") {
+ if window.is_visible().unwrap_or(false) {
+ info!("Ctrl+K pressed, opening search");
+ let _ = app.emit("open-search", ());
+ }
+ }
+ }
+ }
+ }) {
+ warn!("Failed to register search shortcut: {}", e);
+ }
+
Ok(())
}
@@ -667,6 +710,9 @@ async fn main() {
commands::reset_onboarding,
commands::show_onboarding_window,
commands::open_search_window,
+ // Shortcut reminder commands
+ commands::show_shortcut_reminder,
+ commands::hide_shortcut_reminder,
// Commands from tray.rs
set_tray_unhealth_icon,
set_tray_health_icon,
@@ -844,6 +890,15 @@ async fn main() {
let _ = ShowRewindWindow::Main.show(&app.handle());
}
+ // Always show shortcut reminder overlay on app startup
+ let shortcut = store.show_screenpipe_shortcut.clone();
+ let app_handle_reminder = app.handle().clone();
+ tauri::async_runtime::spawn(async move {
+ // Small delay to ensure windows are ready
+ tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
+ let _ = commands::show_shortcut_reminder(app_handle_reminder, shortcut).await;
+ });
+
// Get app handle once for all initializations
let app_handle = app.handle().clone();
let server_running = is_server_running(app_handle.clone());
diff --git a/screenpipe-integrations/screenpipe-mcp/src/index.ts b/screenpipe-integrations/screenpipe-mcp/src/index.ts
index e03e4c5d9..81cc4a12e 100644
--- a/screenpipe-integrations/screenpipe-mcp/src/index.ts
+++ b/screenpipe-integrations/screenpipe-mcp/src/index.ts
@@ -5,6 +5,10 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import {
CallToolRequestSchema,
ListToolsRequestSchema,
+ ListPromptsRequestSchema,
+ GetPromptRequestSchema,
+ ListResourcesRequestSchema,
+ ReadResourceRequestSchema,
Tool,
} from "@modelcontextprotocol/sdk/types.js";
import { WebSocket } from "ws";
@@ -12,6 +16,20 @@ import * as fs from "fs";
import * as path from "path";
import * as os from "os";
+// Helper to get current date in ISO format
+function getCurrentDateInfo(): { isoDate: string; localDate: string } {
+ const now = new Date();
+ return {
+ isoDate: now.toISOString(),
+ localDate: now.toLocaleDateString("en-US", {
+ weekday: "long",
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ }),
+ };
+}
+
// Detect OS
const CURRENT_OS = process.platform;
const IS_MACOS = CURRENT_OS === "darwin";
@@ -38,6 +56,8 @@ const server = new Server(
{
capabilities: {
tools: {},
+ prompts: {},
+ resources: {},
},
}
);
@@ -47,54 +67,50 @@ const BASE_TOOLS: Tool[] = [
{
name: "search-content",
description:
- "Search through screenpipe recorded content (OCR text, audio transcriptions, UI elements). " +
- "Use this to find specific content that has appeared on your screen or been spoken. " +
- "Results include timestamps, app context, and the content itself. " +
- "Set include_frames=true to get screenshot images for visual analysis (OCR results only).",
+ "Search screenpipe's recorded content: screen text (OCR), audio transcriptions, and UI elements. " +
+ "Returns timestamped results with app context. " +
+ "Call with no parameters to get recent activity. " +
+ "Use the 'screenpipe://context' resource for current time when building time-based queries.",
inputSchema: {
type: "object",
properties: {
q: {
type: "string",
- description: "Search query to find in recorded content",
+ description: "Search query. Optional - omit to return all recent content.",
},
content_type: {
type: "string",
enum: ["all", "ocr", "audio", "ui"],
- description:
- "Type of content to search: 'ocr' for screen text, 'audio' for spoken words, 'ui' for UI elements, or 'all' for everything",
+ description: "Content type filter. Default: 'all'",
default: "all",
},
limit: {
type: "integer",
- description: "Maximum number of results to return",
+ description: "Max results. Default: 10",
default: 10,
},
offset: {
type: "integer",
- description: "Number of results to skip (for pagination)",
+ description: "Skip N results for pagination. Default: 0",
default: 0,
},
start_time: {
type: "string",
format: "date-time",
- description:
- "Start time in ISO format UTC (e.g. 2024-01-01T00:00:00Z). Filter results from this time onward.",
+ description: "ISO 8601 UTC start time (e.g., 2024-01-15T10:00:00Z)",
},
end_time: {
type: "string",
format: "date-time",
- description:
- "End time in ISO format UTC (e.g. 2024-01-01T00:00:00Z). Filter results up to this time.",
+ description: "ISO 8601 UTC end time (e.g., 2024-01-15T18:00:00Z)",
},
app_name: {
type: "string",
- description:
- "Filter by application name (e.g. 'Chrome', 'Safari', 'Terminal')",
+ description: "Filter by app (e.g., 'Google Chrome', 'Slack', 'zoom.us')",
},
window_name: {
type: "string",
- description: "Filter by window name or title",
+ description: "Filter by window title",
},
min_length: {
type: "integer",
@@ -106,10 +122,7 @@ const BASE_TOOLS: Tool[] = [
},
include_frames: {
type: "boolean",
- description:
- "Include screenshot images in results for visual analysis. Only applies to OCR results. " +
- "When true, returns base64-encoded images that can be analyzed with vision capabilities. " +
- "Note: Images are limited to ~1MB each. Default: false",
+ description: "Include base64 screenshots (OCR only). Default: false",
default: false,
},
},
@@ -165,8 +178,11 @@ const BASE_TOOLS: Tool[] = [
name: "export-video",
description:
"Export a video of screen recordings for a specific time range. " +
- "Creates an MP4 video from the recorded frames between the start and end times. " +
- "Example: 'Export video from 10:00 AM to 10:30 AM today'",
+ "Creates an MP4 video from the recorded frames between the start and end times.\n\n" +
+ "IMPORTANT: Use ISO 8601 UTC timestamps (e.g., 2024-01-15T10:00:00Z)\n\n" +
+ "EXAMPLES:\n" +
+ "- Last 30 minutes: Calculate timestamps from current time\n" +
+ "- Specific meeting: Use the meeting's start and end times in UTC",
inputSchema: {
type: "object",
properties: {
@@ -174,18 +190,18 @@ const BASE_TOOLS: Tool[] = [
type: "string",
format: "date-time",
description:
- "Start time in ISO 8601 format UTC (e.g., '2024-01-15T10:00:00Z')",
+ "Start time in ISO 8601 format UTC. MUST include timezone (Z for UTC). Example: '2024-01-15T10:00:00Z'",
},
end_time: {
type: "string",
format: "date-time",
description:
- "End time in ISO 8601 format UTC (e.g., '2024-01-15T10:30:00Z')",
+ "End time in ISO 8601 format UTC. MUST include timezone (Z for UTC). Example: '2024-01-15T10:30:00Z'",
},
fps: {
type: "number",
description:
- "Frames per second for the output video. Lower values create smaller files. Default: 1.0",
+ "Frames per second for the output video. Lower values (0.5-1.0) create smaller files, higher values (5-10) create smoother playback. Default: 1.0",
default: 1.0,
},
},
@@ -400,6 +416,225 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
return { tools };
});
+// MCP Resources - provide dynamic context data
+const RESOURCES = [
+ {
+ uri: "screenpipe://context",
+ name: "Current Context",
+ description: "Current date/time and pre-computed timestamps for common time ranges",
+ mimeType: "application/json",
+ },
+ {
+ uri: "screenpipe://guide",
+ name: "Usage Guide",
+ description: "How to use screenpipe search effectively",
+ mimeType: "text/markdown",
+ },
+];
+
+// List resources handler
+server.setRequestHandler(ListResourcesRequestSchema, async () => {
+ return { resources: RESOURCES };
+});
+
+// Read resource handler
+server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
+ const { uri } = request.params;
+ const dateInfo = getCurrentDateInfo();
+ const now = Date.now();
+
+ switch (uri) {
+ case "screenpipe://context":
+ return {
+ contents: [
+ {
+ uri,
+ mimeType: "application/json",
+ text: JSON.stringify({
+ current_time: dateInfo.isoDate,
+ current_date_local: dateInfo.localDate,
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
+ timestamps: {
+ now: dateInfo.isoDate,
+ one_hour_ago: new Date(now - 60 * 60 * 1000).toISOString(),
+ three_hours_ago: new Date(now - 3 * 60 * 60 * 1000).toISOString(),
+ today_start: `${new Date().toISOString().split("T")[0]}T00:00:00Z`,
+ yesterday_start: `${new Date(now - 24 * 60 * 60 * 1000).toISOString().split("T")[0]}T00:00:00Z`,
+ one_week_ago: new Date(now - 7 * 24 * 60 * 60 * 1000).toISOString(),
+ },
+ common_apps: ["Google Chrome", "Safari", "Slack", "zoom.us", "Microsoft Teams", "Code", "Terminal"],
+ }, null, 2),
+ },
+ ],
+ };
+
+ case "screenpipe://guide":
+ return {
+ contents: [
+ {
+ uri,
+ mimeType: "text/markdown",
+ text: `# Screenpipe Search Guide
+
+## Quick Start
+- **Get recent activity**: Call search-content with no parameters
+- **Search text**: \`{"q": "search term", "content_type": "ocr"}\`
+- **Time filter**: Use start_time/end_time with ISO 8601 UTC timestamps
+
+## Content Types
+- \`ocr\`: Screen text (what you see)
+- \`audio\`: Transcribed speech
+- \`ui\`: UI element interactions
+- \`all\`: Everything (default)
+
+## Key Parameters
+| Parameter | Description | Default |
+|-----------|-------------|---------|
+| q | Search query | (none - returns all) |
+| content_type | ocr/audio/ui/all | all |
+| limit | Max results | 10 |
+| start_time | ISO 8601 UTC | (no filter) |
+| end_time | ISO 8601 UTC | (no filter) |
+| app_name | Filter by app | (no filter) |
+| include_frames | Include screenshots | false |
+
+## Tips
+1. Read screenpipe://context first to get current timestamps
+2. Omit \`q\` to get all content (useful for "what was I doing?")
+3. Use \`limit: 50-100\` for comprehensive searches
+4. Combine app_name + time filters for focused results`,
+ },
+ ],
+ };
+
+ default:
+ throw new Error(`Unknown resource: ${uri}`);
+ }
+});
+
+// MCP Prompts - static interaction templates
+const PROMPTS = [
+ {
+ name: "search-recent",
+ description: "Search recent screen activity",
+ arguments: [
+ { name: "query", description: "Optional search term", required: false },
+ { name: "hours", description: "Hours to look back (default: 1)", required: false },
+ ],
+ },
+ {
+ name: "find-in-app",
+ description: "Find content from a specific application",
+ arguments: [
+ { name: "app", description: "App name (e.g., Chrome, Slack)", required: true },
+ { name: "query", description: "Optional search term", required: false },
+ ],
+ },
+ {
+ name: "meeting-notes",
+ description: "Get audio transcriptions from meetings",
+ arguments: [
+ { name: "hours", description: "Hours to look back (default: 3)", required: false },
+ ],
+ },
+];
+
+// List prompts handler
+server.setRequestHandler(ListPromptsRequestSchema, async () => {
+ return { prompts: PROMPTS };
+});
+
+// Get prompt handler
+server.setRequestHandler(GetPromptRequestSchema, async (request) => {
+ const { name, arguments: promptArgs } = request.params;
+ const dateInfo = getCurrentDateInfo();
+ const now = Date.now();
+
+ switch (name) {
+ case "search-recent": {
+ const query = promptArgs?.query || "";
+ const hours = parseInt(promptArgs?.hours || "1", 10);
+ const startTime = new Date(now - hours * 60 * 60 * 1000).toISOString();
+
+ return {
+ description: `Search recent activity (last ${hours} hour${hours > 1 ? "s" : ""})`,
+ messages: [
+ {
+ role: "user" as const,
+ content: {
+ type: "text" as const,
+ text: `Search screenpipe for recent activity.
+
+Current time: ${dateInfo.isoDate}
+
+Use search-content with:
+${query ? `- q: "${query}"` : "- No query filter (get all content)"}
+- start_time: "${startTime}"
+- limit: 50`,
+ },
+ },
+ ],
+ };
+ }
+
+ case "find-in-app": {
+ const app = promptArgs?.app || "Google Chrome";
+ const query = promptArgs?.query || "";
+
+ return {
+ description: `Find content from ${app}`,
+ messages: [
+ {
+ role: "user" as const,
+ content: {
+ type: "text" as const,
+ text: `Search screenpipe for content from ${app}.
+
+Current time: ${dateInfo.isoDate}
+
+Use search-content with:
+- app_name: "${app}"
+${query ? `- q: "${query}"` : "- No query filter"}
+- content_type: "ocr"
+- limit: 50`,
+ },
+ },
+ ],
+ };
+ }
+
+ case "meeting-notes": {
+ const hours = parseInt(promptArgs?.hours || "3", 10);
+ const startTime = new Date(now - hours * 60 * 60 * 1000).toISOString();
+
+ return {
+ description: `Get meeting transcriptions (last ${hours} hours)`,
+ messages: [
+ {
+ role: "user" as const,
+ content: {
+ type: "text" as const,
+ text: `Get audio transcriptions from recent meetings.
+
+Current time: ${dateInfo.isoDate}
+
+Use search-content with:
+- content_type: "audio"
+- start_time: "${startTime}"
+- limit: 100
+
+Common meeting apps: zoom.us, Microsoft Teams, Google Meet, Slack`,
+ },
+ },
+ ],
+ };
+ }
+
+ default:
+ throw new Error(`Unknown prompt: ${name}`);
+ }
+});
+
// Helper function to make HTTP requests
async function fetchAPI(
endpoint: string,
@@ -462,10 +697,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
const data = await response.json();
const results = data.data || [];
+ const pagination = data.pagination || {};
if (results.length === 0) {
return {
- content: [{ type: "text", text: "No results found" }],
+ content: [
+ {
+ type: "text",
+ text: "No results found. Try: broader search terms, different content_type, or wider time range.",
+ },
+ ],
};
}
@@ -483,64 +724,45 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (!content) continue;
if (result.type === "OCR") {
- const textResult =
- `OCR Text: ${content.text || "N/A"}\n` +
- `App: ${content.app_name || "N/A"}\n` +
- `Window: ${content.window_name || "N/A"}\n` +
- `Time: ${content.timestamp || "N/A"}\n` +
- `Frame ID: ${content.frame_id || "N/A"}\n` +
- "---";
- formattedResults.push(textResult);
-
- // Collect frame if available and requested
+ formattedResults.push(
+ `[OCR] ${content.app_name || "?"} | ${content.window_name || "?"}\n` +
+ `${content.timestamp || ""}\n` +
+ `${content.text || ""}`
+ );
if (includeFrames && content.frame) {
images.push({
data: content.frame,
- context: `Screenshot from ${content.app_name || "unknown"} - ${content.window_name || "unknown"} at ${content.timestamp || "unknown"}`,
+ context: `${content.app_name} at ${content.timestamp}`,
});
}
} else if (result.type === "Audio") {
formattedResults.push(
- `Audio Transcription: ${content.transcription || "N/A"}\n` +
- `Device: ${content.device_name || "N/A"}\n` +
- `Time: ${content.timestamp || "N/A"}\n` +
- "---"
+ `[Audio] ${content.device_name || "?"}\n` +
+ `${content.timestamp || ""}\n` +
+ `${content.transcription || ""}`
);
} else if (result.type === "UI") {
formattedResults.push(
- `UI Text: ${content.text || "N/A"}\n` +
- `App: ${content.app_name || "N/A"}\n` +
- `Window: ${content.window_name || "N/A"}\n` +
- `Time: ${content.timestamp || "N/A"}\n` +
- "---"
+ `[UI] ${content.app_name || "?"} | ${content.window_name || "?"}\n` +
+ `${content.timestamp || ""}\n` +
+ `${content.text || ""}`
);
}
}
- // Add text results
+ // Header with pagination info
+ const header = `Results: ${results.length}/${pagination.total || "?"}` +
+ (pagination.total > results.length ? ` (use offset=${(pagination.offset || 0) + results.length} for more)` : "");
+
contentItems.push({
type: "text",
- text:
- "Search Results:\n\n" +
- formattedResults.join("\n") +
- (images.length > 0
- ? `\n\n${images.length} screenshot(s) included below for visual analysis:`
- : ""),
+ text: header + "\n\n" + formattedResults.join("\n---\n"),
});
- // Add images if requested and available
+ // Add images if requested
for (const img of images) {
- // Add context for the image
- contentItems.push({
- type: "text",
- text: `\n📷 ${img.context}`,
- });
- // Add the image itself
- contentItems.push({
- type: "image",
- data: img.data,
- mimeType: "image/png",
- });
+ contentItems.push({ type: "text", text: `\n📷 ${img.context}` });
+ contentItems.push({ type: "image", data: img.data, mimeType: "image/png" });
}
return { content: contentItems };