
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@mtop-devtools/client
Advanced tools
Client SDK & CLI for Mtop DevTools — communicate with Chrome Extension via Unix Socket
本地客户端 SDK 与 CLI,通过 Unix Domain Socket 与 Chrome 扩展的 native host 通信,调用浏览器调试与操作能力。
提供两种用法:类型安全的具名方法(getRequests、proxyRequest 等),以及灵活的底层 invoke(action, payload)。
npm install @mtop-devtools/client
# 或
pnpm add @mtop-devtools/client
import * as client from '@mtop-devtools/client';
// 具名方法(类型安全)
const requests = await client.getRequests({ count: 5 });
const result = await client.proxyRequest({
url: 'https://api.example.com',
method: 'GET',
withCookies: true,
});
// 底层通用方法(灵活扩展)
const data = await client.invoke('proxy_request', { url: '...' });
安装后提供 mtop-devtools 命令:
# 获取最近 5 个请求
mtop-devtools get_requests --payload '{"count":5}'
# 代理一个 HTTP 请求
mtop-devtools proxy_request --payload '{"url":"https://api.example.com","method":"GET"}'
# 截图并保存
mtop-devtools get_screenshot --output ./screenshot.png
# 从文件读取大体积参数(如 mock 数据)
mtop-devtools set_mock --payload-file ./mock-data.json
# 环境自检
mtop-devtools check
# 查看某个 action 的帮助
mtop-devtools <action> --help
通用选项:
| 选项 | 说明 |
|---|---|
--payload <json> | 直接传入 JSON 参数 |
--payload-file <path> | 从文件读取 JSON 参数 |
--timeout <seconds> | 请求超时时间 |
--compact | 紧凑输出 |
--output <path> | 将结果写入文件(如截图) |
| 分类 | Actions |
|---|---|
| API 调试 | get_requests get_logs get_events get_api_schema |
| Mock & 规则 | set_mock get_mocks add_rule |
| 网络代理 | proxy_request send_mtop_request |
| 标签页 | tab_open tab_close tab_list |
| 页面操作 | page_click page_type page_scroll page_eval page_press page_wait page_navigate page_upload |
| 页面感知 | page_snapshot get_screenshot get_selected_element page_frames |
| 移动端模拟 | set_device_emulation |
| 用户信息 | get_user_info |
| 录制 | record_start record_stop record_get |
| TDBank | tdbank_account |
@mtop-devtools/client (CLI / SDK)
↓ (Unix Socket)
@mtop-devtools/native-host
↓ (Native Messaging)
Chrome Extension / CDP
云端远程调用场景请使用 @mtop-devtools/cloud-client,其操作集与本包完全一致。
pnpm build # tsc 编译到 dist/,并赋予 cli.js 执行权限
pnpm dev # tsc --watch
pnpm typecheck # 仅类型检查
ISC
FAQs
Client SDK & CLI for Mtop DevTools — communicate with Chrome Extension via Unix Socket
The npm package @mtop-devtools/client receives a total of 62 weekly downloads. As such, @mtop-devtools/client popularity was classified as not popular.
We found that @mtop-devtools/client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.