@nbakka/mcp-appium 1.0.4 → 1.0.5

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 +26 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Selenium WebDriver MCP Server",
5
5
  "type": "module",
6
6
  "main": "src/lib/server.js",
package/src/lib/server.js CHANGED
@@ -5,10 +5,9 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
5
5
  import { z } from "zod";
6
6
  import axios from "axios";
7
7
 
8
- const APPIUM_URL = "http://127.0.0.1:4723/wd/hub";
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" });
11
-
12
11
  const state = { sessionId: null };
13
12
 
14
13
  // Helper to extract element ID
@@ -24,8 +23,8 @@ server.tool(
24
23
  capabilities: z.object({
25
24
  platformName: z.string(),
26
25
  udid: z.string(),
26
+ automationName: z.string(),
27
27
  app: z.string().optional(),
28
- automationName: z.string().optional(),
29
28
  }),
30
29
  },
31
30
  async ({ capabilities }) => {
@@ -36,7 +35,7 @@ server.tool(
36
35
  alwaysMatch: capabilities,
37
36
  },
38
37
  };
39
- const response = await axios.post(`${APPIUM_URL}/session`, payload);
38
+ const response = await axios.post(`${APPIUM_URL}/session`, payload); // Correct endpoint
40
39
  state.sessionId = response.data.sessionId;
41
40
  return { content: [{ type: "text", text: `Session started: ${state.sessionId}` }] };
42
41
  } catch (e) {
@@ -94,6 +93,29 @@ server.tool(
94
93
  }
95
94
  );
96
95
 
96
+ // Open Deep Link tool with package name
97
+ server.tool(
98
+ "open_deep_link",
99
+ "Open deep link on the device with package name",
100
+ {
101
+ deepLink: z.string(),
102
+ packageName: z.string(), // Add package name to be hardcoded
103
+ },
104
+ async ({ deepLink, packageName }) => {
105
+ if (!state.sessionId) return { content: [{ type: "text", text: "No active session" }] };
106
+ try {
107
+ // ADB command to open deep link with the provided package name
108
+ const adbCommand = `adb -s ${state.udid} shell am start -W -a android.intent.action.VIEW -d "${deepLink}" ${packageName}/.MainActivity`;
109
+ await axios.post(`${APPIUM_URL}/session/${state.sessionId}/execute`, {
110
+ script: adbCommand,
111
+ });
112
+ return { content: [{ type: "text", text: `Deep link opened: ${deepLink} for package: ${packageName}` }] };
113
+ } catch (e) {
114
+ return { content: [{ type: "text", text: `Error opening deep link: ${e.message}` }] };
115
+ }
116
+ }
117
+ );
118
+
97
119
  // Close Session tool
98
120
  server.tool(
99
121
  "close_session",