@nbakka/mcp-appium 1.0.19 → 1.0.20

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/lib/server.js +20 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Selenium WebDriver MCP Server",
5
5
  "type": "module",
6
6
  "main": "src/lib/server.js",
package/src/lib/server.js CHANGED
@@ -4,7 +4,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { z } from "zod";
6
6
  import axios from "axios";
7
-
7
+ const { exec } = require("child_process");
8
8
  const APPIUM_URL = "http://127.0.0.1:4723"; // Corrected endpoint for Appium 2.x
9
9
 
10
10
  const server = new McpServer({ name: "MCP Appium JSONWire", version: "1.0.0" });
@@ -112,27 +112,31 @@ server.tool(
112
112
 
113
113
  // Open Deep Link
114
114
  server.tool(
115
- "open_deep_link",
116
- "Open deep link on device",
115
+ "open_deep_link_adb",
116
+ "Open deep link on device via ADB shell",
117
117
  {
118
118
  deepLink: z.string(),
119
119
  },
120
120
  async ({ deepLink }) => {
121
- if (!state.sessionId) {
122
- return { content: [{ type: "text", text: "No active session" }] };
121
+ if (!state.deviceId) {
122
+ return { content: [{ type: "text", text: "No connected device found" }] };
123
123
  }
124
- try {
125
- await axios.post(`${APPIUM_URL}/session/${state.sessionId}/appium/execute_script`, {
126
- script: "mobile: deepLink",
127
- args: {
128
- url: deepLink,
129
- package: "com.locon.housing",
130
- },
124
+
125
+ const command = `adb -s ${state.deviceId} shell am start -a android.intent.action.VIEW -d "${deepLink}"`;
126
+
127
+ return new Promise((resolve) => {
128
+ exec(command, (error, stdout, stderr) => {
129
+ if (error) {
130
+ resolve({ content: [{ type: "text", text: `Error executing ADB command: ${error.message}` }] });
131
+ return;
132
+ }
133
+ if (stderr) {
134
+ resolve({ content: [{ type: "text", text: `ADB stderr: ${stderr}` }] });
135
+ return;
136
+ }
137
+ resolve({ content: [{ type: "text", text: `Deep link opened via ADB: ${deepLink}` }] });
131
138
  });
132
- return { content: [{ type: "text", text: `Deep link opened: ${deepLink}` }] };
133
- } catch (e) {
134
- return { content: [{ type: "text", text: `Error opening deep link: ${e.message}` }] };
135
- }
139
+ });
136
140
  }
137
141
  );
138
142