mcp-android-emulator 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ async function shell(command) {
41
41
  // Create MCP server
42
42
  const server = new McpServer({
43
43
  name: "android-emulator",
44
- version: "1.2.1",
44
+ version: "1.2.2",
45
45
  });
46
46
  // =====================================================
47
47
  // TOOL: screenshot
@@ -917,15 +917,14 @@ server.tool("set_clipboard", "Set text to the device clipboard", {
917
917
  // Try multiple paths for compatibility (standard emulators vs Redroid/Docker)
918
918
  const paths = ["/data/local/tmp/clipboard_temp.txt", "/sdcard/clipboard_temp.txt"];
919
919
  let success = false;
920
- let usedPath = "";
921
920
  for (const clipPath of paths) {
922
921
  try {
923
- await shell(`echo "${base64Text}" | base64 -d > ${clipPath}`);
922
+ // Use single quotes to ensure the entire command runs on device (pipe included)
923
+ await shell(`'echo "${base64Text}" | base64 -d > ${clipPath}'`);
924
924
  // Verify write succeeded
925
- const verify = await shell(`cat ${clipPath} 2>/dev/null | head -c 10`);
926
- if (verify.length > 0) {
925
+ const verify = await shell(`cat ${clipPath} 2>/dev/null`);
926
+ if (verify && verify.length > 0) {
927
927
  success = true;
928
- usedPath = clipPath;
929
928
  break;
930
929
  }
931
930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-android-emulator",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "MCP Server for Android Emulator interaction via ADB - enables AI assistants to control Android devices",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -47,7 +47,7 @@ async function shell(command: string): Promise<string> {
47
47
  // Create MCP server
48
48
  const server = new McpServer({
49
49
  name: "android-emulator",
50
- version: "1.2.1",
50
+ version: "1.2.2",
51
51
  });
52
52
 
53
53
  // =====================================================
@@ -1194,16 +1194,15 @@ server.tool(
1194
1194
  // Try multiple paths for compatibility (standard emulators vs Redroid/Docker)
1195
1195
  const paths = ["/data/local/tmp/clipboard_temp.txt", "/sdcard/clipboard_temp.txt"];
1196
1196
  let success = false;
1197
- let usedPath = "";
1198
1197
 
1199
1198
  for (const clipPath of paths) {
1200
1199
  try {
1201
- await shell(`echo "${base64Text}" | base64 -d > ${clipPath}`);
1200
+ // Use single quotes to ensure the entire command runs on device (pipe included)
1201
+ await shell(`'echo "${base64Text}" | base64 -d > ${clipPath}'`);
1202
1202
  // Verify write succeeded
1203
- const verify = await shell(`cat ${clipPath} 2>/dev/null | head -c 10`);
1204
- if (verify.length > 0) {
1203
+ const verify = await shell(`cat ${clipPath} 2>/dev/null`);
1204
+ if (verify && verify.length > 0) {
1205
1205
  success = true;
1206
- usedPath = clipPath;
1207
1206
  break;
1208
1207
  }
1209
1208
  } catch {