Skip to main content
Glama

MQScript MCP Server

by allegiant
README.md4.72 kB
# MQScript MCP Server 一个基于 Model Context Protocol (MCP) 的 MQScript 移动自动化脚本语言服务器。 ## 概述 本项目提供了一个全面的 MCP 服务器,支持 MQScript 移动自动化脚本语言的所有主要功能。通过这个服务器,AI 应用可以轻松生成和执行 MQScript 代码,用于移动设备自动化操作。 ## 支持的功能 ### 基础命令 (Basic Commands) - **触摸命令**: Tap, Touch, Swipe, KeyPress 等触摸操作 - **控制命令**: Delay, For, If, While, Dim 等流程控制 - **颜色命令**: GetPixelColor, FindColor, CmpColor 等颜色检测 - **其他命令**: ShowMessage, TracePrint, RunApp, InputText 等 ### 标准库函数 (Standard Library) - **数学函数**: Abs, Sin, Cos, Tan, Sqr, Rnd 等数学运算 - **字符串函数**: Len, Left, Right, Mid, InStr, Replace, UCase, LCase 等字符串处理 - **类型转换函数**: CInt, CStr, CBool, IsNumeric 等类型转换 - **数组函数**: UBound, Split, Join 等数组操作 ### 界面命令 (UI Commands) - **UI 控件**: NewLayout, AddTextView, AddEditText, AddButton, AddCheckBox 等控件创建 - **UI 属性**: SetText, GetText, SetEnabled, SetVisible 等属性设置 - **悬浮窗**: Create, Show, Hide, AddTextView, AddButton, SetText, OnClick 等悬浮窗操作 ### 扩展命令 (Extension Commands) - **元素操作**: Element.GetText, Element.Click, Element.SetText, Element.Exists 等元素操作 - **设备操作**: Device.GetInfo, Device.Vibrate, Device.SetBrightness, Device.SetVolume 等设备控制 - **电话操作**: Phone.Call, Phone.SendSMS, Phone.GetCallState 等电话功能 - **系统操作**: Sys.Exit, Sys.GetTime, Sys.Shell, Sys.GetEnv, Sys.SetEnv, Sys.Sleep 等系统功能 ### 插件命令 (Plugin Commands) - **JSON 操作**: CJson.Parse, CJson.Stringify, CJson.Get, CJson.Set 等 JSON 处理 - **日期时间**: DateTime.Now, DateTime.Format, DateTime.AddDays, DateTime.Compare 等日期时间操作 - **文件操作**: File.Read, File.Write, File.Exists, File.Delete, File.Copy 等文件处理 - **图灵机器人**: TURING.Chat, TURING.SetConfig 等 AI 对话功能 ## 安装和使用 ### 安装依赖 ```bash npm install ``` ### 编译项目 ```bash npm run build ``` ### 启动服务器 ```bash npm start ``` ### 开发模式 ```bash npm run dev ``` ## MCP 客户端配置 在支持 MCP 的客户端中,添加以下配置: ```json { "mcpServers": { "mqscript": { "command": "node", "args": ["path/to/mcp-mqscript-server/build/index.js"], "env": {} } } } ``` ## 工具示例 ### 基础触摸操作 ```javascript // 点击屏幕坐标 mqscript_touch_tap({ x: 100, y: 200, duration: 100 }) // 滑动操作 mqscript_touch_swipe({ x1: 100, y1: 200, x2: 300, y2: 400, duration: 500 }) ``` ### 颜色检测 ```javascript // 获取像素颜色 mqscript_color_getpixelcolor({ x: 100, y: 200, resultVariable: "pixelColor" }) // 查找颜色 mqscript_color_findcolor({ x1: 0, y1: 0, x2: 720, y2: 1280, color: "0xFF0000", resultVariable: "redPixelPos" }) ``` ### UI 界面创建 ```javascript // 创建布局 mqscript_ui_newlayout({ orientation: "vertical" }) // 添加按钮 mqscript_ui_addbutton({ id: "btn1", text: "Click Me" }) // 显示界面 mqscript_ui_show({ title: "My App" }) ``` ### 文件操作 ```javascript // 读取文件 mqscript_file_read({ filePath: "/sdcard/data.txt", encoding: "UTF-8", resultVariable: "fileContent" }) // 写入文件 mqscript_file_write({ filePath: "/sdcard/output.txt", content: "Hello, World!", encoding: "UTF-8", append: false }) ``` ## 项目结构 ``` mcp-mqscript-server/ ├── src/ │ ├── tools/ │ │ ├── basic-commands.ts # 基础命令 │ │ ├── standard-library.ts # 标准库函数 │ │ ├── ui-commands.ts # 界面命令 │ │ ├── extension-commands.ts # 扩展命令 │ │ └── plugin-commands.ts # 插件命令 │ └── index.ts # 主服务器文件 ├── build/ # 编译输出目录 ├── package.json # 项目配置 ├── tsconfig.json # TypeScript 配置 └── README.md # 项目文档 ``` ## 技术栈 - **TypeScript**: 类型安全的 JavaScript 超集 - **Model Context Protocol SDK**: MCP 协议的官方 SDK - **Zod**: 运行时类型验证库 - **Node.js**: JavaScript 运行时环境 ## 许可证 MIT License ## 贡献 欢迎提交 Issue 和 Pull Request 来改进这个项目。 ## 支持 如果你在使用过程中遇到问题,请提交 Issue 或联系维护者。

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/allegiant/MQScript_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server