npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

autojs6-mcp

v0.2.0

Published

MCP server for AutoJs6 remote control (DevPlugin protocol) and ADB workflows

Readme

AutoJs6 MCP

AutoJs6 MCP 是一个基于 stdio 的 MCP Server,把 AutoJs6 的远程控制能力(DevPlugin TCP 协议,端口 7347)与常用 ADB 工作流暴露给支持 MCP 的客户端(Claude Code、Codex 等)。

AutoJs6 是原 Auto.js / autox.js 系列的活跃维护 fork。远程控制走的是 原始 TCP socket + 二进制分帧 JSON 协议(不是 HTTP),本 Server 完整实现了该协议。

功能概览

  • run_script:在设备上运行一段内联 JavaScript,返回 sessionId
  • stop_script:按 sessionId 停止脚本
  • stop_all:停止设备上所有脚本
  • save_script:把脚本内容保存到设备工作目录
  • run_project:把本地项目目录打成 zip 推送到设备并运行(自动排除 node_modules/.git/build/dist 等,并读取 project.jsonignore 列表;内置 16 MB zip 上限以防设备 OOM)
  • read_logs:读取会话的增量日志
  • list_devices / connect_device / adb_command:常用 ADB 工作流
  • forward_port:为 USB/模拟器设备建立 adb forward tcp:7347 tcp:7347
  • push_directory:递归 push 本地目录到设备,逐文件上传 + 自动 mkdir -p,规避 adb push dir dir/ 在目标已存在时嵌套成 dir/dir/ 的坑

API 文档检索(编写脚本前必查)

docs/ 内置了 AutoJs6 6.6.4 官方 API 文档(约 90 个模块)。编写或调试脚本前,应先调用以下工具查阅文档,按文档中的签名与示例编写,不要凭记忆臆测 API(AutoJs6 是 Auto.js 系列的活跃 fork,API 与老版本有差异):

  • list_docs:列出所有可用的文档模块(app / device / floaty / automator / image / ocr / ui / global / http / shell …)
  • search_docs({ query, limit? }):按关键词搜索方法签名与片段。query 可为模块名(app)、方法名(launchPackage)、或中文词(悬浮窗
  • read_doc({ module, anchor? }):读取某模块的纯文本内容;给定 anchor 时只返回单个方法段落(签名 + 参数 + 示例)

典型流程:search_docs({ query: "launchPackage" }) → 拿到 anchor: "app_app_launchpackage_packagename" 与签名 app.launchPackage(packageName)read_doc({ module: "app", anchor: "app_app_launchpackage_packagename" }) 看完整说明 → run_script({ script: "app.launchPackage('com.tencent.mm')" })

环境要求

  • Node.js 18 及以上
  • 设备上安装 AutoJs6 并在抽屉菜单中开启「远程服务 / Remote」开关(监听 7347)
  • ADB(可选;如果 PATH 中没有,需要显式指定)

安装与使用

推荐直接通过 npx 启动:

npx -y autojs6-mcp

环境变量

  • AUTOJS6_HOST:直连 AutoJs6 DevPlugin 的 host(可选;设置后跳过 device 解析)
  • AUTOJS6_PORT:DevPlugin 端口,默认 7347
  • AUTOJS6_ADB_PATH:ADB 可执行文件路径,可选
  • AUTOJS6_DEFAULT_DEVICE:默认设备序列号或 ip:port,可选
  • AUTOJS6_CONNECT_TIMEOUT_MS:连接与握手超时,默认 6400

设备连接方式

  • Wi-Fi 设备device 形如 192.168.1.100192.168.1.100:5555):直接连 <ip>:7347
  • USB / 模拟器emulator-5554、序列号、127.0.0.1:5555):需要先 adb forward tcp:7347 tcp:7347,本 Server 在 run_script / run_project 时会自动尝试建立转发,也可手动调用 forward_port

MCP 客户端配置

Claude Code

~/.claude.json(或项目 .claude/settings.json):

{
  "mcpServers": {
    "autojs6": {
      "command": "npx",
      "args": ["-y", "autojs6-mcp"],
      "env": {
        "AUTOJS6_ADB_PATH": "C:\\Android\\platform-tools\\adb.exe",
        "AUTOJS6_DEFAULT_DEVICE": "192.168.1.100:5555"
      }
    }
  }
}

Codex

~/.codex/config.toml

[mcp_servers.autojs6]
command = "npx"
args = ["-y", "autojs6-mcp"]
env = { AUTOJS6_ADB_PATH = "C:\\Android\\platform-tools\\adb.exe", AUTOJS6_DEFAULT_DEVICE = "192.168.1.100:5555" }

macOS 示例

{
  "mcpServers": {
    "autojs6": {
      "command": "npx",
      "args": ["-y", "autojs6-mcp"],
      "env": {
        "AUTOJS6_ADB_PATH": "/opt/homebrew/bin/adb",
        "AUTOJS6_DEFAULT_DEVICE": "emulator-5554"
      }
    }
  }
}

调用示例

运行脚本

{
  "device": "192.168.1.100:5555",
  "name": "hello.js",
  "script": "toast('hello'); console.log('hi from autojs6');"
}

读取日志

{ "sessionId": "run-2026-07-03T10-00-00-000Z-1", "fromOffset": 0, "limit": 200 }

⚠️ 安全提示

AutoJs6 DevPlugin 没有鉴权,任何能连到 7347 端口的进程都可以执行任意 JavaScript。请仅在可信网络环境下开启远程服务,不要在公网暴露该端口。

本地开发

npm install
npm run check
npm run build
npm start

更多开发与发布说明见 CONTRIBUTING.md

License

MIT