appium-mcp 1.8.1 → 1.8.3

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 (88) hide show
  1. package/.prettierrc +1 -2
  2. package/CHANGELOG.md +12 -0
  3. package/dist/devicemanager/ios-manager.js +2 -2
  4. package/dist/devicemanager/ios-manager.js.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/locators/element-filter.d.ts.map +1 -1
  8. package/dist/locators/element-filter.js +4 -3
  9. package/dist/locators/element-filter.js.map +1 -1
  10. package/dist/locators/generate-all-locators.js +1 -1
  11. package/dist/locators/generate-all-locators.js.map +1 -1
  12. package/dist/locators/locator-generation.js +11 -11
  13. package/dist/locators/locator-generation.js.map +1 -1
  14. package/dist/server.js +1 -1
  15. package/dist/server.js.map +1 -1
  16. package/dist/session-store.d.ts.map +1 -1
  17. package/dist/session-store.js +4 -2
  18. package/dist/session-store.js.map +1 -1
  19. package/dist/tests/__mocks__/@appium/support.d.ts.map +1 -1
  20. package/dist/tests/__mocks__/@appium/support.js +20 -21
  21. package/dist/tests/__mocks__/@appium/support.js.map +1 -1
  22. package/dist/tests/generate-all-locators.test.js +6 -10
  23. package/dist/tests/generate-all-locators.test.js.map +1 -1
  24. package/dist/tests/test-setup-wda.js +26 -16
  25. package/dist/tests/test-setup-wda.js.map +1 -1
  26. package/dist/tools/documentation/reasoning-rag.js +9 -9
  27. package/dist/tools/documentation/reasoning-rag.js.map +1 -1
  28. package/dist/tools/documentation/simple-pdf-indexer.js +14 -14
  29. package/dist/tools/documentation/simple-pdf-indexer.js.map +1 -1
  30. package/dist/tools/index.js +1 -1
  31. package/dist/tools/index.js.map +1 -1
  32. package/dist/tools/interactions/drag-and-drop.js +1 -1
  33. package/dist/tools/interactions/drag-and-drop.js.map +1 -1
  34. package/dist/tools/interactions/long-press.js +2 -2
  35. package/dist/tools/interactions/long-press.js.map +1 -1
  36. package/dist/tools/ios/boot-simulator.js +1 -1
  37. package/dist/tools/ios/boot-simulator.js.map +1 -1
  38. package/dist/tools/ios/install-wda.js +3 -4
  39. package/dist/tools/ios/install-wda.js.map +1 -1
  40. package/dist/tools/ios/setup-wda.d.ts.map +1 -1
  41. package/dist/tools/ios/setup-wda.js +2 -3
  42. package/dist/tools/ios/setup-wda.js.map +1 -1
  43. package/dist/tools/navigations/scroll-to-element.d.ts.map +1 -1
  44. package/dist/tools/navigations/scroll-to-element.js +16 -9
  45. package/dist/tools/navigations/scroll-to-element.js.map +1 -1
  46. package/dist/tools/navigations/scroll.js +6 -6
  47. package/dist/tools/navigations/scroll.js.map +1 -1
  48. package/dist/tools/navigations/swipe.js +2 -2
  49. package/dist/tools/navigations/swipe.js.map +1 -1
  50. package/dist/tools/session/create-session.js +1 -1
  51. package/dist/tools/session/create-session.js.map +1 -1
  52. package/dist/tools/session/select-device.js +4 -4
  53. package/dist/tools/session/select-device.js.map +1 -1
  54. package/dist/tools/test-generation/generate-tests.d.ts.map +1 -1
  55. package/dist/tools/test-generation/generate-tests.js +10 -12
  56. package/dist/tools/test-generation/generate-tests.js.map +1 -1
  57. package/dist/ui/mcp-ui-utils.js +28 -28
  58. package/dist/ui/mcp-ui-utils.js.map +1 -1
  59. package/eslint.config.js +6 -32
  60. package/package.json +3 -6
  61. package/server.json +2 -2
  62. package/src/devicemanager/ios-manager.ts +2 -2
  63. package/src/index.ts +1 -1
  64. package/src/locators/element-filter.ts +5 -3
  65. package/src/locators/generate-all-locators.ts +1 -1
  66. package/src/locators/locator-generation.ts +11 -11
  67. package/src/server.ts +2 -2
  68. package/src/session-store.ts +6 -2
  69. package/src/tests/__mocks__/@appium/support.ts +3 -4
  70. package/src/tests/generate-all-locators.test.ts +12 -13
  71. package/src/tests/test-setup-wda.ts +24 -16
  72. package/src/tools/documentation/reasoning-rag.ts +10 -10
  73. package/src/tools/documentation/simple-pdf-indexer.ts +23 -21
  74. package/src/tools/index.ts +1 -1
  75. package/src/tools/interactions/drag-and-drop.ts +1 -1
  76. package/src/tools/interactions/long-press.ts +2 -2
  77. package/src/tools/ios/boot-simulator.ts +1 -1
  78. package/src/tools/ios/install-wda.ts +4 -4
  79. package/src/tools/ios/setup-wda.ts +2 -3
  80. package/src/tools/navigations/scroll-to-element.ts +19 -9
  81. package/src/tools/navigations/scroll.ts +6 -6
  82. package/src/tools/navigations/swipe.ts +2 -2
  83. package/src/tools/session/create-session.ts +1 -1
  84. package/src/tools/session/select-device.ts +4 -4
  85. package/src/tools/test-generation/generate-tests.ts +10 -12
  86. package/src/types/appium-xcuitest-driver.d.ts +1 -1
  87. package/src/ui/mcp-ui-utils.ts +28 -28
  88. package/tsconfig.tsbuildinfo +1 -1
