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-bridge

v0.1.0

Published

stdio to Streamable HTTP bridge for the AutoJs6 MCP Server plugin: lets stdio-only MCP clients such as Claude Desktop reach the phone

Readme

autojs6-mcp-bridge

Language: English | 简体中文

A small stdio to Streamable HTTP bridge for the AutoJs6 MCP Server plugin. MCP clients that can only launch stdio servers (Claude Desktop, older Cursor and Cline builds, anything without an HTTP transport) start this program; it forwards every JSON-RPC message to the phone over HTTP and returns the answers.

The bridge does not add tools, permissions or state of its own. The token and the phone-side pairing of the plugin still apply, and the phone still asks you to allow each new client.

Requirements

  • Node.js 18 or newer.
  • The AutoJs6 MCP Server plugin switched on in the AutoJs6 drawer, and its token copied from the plugin settings page.
  • For USB: Android platform-tools (adb) on the PATH or passed with --adb.

Install

npm install -g autojs6-mcp-bridge
autojs6-mcp-bridge --version

npx autojs6-mcp-bridge works too, but clients start the bridge on every session, so a global install keeps startup fast.

Usage

autojs6-mcp-bridge [options]

  --url <url>          Endpoint of the phone (default: http://127.0.0.1:9637/mcp)
  --serial <serial>    Run "adb -s <serial> forward" for the endpoint port and remove it on exit
  --forward            Run "adb forward" without -s (single device or emulator)
  --adb <path>         adb executable (default: adb on the PATH, or AUTOJS6_MCP_ADB)
  --protocol <date>    Request this MCP protocol version from the phone instead of the client's
  --token <token>      Bearer token; prefer the AUTOJS6_MCP_TOKEN environment variable
  -h, --help           Show this help
  -v, --version        Show the version

The token is read from AUTOJS6_MCP_TOKEN first so that it does not appear in process listings; --token is accepted for one-off use and prints a warning. --serial and --forward require a loopback --url; over Wi-Fi pass the address shown on the plugin settings page and leave forwarding off.

Client configuration

The plugin settings page copies the HTTP configuration for clients that support it. For stdio-only clients, point them at this bridge instead.

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "autojs6": {
      "command": "autojs6-mcp-bridge",
      "args": ["--serial", "<serial from adb devices>"],
      "env": {
        "AUTOJS6_MCP_TOKEN": "<token>"
      }
    }
  }
}

Claude Code (stdio fallback when the HTTP transport cannot be used):

claude mcp add autojs6 -e AUTOJS6_MCP_TOKEN=<token> -- autojs6-mcp-bridge --serial <serial>

Any other stdio client: command autojs6-mcp-bridge, arguments as above, and AUTOJS6_MCP_TOKEN in the environment block of its configuration. Over Wi-Fi replace --serial <serial> with --url http://<phone-address>:9637/mcp.

How it works

  • The client's stdin / stdout carry newline-delimited JSON-RPC (the MCP stdio transport); the bridge uses the official MCP SDK transports on both sides.
  • Each message is POSTed to the phone with Authorization: Bearer <token>, the Mcp-Session-Id returned by the phone and the negotiated MCP-Protocol-Version. Responses arrive as JSON or as SSE and are written back to stdout unchanged. The phone's own errors, such as PAIRING_REQUIRED on the first call of a new client, pass through as they are; accept the pairing prompt on the phone and let the client retry.
  • --protocol <date> rewrites the protocolVersion of the client's initialize request. Without it the client's version is passed through and the phone negotiates as usual.
  • With --serial or --forward, the bridge runs adb forward tcp:<port> tcp:<port> before the first request and adb forward --remove when the client closes stdin or the process receives SIGINT / SIGTERM. Requests that are still on their way to the phone when stdin ends get up to 10 s to finish, so a one-shot echo '{...}' | autojs6-mcp-bridge still receives its answer.
  • The first connection through a forward that was just created can be refused or reset while the phone's listener is coming up; the bridge repeats initialize up to 4 times (500 ms apart) before reporting the failure. Later requests are never repeated, because they may have already acted on the phone.
  • When a message cannot be delivered, the client receives a JSON-RPC error (code -32000) with one readable sentence instead of a hanging request:

| Situation | Message starts with | | --- | --- | | Token rejected | 401 Unauthorized from <url>: the token was rejected. Copy it again ... | | Phone not listening or no forward | Cannot connect to <url> (connection refused): switch MCP Server on ... | | Phone unreachable over Wi-Fi | Cannot reach <url> (EHOSTUNREACH): the phone is not reachable on this network ... | | Host header not on the allow list | 421 Misdirected Request from <url>: the Host header is not accepted ... | | Listener restarted | The connection to <url> was reset: the listener restarted ... | | adb problems at startup | adb forward tcp:9637 failed (exit 1): ... Several devices are connected: pass --serial ... (exit code 3) |

Exit codes: 0 on a normal close, 1 on an unexpected error, 2 for invalid options, 3 when adb forward fails.

Compatibility

| Bridge | Plugin | MCP protocol requested by the bridge | Node.js | Verified clients | | --- | --- | --- | --- | --- | | 0.1.0 | AutoJs6 MCP Server 1.0.0 | passes the client's version through (the plugin negotiates 2025-06-18 or older); --protocol overrides it | 18 or newer (engines); tested with 24.15 | Claude Code 2.1.257 (stdio, claude mcp add ... -- autojs6-mcp-bridge --serial <serial>) |

Keep this table in step with the plugin README; both sides list it.

Security

  • The token authorizes full control of the phone through the plugin. Keep it in the environment block of the client configuration, not in shell history or process arguments, and rotate it from the plugin settings page if it leaks.
  • The bridge talks plain HTTP to the phone. Over USB the traffic stays on the adb forward; over Wi-Fi use a trusted network and the addresses listed on the plugin settings page.
  • Only stderr carries diagnostics; stdout is reserved for the protocol. The token is never logged.

Development

npm install
npm test          # builds dist/ and runs node --test
npm run pack:check

Tests cover option parsing, the adb forward lifecycle with a fake runner, the error mapping, and the message flow against a local fake phone (protocol passthrough and rewrite, session id and protocol headers, 401 and connection refused mapping, session termination on close).

License

Mozilla Public License 2.0.

Links

  • Plugin: https://github.com/SuperMonster003/AutoJs6-Plugin-MCP-Server
  • AutoJs6: https://github.com/SuperMonster003/AutoJs6
  • MCP specification: https://modelcontextprotocol.io/specification