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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: querry response anthropic MCP (#1014)
Vivek Kumar7da94cbf3cd7
diff --git a/screenpipe-integrations/screenpipe-mcp/README.md b/screenpipe-integrations/screenpipe-mcp/README.mdindex 503ce983d..3654dea09 100644--- a/screenpipe-integrations/screenpipe-mcp/README.md+++ b/screenpipe-integrations/screenpipe-mcp/README.md@@ -3,6 +3,8 @@### 1. Configure Claude DesktopEdit `~/Library/Application Support/Claude/claude_desktop_config.json`:+- Windows: `notepad $env:AppData\Claude\claude_desktop_config.json`+- Mac: `code ~/Library/Application Support/Claude/claude_desktop_config.json````json{@@ -19,6 +21,8 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:}}```+Note: Restart Claude Desktop after making changes.+### 2. Test the Serverdiff --git a/screenpipe-integrations/screenpipe-mcp/src/screenpipe_mcp/server.py b/screenpipe-integrations/screenpipe-mcp/src/screenpipe_mcp/server.pyindex e1a975cc5..8108f4968 100644--- a/screenpipe-integrations/screenpipe-mcp/src/screenpipe_mcp/server.py+++ b/screenpipe-integrations/screenpipe-mcp/src/screenpipe_mcp/server.py@@ -7,6 +7,9 @@ from mcp.server.models import InitializationOptionsimport mcp.types as typesimport mcp.server.stdio+import json++# Enable nested event loops (needed for some environments)nest_asyncio.apply()@@ -32,7 +35,7 @@ async def handle_list_tools() -> list[types.Tool]:},"content_type": {"type": "string",- "enum": ["all", "ocr", "audio", "ui"],+ "enum": ["all","ocr", "audio","ui"],"description": "Type of content to search","default": "all"},@@ -88,9 +91,10 @@ async def handle_call_tool(if name == "search-content":async with httpx.AsyncClient() as client:+ # Define the order of content types to try+ results = []# Build query parameters- params = {k: v for k, v in arguments.items() if v is not None}-+ params = {k: v for k, v in arguments.items() if v is not None}# Make request to screenpipe APItry:response = await client.get(@@ -99,15 +103,24 @@ async def handle_call_tool(timeout=30.0)response.raise_for_status()- data = response.json()+ try:+ data = json.loads(response.text)+ except json.JSONDecodeError as json_error:+ return [types.TextContent(+ type="text",+ text=f"failed to parse JSON response: {json_error}"+ )]+ results.extend(data.get("data", []))++except Exception as e:+ print(f"Exception: {str(e)}")return [types.TextContent(type="text",text=f"failed to search screenpipe: {str(e)}")]-+# Format results- results = data.get("data", [])if not results:return [types.TextContent(type="text",@@ -121,7 +134,7 @@ async def handle_call_tool(continuecontent = result["content"]- if content.get("type") == "OCR":+ if result.get("type") == "OCR":text = (f"OCR Text: {content.get('text', 'N/A')}\n"f"App: {content.get('app_name', 'N/A')}\n"@@ -129,14 +142,14 @@ async def handle_call_tool(f"Time: {content.get('timestamp', 'N/A')}\n""---\n")- elif content.get("type") == "Audio":+ elif result.get("type") == "Audio":text = (f"Audio Transcription: {content.get('transcription', 'N/A')}\n"f"Device: {content.get('device_name', 'N/A')}\n"f"Time: {content.get('timestamp', 'N/A')}\n""---\n")- elif content.get("type") == "UI":+ elif result.get("type") == "UI":text = (f"UI Text: {content.get('text', 'N/A')}\n"f"App: {content.get('app_name', 'N/A')}\n"@@ -148,7 +161,7 @@ async def handle_call_tool(continueformatted_results.append(text)-+return [types.TextContent(type="text",text="Search Results:\n\n" + "\n".join(formatted_results)@@ -174,3 +187,4 @@ async def run():if __name__ == "__main__":asyncio.run(run())+