mnehmos.oda.mcp(v1.0.0)
](https://www.npmjs.com/package/mnehmos.ooda.mcp) 
一个全面的MCP(模型上下文协议)服务器,为Claude提供完整的计算机控制功能。实现OODA循环(Observe Orient Decide Act)模式,用于自主计算机交互。
特性
| 类别 | 工具 | 描述 |
|---|---|---|
| CLI和文件 | 23 | Shell命令、文件读/写/复制/移动/删除、搜索、差异编辑 |
| CRUD数据库 | 9 | 具有集合的持久SQLite键值存储 |
| 屏幕(观察) | 4 | 屏幕截图、显示信息、屏幕变化检测 |
| 输入(动作) | 10 | 键盘输入/快捷键、鼠标移动/点击/拖动/滚动 |
| 窗口管理 | 11 | 列出/聚焦/最小化/最大化/关闭窗口,启动应用程序 |
| 剪贴板 | 4 | 读/写文本、HTML、图像 |
| 系统 | 8 | 系统信息、进程、网络、通知 |
| 浏览器 | 9 | 木偶师/剧作家自动化 |
| 会话 | 5 | 交互式进程会话(REPL、SSH) |
| 配置和分析 | 7 | 配置管理、使用统计 |
| 搜索 | 4 | 分页文件搜索 |
| 通用批次 | 1 | 适用于任何工具的通用批处理调度器 |
总计:100个工具 大多数操作都支持批处理/并行执行。
安全警告
此服务器提供 不受限制的系统访问克劳德将能够:
- 执行任意shell命令
- 控制键盘和鼠标
- 截图
- 在任何地方读/写文件
- 管理窗口和进程
仅在受信任的环境中使用,风险自负。
安装
来自npm(推荐)
npm install -g mnehmos.ooda.mcp来源
git clone https://github.com/Mnehmos/mnehmos.ooda.mcp.git
cd mnehmos.ooda.mcp
npm install
npm run buildClaude桌面配置
添加到您的Claude Desktop配置文件中:
视窗: %APPDATA%\Claude\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
如果通过npm安装:
{
"mcpServers": {
"ooda-computer": {
"command": "npx",
"args": ["mnehmos.ooda.mcp"]
}
}
}如果从源代码安装:
{
"mcpServers": {
"ooda-computer": {
"command": "node",
"args": ["/absolute/path/to/mnehmos.ooda.mcp/dist/index.js"]
}
}
}OODA循环模式
这些工具是围绕OODA(Observe Orient Decide Act)循环设计的:
观察
screenshot-捕获屏幕或区域(返回base64或保存到文件)get_screen_info-获取显示/监视器信息wait_for_screen_change-检测屏幕内容何时更改list_windows-查看所有打开的应用程序get_active_window-了解当前焦点clipboard_read-检查剪贴板内容
东方
- 使用CRUD工具存储/检索上下文和状态
file_info,search_files-了解文件系统状态list_processes,get_system_info-了解系统状态
决定
- 克劳德在观察之间的推理
- 用于持久决策上下文的CRUD数据库
法案
keyboard_type,keyboard_shortcut-键入并使用热键mouse_click,mouse_move,mouse_drag-鼠标控制focus_window,launch_application-窗口控制clipboard_write-设置剪贴板内容notify-系统通知
通用批处理调度器
这 batch_tools 调度员可以在具有统一安全限制的批处理模式下执行任何工具:
{
"tool": "batch_tools",
"args": {
"operations": [
{ "tool": "read_file", "args": { "path": "src/index.ts" }, "label": "main" },
{ "tool": "file_info", "args": { "path": "package.json" }, "label": "pkg" },
{ "tool": "exec_cli", "args": { "command": "git status --short" }, "label": "git" }
],
"executionMode": "parallel"
}
}执行模式
| 模式 | 描述 |
|---|---|
parallel | 所有操作同时运行(默认) |
sequential | 操作一个接一个运行,支持 stopOnError |
安全限值
可配置 ~/.mcp/config.json 或根据请求:
| 限制 | 默认值 | 描述 |
|---|---|---|
maxOperations | 50 | 每批最多操作次数 |
maxAggregateChars | 200000 | 总输出大小限制 |
maxLinesPerFile | 500 | 每文件行截断 |
timeout | 30000 | 每次操作超时(毫秒) |
看 ADR-003 获取完整文档。
API 参考
CLI和文件操作
| 工具 | 说明 |
|---|---|
exec_cli | 执行shell命令 |
read_file | 读取文件内容 |
write_file | 将内容写入文件 |
list_directory | 列出目录内容 |
read_file_lines | 读取特定行范围(令牌高效) |
search_in_file | 在文件中搜索模式 |
str_replace | 替换文件中的唯一字符串 |
copy_file | 复制文件/目录 |
move_file | 移动/重命名文件 |
delete_file | 删除文件/目录 |
file_info | 获取文件元数据 |
search_files | 按模式搜索文件 |
batch_* | 上述的并行版本 |
基于差异的编辑
| 工具 | 说明 |
|---|---|
edit_block | 搜索/替换为模糊匹配回退 |
apply_diff | 原子操作中的多次搜索/替换 |
get_diff_preview | 预览更改而不应用 |
batch_edit_blocks | 部分成功的顺序编辑 |
write_from_line | 将N行内容替换为EOF |
CRUD操作
| 工具 | 说明 |
|---|---|
crud_create | 在集合中创建记录 |
crud_read | 按ID读取记录 |
crud_update | 更新现有记录 |
crud_delete | 删除记录 |
crud_query | 使用筛选器进行查询 |
crud_batch_* | 并行版本 |
屏幕操作
| 工具 | 说明 |
|---|---|
screenshot | 捕获屏幕(区域可选) |
get_screen_info | 显示/监控信息 |
wait_for_screen_change | 等待UI更改 |
find_on_screen | 查找文本/图像(需要OCR) |
输入操作
| 工具 | 说明 |
|---|---|
keyboard_type | 键入文本 |
keyboard_press | 按带有修改器的键 |
keyboard_shortcut | 执行快捷键(例如“ctrl+c”) |
mouse_move | 移动光标 |
mouse_click | 点击位置 |
mouse_drag | 点之间的拖动 |
mouse_scroll | 滚轮 |
get_mouse_position | 当前光标位置 |
batch_keyboard_actions | 键盘动作顺序 |
batch_mouse_actions | 鼠标动作顺序 |
窗口操作
| 工具 | 说明 |
|---|---|
list_windows | 所有打开的窗户 |
get_active_window | 当前聚焦窗口 |
focus_window | 把窗户放在前面 |
minimize_window | 最小化窗口 |
maximize_window | 最大化窗口 |
restore_window | 从最小值/最大值恢复 |
close_window | 关闭窗口 |
resize_window | 调整窗口大小 |
move_window | 移动车窗位置 |
launch_application | 启动应用程序 |
wait_for_window | 等待窗口出现 |
剪贴板操作
| 工具 | 说明 |
|---|---|
clipboard_read | 读取文本/HTML/图像 |
clipboard_write | 编写文本/HTML |
clipboard_clear | 清除剪贴板 |
clipboard_has_format | 检查格式可用性 |
系统操作
| 工具 | 说明 |
|---|---|
get_system_info | 操作系统、CPU、内存、正常运行时间 |
list_processes | 正在运行的进程 |
kill_process | 按PID或名称杀死 |
get_environment | 环境变量 |
set_environment | 设置环境变量 |
get_network_info | 网络接口 |
wait | 睡眠毫秒 |
notify | 系统通知 |
浏览器自动化
| 工具 | 说明 |
|---|---|
launch_browser | 启动Puppeteer/Playwright浏览器 |
close_browser | 关闭浏览器实例 |
navigate_page | 导航到URL |
get_page_content | 获取页面HTML/text/markdown |
click_element | 按选择器单击元素 |
type_text | 在输入框中键入 |
evaluate_js | 执行JavaScript |
screenshot_page | 捕获页面截图 |
get_console_logs | 获取浏览器控制台日志 |
交互式会话
| 工具 | 说明 |
|---|---|
start_process | 启动交互式进程(REPL、SSH) |
interact_with_process | 向流程发送输入 |
read_process_output | 读取进程stdout |
list_sessions | 列出活动会话 |
terminate_process | 结束进程会话 |
批量操作
大多数工具都有用于并行执行的专用批处理版本:
batch_exec_cli - Multiple commands in parallel
batch_read_files - Multiple files in parallel
batch_write_files - Multiple files in parallel
batch_copy_files - Multiple copies in parallel
crud_batch_create - Multiple records in parallel
...或者使用通用 batch_tools 调度员批量处理任何工具。
批处理操作返回结构化结果:
{
"summary": { "total": 5, "successful": 4, "failed": 1, "elapsed_ms": 23 },
"results": [
{ "index": 0, "success": true, "result": {...} },
{ "index": 1, "success": false, "error": "..." }
]
}平台支持
| 功能 | Windows | macOS | Linux |
|---|---|---|---|
| CLI/文件 | ✅ | ✅ | ✅ |
| 积垢 | ✅ | ✅ | ✅ |
| 屏幕截图 | ✅ PowerShell | ✅ 屏幕截图 | ✅ 阴囊 |
| 键盘 | ✅ 发送密钥 | ✅ osascript | ✅ xdotool |
| 老鼠✅ 用户32.dll | ⚠️ 有限 | ✅ xdotool | |
| Windows | ✅ 用户32.dll | ✅ osascript | ✅ wmctrl |
| 剪贴板 | ✅ PowerShell | ✅ pb复制/粘贴 | ✅ xclip |
配置
可选配置文件位于 ~/.mcp/config.json:
{
"storage": {
"type": "sqlite",
"path": "~/.mcp/workspace.db"
},
"cliPolicy": {
"mode": "allow-all",
"extraBlockedPatterns": [],
"timeoutMs": 30000
},
"crud": {
"defaultLimit": 1000
},
"fileReading": {
"maxLines": 500,
"warnAtLines": 100
},
"batchOperations": {
"maxOperations": 50,
"maxAggregateChars": 200000,
"maxLinesPerFile": 500,
"defaultTimeout": 30000,
"toolLimits": {
"exec_cli": { "maxOperations": 20, "timeout": 60000 }
}
}
}发展
npm install # Install dependencies
npm run build # Build TypeScript
npm run dev # Watch mode
npm test # Run tests
npm start # Run server已知限制
find_on_screen需要额外的OCR依赖项(不包括在内)- macOS鼠标位置读取返回0,0(系统限制)
- 某些鼠标拖动操作可能需要特定于平台的调整
许可证
MIT许可证-请参阅 许可证 文件。
更新日志
看 更改日志.md 版本历史。
