autojs-pro-mcp
v0.1.1
Published
Standalone MCP server for pushing projects to Auto.js Pro
Maintainers
Readme
autojs-pro-mcp
Standalone MCP server for pushing Auto.js Pro 9.3+ projects. It does not depend on VS Code.
Supported workflow
MCP client
-> LAN discovery through _autojsprodebug._tcp (with ADB fallback)
-> Auto.js Pro ws-rpc authorization
-> incremental project synchronizationLegacy TCP 9317 devices are detected but intentionally not connected.
Install from npm
Install the published package globally or let an MCP client run it through
npx:
npm install -g autojs-pro-mcpFor MCP clients, use this configuration:
{
"mcpServers": {
"autojs": {
"command": "npx",
"args": ["-y", "autojs-pro-mcp"],
"env": {
"AUTOJS_PROJECT_DIR": "/absolute/path/to/project",
"AUTOJS_PROJECT_NAME": "my-project"
}
}
}
}The MCP process must run on the host computer with local-network permission; containerized stdio processes may not be able to access Bonjour or LAN devices.
Development
pnpm install
pnpm check
pnpm start
pnpm start:httpMCP configuration
{
"mcpServers": {
"autojs": {
"command": "node",
"args": ["/absolute/path/to/autojs-pro-mcp/dist/index.js"],
"env": {
"AUTOJS_ADB_PATH": "/absolute/path/to/platform-tools/adb",
"AUTOJS_PROJECT_DIR": "/absolute/path/to/default/project",
"AUTOJS_PROJECT_NAME": "remote-project-name"
}
}
}
}Optional environment variables:
AUTOJS_ADB_PATH: ADB executableAUTOJS_PROJECT_DIR: default project directoryAUTOJS_PROJECT_NAME: remote project directory nameAUTOJS_MCP_STATE_DIR: persistent client UUID directoryAUTOJS_REQUEST_TIMEOUT_MS: JSON-RPC timeoutAUTOJS_SYNC_TIMEOUT_MS: project synchronization timeoutAUTOJS_SCAN_TIMEOUT_MS: LAN device scan window, default 3000 msAUTOJS_MCP_HOST: standalone HTTP bind address, default127.0.0.1AUTOJS_MCP_PORT: standalone HTTP port, default32129
MCP tools
autojs_statusautojs_scan_devicesautojs_connectautojs_disconnectautojs_push_projectautojs_run_projectautojs_push_fileautojs_run_fileautojs_list_executionsautojs_stop_executionautojs_rerunautojs_get_logsautojs_clear_logsautojs_vfs_infoautojs_list_filesautojs_stat_fileautojs_watch_directoryautojs_read_fileautojs_write_fileautojs_create_directoryautojs_move_fileautojs_delete_fileautojs_download_fileautojs_download_directoryautojs_upload_directoryautojs_stop_all
Multiple devices may remain connected at the same time. Pass deviceId to bind
an operation to a specific device. autojs_get_logs supports long polling with
afterSequence and waitMs; autojs_watch_directory uses a returned snapshot
token for VFS change polling. VFS paths are confined to the root reported by
the device.
The tool scans the LAN automatically, then only pushes the directory supplied through projectDir (or
AUTOJS_PROJECT_DIR). Build and obfuscation remain the caller's responsibility;
for an already-built client, pass its artifact directory such as dist-obf.
/{script-dir} is an Auto.js Pro built-in device path and maps to
/storage/emulated/0/脚本. If remoteDir is omitted, project pushes use
/{script-dir}/{projectName} by default.
Standalone HTTP service
Start the service from iTerm so its Node process inherits iTerm's local-network permission:
AUTOJS_PROJECT_DIR=/absolute/path/to/project AUTOJS_PROJECT_NAME=my-project pnpm start:httpThe MCP endpoint is http://127.0.0.1:32129/mcp; health status is available at
http://127.0.0.1:32129/health. Override the bind address and port with
AUTOJS_MCP_HOST and AUTOJS_MCP_PORT.
