Files
lc-mcp/README.md
T

68 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# lc-mcp — Limbus Company 语义化操控 MCP server (跨平台)
给 AI agent (codex / deepseek / 任意 MCP 客户端) 提供**语义化**游戏操控,
解决"盲看屏幕猜坐标→思考慢、点错率高"。
## 核心设计
AI 不用猜坐标。工具层做"文本化 + 语义点击":
```
get_state() -> 截图+远端OCR:全屏文字元素 + 坐标
click_text("开始") -> 内部 OCR 定位"开始"并点击中心
wait_for_text("结算") -> 轮询直到文字出现/消失
```
任务循环: `get_state -> 决策 -> click_text -> wait_for_text -> 确认 -> 下一步`
## 平台矩阵
| 平台 | 截图 | 输入后端 | 备注 |
|------|------|----------|------|
| win | 交互计划任务 | `sendinput`(默认) / `interception`(物理HID级) | interception 需装驱动+重启 |
| linux | X11 PIL / scrot | `xdotool` / `uinput`(内核虚拟设备,物理级) | uinput 需 root 或 uinput 组 |
| mac | screencapture | `cg`(CGEvent, PyObjC) | 需辅助功能权限 |
`LCP_PLATFORM=win|linux|mac` 强制指定,默认按系统自动检测。
OCR 全本地:`ocr_local.py` 调 Windows 自带 OCR(Windows.Media.Ocr,需 `pip install --user winsdk`)。
无任何云端/远端服务依赖——MCP 是纯本地"外骨骼"。
## 部署
1. 拷贝 `lc-mcp-dev/` 到目标机器
2. 装依赖(只用标准库;linux xdotool 后端需 `apt install xdotool`;mac cg 需 `pip install pyobjc-framework-Quartz`)
3. 启动:`python lc_mcp.py`(stdio),MCP 客户端 spawn
```jsonc
// codex MCP 配置 (codex/mcp.json 或项目 .mcp.json)
{
"mcpServers": {
"limbus": {
"type": "stdio",
"command": "ssh",
"args": ["win", "python", "C:/Users/yws-hhh/lc-mcp-dev/lc_mcp.py"],
"env": { "INPUT_BACKEND": "interception" }
}
}
}
```
## 环境变量
| 变量 | 默认 | 说明 |
|------|------|------|
| `LCP_PLATFORM` | 自动 | win/linux/mac |
| `INPUT_BACKEND` | 平台默认 | mock/sendinput/interception/xdotool/uinput/cg |
| `OCR_BACKEND` | local | 本地 OCR(仅 local;Win 需 winsdk) |
| `OCR_MIN_SCORE` | 0.5 | 过滤低置信度 OCR 结果 |
## 工具
get_state · click_text · wait_for_text · wait_for_text_gone · screenshot · click · move · keypress · type_text
## 安全提醒
- 输入会真实操作你已登录的桌面,跑任务时别动鼠标
- win 的截图走交互计划任务(Registry + wscript),杀软可能告警
- interception/uinput 是"物理化"输入,用于降低虚拟输入痕迹;真·硬件级可外接 Arduino/RPi Pico HID