lc-mcp v0.5: 语义化操控(MCP stdio) — OCR文本化+语义点击, win/linux/mac 截图与输入后端

Browse Source
This commit is contained in:
yws
2026-10-01 16:37:33 +00:00
commit 0db14040b7
15 changed files with 1124 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""macOS 截图提供者:screencapture CLI (系统自带)。"""
import os
import subprocess
import tempfile
import time
class MacScreenshotProvider:
def grab(self):
path = os.path.join(tempfile.gettempdir(), 'lc_shot_%s.png' % time.strftime('%H%M%S'))
try:
subprocess.run(['screencapture', '-x', path], check=True, timeout=20)
if os.path.exists(path):
return {'ok': True, 'path': path}
except Exception as e:
return {'ok': False, 'error': 'screencapture fail: %s' % e}
return {'ok': False, 'error': 'no png produced'}