MQScript MCP Server
Enables AI applications to generate and execute MQScript mobile automation scripts for controlling mobile devices. Supports touch operations, UI creation, color detection, file operations, and system control functions.
README
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 对话功能
安装和使用
安装依赖
npm install
编译项目
npm run build
启动服务器
npm start
开发模式
npm run dev
MCP 客户端配置
在支持 MCP 的客户端中,添加以下配置:
{
"mcpServers": {
"mqscript": {
"command": "node",
"args": ["path/to/mcp-mqscript-server/build/index.js"],
"env": {}
}
}
}
工具示例
基础触摸操作
// 点击屏幕坐标
mqscript_touch_tap({
x: 100,
y: 200,
duration: 100
})
// 滑动操作
mqscript_touch_swipe({
x1: 100,
y1: 200,
x2: 300,
y2: 400,
duration: 500
})
颜色检测
// 获取像素颜色
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 界面创建
// 创建布局
mqscript_ui_newlayout({
orientation: "vertical"
})
// 添加按钮
mqscript_ui_addbutton({
id: "btn1",
text: "Click Me"
})
// 显示界面
mqscript_ui_show({
title: "My App"
})
文件操作
// 读取文件
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 或联系维护者。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.