@@ -65,7 +65,7 @@ async function loadCapabilitiesConfig(): Promise<CapabilitiesConfig> {
65
65
  */
66
66
  function filterEmptyCapabilities(capabilities: Capabilities): Capabilities {
67
67
  const filtered = { ...capabilities };
68
- Object.keys(filtered).forEach(key => {
68
+ Object.keys(filtered).forEach((key) => {
69
69
  if (filtered[key] === '') {
70
70
  delete filtered[key];
71
71
  }
@@ -52,10 +52,10 @@ async function getAndroidDevices(): Promise<any[]> {
52
52
  * Validate and select Android device by UDID
53
53
  */
54
54
  function selectAndroidDevice(deviceUdid: string, devices: any[]): void {
55
- const selectedDevice = devices.find(d => d.udid === deviceUdid);
55
+ const selectedDevice = devices.find((d) => d.udid === deviceUdid);
56
56
  if (!selectedDevice) {
57
57
  throw new Error(
58
- `Device with UDID "${deviceUdid}" not found. Available devices: ${devices.map(d => d.udid).join(', ')}`
58
+ `Device with UDID "${deviceUdid}" not found. Available devices: ${devices.map((d) => d.udid).join(', ')}`
59
59
  );
60
60
  }
61
61
 
@@ -154,9 +154,9 @@ function selectIOSDevice(
154
154
  devices: any[],
155
155
  iosDeviceType: 'simulator' | 'real'
156
156
  ): any {
157
- const selectedDevice = devices.find(d => d.udid === deviceUdid);
157
+ const selectedDevice = devices.find((d) => d.udid === deviceUdid);
158
158
  if (!selectedDevice) {
159
- const deviceList = devices.map(d => `${d.name} (${d.udid})`).join(', ');
159
+ const deviceList = devices.map((d) => `${d.name} (${d.udid})`).join(', ');
160
160
  throw new Error(
161
161
  `Device with UDID "${deviceUdid}" not found. Available devices: ${deviceList}`
162
162
  );
@@ -34,17 +34,15 @@ export default function generateTest(server: FastMCP): void {
34
34
  readOnlyHint: false,
35
35
  openWorldHint: false,
36
36
  },
37
- execute: async (args: any, context: any): Promise<any> => {
38
- return {
39
- content: [
40
- {
41
- type: 'text',
42
- text: instructions({
43
- steps: args.steps,
44
- }),
45
- },
46
- ],
47
- };
48
- },
37
+ execute: async (args: any, context: any): Promise<any> => ({
38
+ content: [
39
+ {
40
+ type: 'text',
41
+ text: instructions({
42
+ steps: args.steps,
43
+ }),
44
+ },
45
+ ],
46
+ }),
49
47
  });
50
48
  }
@@ -2,4 +2,4 @@ declare module 'appium-xcuitest-driver' {
2
2
  export class XCUITestDriver {
3
3
  createSession(capabilities: any, w3cCapabilities: any): Promise<string>;
4
4
  }
5
- }
5
+ }
@@ -222,7 +222,7 @@ export function createDevicePickerUI(
222
222
  }
223
223
  }, '*');
224
224
  }
225
-
225
+
226
226
  // Add click handlers for better UX
227
227
  document.querySelectorAll('.device-card').forEach(card => {
228
228
  card.addEventListener('click', (e) => {
@@ -378,9 +378,9 @@ export function createScreenshotViewerUI(
378
378
  </div>
379
379
  </div>
380
380
  <div class="image-container" id="imageContainer">
381
- <img src="data:image/png;base64,${screenshotBase64}"
382
- alt="Screenshot"
383
- class="screenshot-img"
381
+ <img src="data:image/png;base64,${screenshotBase64}"
382
+ alt="Screenshot"
383
+ class="screenshot-img"
384
384
  id="screenshotImg"
385
385
  onclick="toggleZoom()">
386
386
  </div>
@@ -393,7 +393,7 @@ export function createScreenshotViewerUI(
393
393
  <script>
394
394
  let currentZoom = 1;
395
395
  const img = document.getElementById('screenshotImg');
396
-
396
+
397
397
  function toggleZoom() {
398
398
  if (currentZoom === 1) {
399
399
  zoomIn();
@@ -401,29 +401,29 @@ export function createScreenshotViewerUI(
401
401
  resetZoom();
402
402
  }
403
403
  }
404
-
404
+
405
405
  function zoomIn() {
406
406
  currentZoom = Math.min(currentZoom + 0.5, 4);
407
407
  img.style.transform = \`scale(\${currentZoom})\`;
408
408
  }
409
-
409
+
410
410
  function zoomOut() {
411
411
  currentZoom = Math.max(currentZoom - 0.5, 0.5);
412
412
  img.style.transform = \`scale(\${currentZoom})\`;
413
413
  }
414
-
414
+
415
415
  function resetZoom() {
416
416
  currentZoom = 1;
417
417
  img.style.transform = 'scale(1)';
418
418
  }
419
-
419
+
420
420
  function downloadScreenshot() {
421
421
  const link = document.createElement('a');
422
422
  link.href = img.src;
423
423
  link.download = '${filepath.split('/').pop() || 'screenshot.png'}';
424
424
  link.click();
425
425
  }
426
-
426
+
427
427
  function takeNewScreenshot() {
428
428
  window.parent.postMessage({
429
429
  type: 'tool',
@@ -433,7 +433,7 @@ export function createScreenshotViewerUI(
433
433
  }
434
434
  }, '*');
435
435
  }
436
-
436
+
437
437
  // Keyboard shortcuts
438
438
  document.addEventListener('keydown', (e) => {
439
439
  if (e.key === '+' || e.key === '=') zoomIn();
@@ -650,7 +650,7 @@ export function createSessionDashboardUI(sessionInfo: {
650
650
  }
651
651
  }, '*');
652
652
  }
653
-
653
+
654
654
  function getPageSource() {
655
655
  window.parent.postMessage({
656
656
  type: 'tool',
@@ -660,7 +660,7 @@ export function createSessionDashboardUI(sessionInfo: {
660
660
  }
661
661
  }, '*');
662
662
  }
663
-
663
+
664
664
  function generateLocators() {
665
665
  window.parent.postMessage({
666
666
  type: 'tool',
@@ -670,7 +670,7 @@ export function createSessionDashboardUI(sessionInfo: {
670
670
  }
671
671
  }, '*');
672
672
  }
673
-
673
+
674
674
  function getContexts() {
675
675
  window.parent.postMessage({
676
676
  type: 'tool',
@@ -680,7 +680,7 @@ export function createSessionDashboardUI(sessionInfo: {
680
680
  }
681
681
  }, '*');
682
682
  }
683
-
683
+
684
684
  function deleteSession() {
685
685
  if (confirm('Are you sure you want to end this session?')) {
686
686
  window.parent.postMessage({
@@ -1034,7 +1034,7 @@ export function createPageSourceInspectorUI(pageSource: string): string {
1034
1034
  alert('Copied to clipboard!');
1035
1035
  });
1036
1036
  }
1037
-
1037
+
1038
1038
  function formatXML() {
1039
1039
  const content = document.getElementById('xmlContent').textContent;
1040
1040
  try {
@@ -1047,7 +1047,7 @@ export function createPageSourceInspectorUI(pageSource: string): string {
1047
1047
  alert('Failed to format XML');
1048
1048
  }
1049
1049
  }
1050
-
1050
+
1051
1051
  function generateLocators() {
1052
1052
  window.parent.postMessage({
1053
1053
  type: 'tool',
@@ -1057,7 +1057,7 @@ export function createPageSourceInspectorUI(pageSource: string): string {
1057
1057
  }
1058
1058
  }, '*');
1059
1059
  }
1060
-
1060
+
1061
1061
  // Search functionality
1062
1062
  document.getElementById('searchBox').addEventListener('input', (e) => {
1063
1063
  const searchTerm = e.target.value.toLowerCase();
@@ -1090,8 +1090,8 @@ export function createContextSwitcherUI(
1090
1090
  ): string {
1091
1091
  const contextCards = contexts
1092
1092
  .map(
1093
- context => `
1094
- <div class="context-card ${context === currentContext ? 'active' : ''}"
1093
+ (context) => `
1094
+ <div class="context-card ${context === currentContext ? 'active' : ''}"
1095
1095
  onclick="switchContext('${context}')">
1096
1096
  <div class="context-header">
1097
1097
  <h3>${context}</h3>
@@ -1248,7 +1248,7 @@ export function createAppListUI(
1248
1248
  ): string {
1249
1249
  const appCards = apps
1250
1250
  .map(
1251
- app => `
1251
+ (app) => `
1252
1252
  <div class="app-card" data-package="${app.packageName}">
1253
1253
  <div class="app-header">
1254
1254
  <h3>${app.appName || app.packageName}</h3>
@@ -1407,7 +1407,7 @@ export function createAppListUI(
1407
1407
  }
1408
1408
  }, '*');
1409
1409
  }
1410
-
1410
+
1411
1411
  function terminateApp(packageName) {
1412
1412
  if (confirm('Are you sure you want to terminate this app?')) {
1413
1413
  window.parent.postMessage({
@@ -1421,7 +1421,7 @@ export function createAppListUI(
1421
1421
  }, '*');
1422
1422
  }
1423
1423
  }
1424
-
1424
+
1425
1425
  function uninstallApp(packageName) {
1426
1426
  if (confirm('Are you sure you want to uninstall this app? This action cannot be undone.')) {
1427
1427
  window.parent.postMessage({
@@ -1435,7 +1435,7 @@ export function createAppListUI(
1435
1435
  }, '*');
1436
1436
  }
1437
1437
  }
1438
-
1438
+
1439
1439
  // Search functionality
1440
1440
  document.getElementById('searchBox').addEventListener('input', (e) => {
1441
1441
  const searchTerm = e.target.value.toLowerCase();
@@ -1584,7 +1584,7 @@ export function createTestCodeViewerUI(
1584
1584
  alert('Code copied to clipboard!');
1585
1585
  });
1586
1586
  }
1587
-
1587
+
1588
1588
  function downloadCode() {
1589
1589
  const text = document.getElementById('codeContent').textContent;
1590
1590
  const blob = new Blob([text], { type: 'text/plain' });
@@ -1595,19 +1595,19 @@ export function createTestCodeViewerUI(
1595
1595
  a.click();
1596
1596
  URL.revokeObjectURL(url);
1597
1597
  }
1598
-
1598
+
1599
1599
  function formatCode() {
1600
1600
  // Basic formatting - could be enhanced with a proper formatter
1601
1601
  const content = document.getElementById('codeContent');
1602
1602
  const text = content.textContent;
1603
1603
  // Add line numbers
1604
1604
  const lines = text.split('\\n');
1605
- const formatted = lines.map((line, i) =>
1605
+ const formatted = lines.map((line, i) =>
1606
1606
  \`<span class="line-numbers">\${i + 1}</span>\${line}\`
1607
1607
  ).join('\\n');
1608
1608
  content.innerHTML = formatted;
1609
1609
  }
1610
-
1610
+
1611
1611
  // Initial format
1612
1612
  formatCode();
1613
1613
  </script>