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
+31
View File
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
"""Mock 后端:记录动作,无真实输入。开发/测试用。"""
import time
class MockBackend:
def __init__(self, log=None):
self.log = log if log is not None else []
self._screen = (1920, 1080)
def click(self, x, y, button='left', clicks=1):
self.log.append({'act': 'click', 'x': int(x), 'y': int(y),
'button': button, 'clicks': int(clicks)})
time.sleep(0.02)
return {'ok': True, 'clicked': [int(x), int(y)], 'backend': 'mock'}
def move(self, x, y):
self.log.append({'act': 'move', 'x': int(x), 'y': int(y)})
time.sleep(0.01)
return {'ok': True, 'backend': 'mock'}
def keypress(self, key):
self.log.append({'act': 'keypress', 'key': str(key)})
time.sleep(0.01)
return {'ok': True, 'key': str(key), 'backend': 'mock'}
def type_text(self, text):
self.log.append({'act': 'type_text', 'text': str(text)})
time.sleep(0.01 * len(text))
return {'ok': True, 'typed': str(text), 'backend': 'mock'}