appium-mcp 1.97.1 → 1.98.0
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/CHANGELOG.md +16 -0
- package/README.md +52 -2
- package/dist/create-server.d.ts.map +1 -1
- package/dist/create-server.js +12 -3
- package/dist/create-server.js.map +1 -1
- package/dist/devicemanager/ios-manager.d.ts +0 -1
- package/dist/devicemanager/ios-manager.d.ts.map +1 -1
- package/dist/devicemanager/ios-manager.js +10 -23
- package/dist/devicemanager/ios-manager.js.map +1 -1
- package/dist/http-security.d.ts +7 -0
- package/dist/http-security.d.ts.map +1 -0
- package/dist/http-security.js +36 -0
- package/dist/http-security.js.map +1 -0
- package/dist/telemetry/init.d.ts +2 -0
- package/dist/telemetry/init.d.ts.map +1 -1
- package/dist/telemetry/init.js +14 -1
- package/dist/telemetry/init.js.map +1 -1
- package/dist/tools/ios/prepare-ios-simulator.d.ts.map +1 -1
- package/dist/tools/ios/prepare-ios-simulator.js +21 -37
- package/dist/tools/ios/prepare-ios-simulator.js.map +1 -1
- package/dist/ui/mcp-ui-utils.d.ts.map +1 -1
- package/dist/ui/mcp-ui-utils.js +45 -9
- package/dist/ui/mcp-ui-utils.js.map +1 -1
- package/dist/ui/page-source-inspector-app.d.ts.map +1 -1
- package/dist/ui/page-source-inspector-app.js +164 -89
- package/dist/ui/page-source-inspector-app.js.map +1 -1
- package/package.json +9 -8
- package/server.json +2 -2
- package/src/create-server.ts +12 -3
- package/src/devicemanager/ios-manager.ts +11 -26
- package/src/http-security.ts +43 -0
- package/src/telemetry/init.ts +18 -1
- package/src/tools/ios/prepare-ios-simulator.ts +21 -39
- package/src/ui/mcp-ui-utils.ts +45 -9
- package/src/ui/page-source-inspector-app.ts +164 -89
package/dist/ui/mcp-ui-utils.js
CHANGED
|
@@ -877,7 +877,7 @@ export function createPageSourceInspectorUI(pageSource) {
|
|
|
877
877
|
background: #1e1e1e;
|
|
878
878
|
color: #d4d4d4;
|
|
879
879
|
padding: 0;
|
|
880
|
-
overflow:
|
|
880
|
+
overflow: auto;
|
|
881
881
|
}
|
|
882
882
|
summary {
|
|
883
883
|
padding: 12px 16px;
|
|
@@ -924,7 +924,9 @@ export function createPageSourceInspectorUI(pageSource) {
|
|
|
924
924
|
color: #999;
|
|
925
925
|
}
|
|
926
926
|
.viewer {
|
|
927
|
-
|
|
927
|
+
height: 320px;
|
|
928
|
+
min-height: 160px;
|
|
929
|
+
resize: vertical;
|
|
928
930
|
overflow: auto;
|
|
929
931
|
padding: 16px;
|
|
930
932
|
}
|
|
@@ -973,7 +975,7 @@ export function createPageSourceInspectorUI(pageSource) {
|
|
|
973
975
|
<button class="btn" onclick="generateLocators()">Generate Locators</button>
|
|
974
976
|
</div>
|
|
975
977
|
</div>
|
|
976
|
-
<div class="viewer">
|
|
978
|
+
<div class="viewer" title="Drag the bottom-right corner to resize vertically">
|
|
977
979
|
<pre class="xml-content" id="xmlContent">${escapedSource}</pre>
|
|
978
980
|
</div>
|
|
979
981
|
</details>
|
|
@@ -986,13 +988,46 @@ export function createPageSourceInspectorUI(pageSource) {
|
|
|
986
988
|
}
|
|
987
989
|
|
|
988
990
|
function formatXML() {
|
|
989
|
-
const content = document.getElementById('xmlContent').textContent;
|
|
990
991
|
try {
|
|
991
992
|
const parser = new DOMParser();
|
|
992
|
-
const xmlDoc = parser.parseFromString(
|
|
993
|
+
const xmlDoc = parser.parseFromString(originalSource, 'text/xml');
|
|
994
|
+
if (!xmlDoc.documentElement || xmlDoc.getElementsByTagName('parsererror').length) {
|
|
995
|
+
throw new Error('Invalid XML');
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function indentElement(element, depth) {
|
|
999
|
+
// Do not introduce whitespace into mixed content or preserved subtrees.
|
|
1000
|
+
if (element.getAttribute('xml:space') === 'preserve') return;
|
|
1001
|
+
const children = Array.from(element.childNodes);
|
|
1002
|
+
if (children.some(child =>
|
|
1003
|
+
child.nodeType === 4 || (child.nodeType === 3 && child.nodeValue.trim())
|
|
1004
|
+
)) return;
|
|
1005
|
+
if (!children.some(child => child.nodeType === 1)) return;
|
|
1006
|
+
|
|
1007
|
+
for (const child of children) {
|
|
1008
|
+
if (child.nodeType === 3) {
|
|
1009
|
+
element.removeChild(child);
|
|
1010
|
+
continue;
|
|
1011
|
+
}
|
|
1012
|
+
if (child.nodeType === 1) indentElement(child, depth + 1);
|
|
1013
|
+
element.insertBefore(xmlDoc.createTextNode('\\n' + ' '.repeat(depth + 1)), child);
|
|
1014
|
+
}
|
|
1015
|
+
element.appendChild(xmlDoc.createTextNode('\\n' + ' '.repeat(depth)));
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
indentElement(xmlDoc.documentElement, 0);
|
|
993
1019
|
const serializer = new XMLSerializer();
|
|
994
|
-
|
|
995
|
-
|
|
1020
|
+
let formatted = Array.from(xmlDoc.childNodes)
|
|
1021
|
+
.filter(node => node.nodeType !== 3)
|
|
1022
|
+
.map(node => serializer.serializeToString(node))
|
|
1023
|
+
.join('\\n');
|
|
1024
|
+
// Browser DOMParser does not retain the XML declaration.
|
|
1025
|
+
const declaration = originalSource.match(/^\\s*(<\\?xml\\s[^?]*\\?>)/);
|
|
1026
|
+
if (declaration && !formatted.startsWith('<?xml ')) {
|
|
1027
|
+
formatted = declaration[1] + '\\n' + formatted;
|
|
1028
|
+
}
|
|
1029
|
+
displayedSource = formatted;
|
|
1030
|
+
renderSource(document.getElementById('searchBox').value);
|
|
996
1031
|
} catch (e) {
|
|
997
1032
|
alert('Failed to format XML');
|
|
998
1033
|
}
|
|
@@ -1010,6 +1045,7 @@ export function createPageSourceInspectorUI(pageSource) {
|
|
|
1010
1045
|
|
|
1011
1046
|
const xmlContent = document.getElementById('xmlContent');
|
|
1012
1047
|
const originalSource = xmlContent.textContent;
|
|
1048
|
+
let displayedSource = originalSource;
|
|
1013
1049
|
|
|
1014
1050
|
function appendTextWithHighlights(container, text, searchTerm) {
|
|
1015
1051
|
const searchLower = searchTerm.toLowerCase();
|
|
@@ -1041,11 +1077,11 @@ export function createPageSourceInspectorUI(pageSource) {
|
|
|
1041
1077
|
function renderSource(searchTerm = '') {
|
|
1042
1078
|
xmlContent.textContent = '';
|
|
1043
1079
|
if (!searchTerm) {
|
|
1044
|
-
xmlContent.textContent =
|
|
1080
|
+
xmlContent.textContent = displayedSource;
|
|
1045
1081
|
return;
|
|
1046
1082
|
}
|
|
1047
1083
|
|
|
1048
|
-
appendTextWithHighlights(xmlContent,
|
|
1084
|
+
appendTextWithHighlights(xmlContent, displayedSource, searchTerm);
|
|
1049
1085
|
}
|
|
1050
1086
|
|
|
1051
1087
|
// Search functionality
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-ui-utils.js","sourceRoot":"","sources":["../../src/ui/mcp-ui-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,WAAmB;IASnB,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,GAAG;YACH,QAAQ,EAAE,WAAW;YACrB,IAAI,EAAE,WAAW;SAClB;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAKE,EACF,QAA2B,EAC3B,UAAiC;IAEjC,MAAM,eAAe,GACnB,QAAQ,KAAK,KAAK,IAAI,UAAU;QAC9B,CAAC,CAAC,UAAU,KAAK,WAAW;YAC1B,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,aAAa;QACjB,CAAC,CAAC,iBAAiB,CAAC;IAExB,MAAM,WAAW,GAAG,OAAO;SACxB,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC;QACjC,MAAM,KAAK,GAAG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,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IAExF,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,MAAM,CAAC,KAAK,CAAC;SACjB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;SACxB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;SACxB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;SACxB,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;SAC7B,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,UAAU,CACf,MAAM,CAAC,KAAK,CAAC;SACV,WAAW,EAAE;SACb,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;SAC7B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-source-inspector-app.d.ts","sourceRoot":"","sources":["../../src/ui/page-source-inspector-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,8BAA8B,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"page-source-inspector-app.d.ts","sourceRoot":"","sources":["../../src/ui/page-source-inspector-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,8BAA8B,IAAI,MAAM,CAsVvD"}
|
|
@@ -13,102 +13,72 @@ export function createPageSourceInspectorAppUI() {
|
|
|
13
13
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
14
14
|
<title>Page Source Inspector</title>
|
|
15
15
|
<style>
|
|
16
|
+
:root { color-scheme: dark; --bg: #17191d; --panel: #202329; --line: #343941; --text: #e5e8ee; --muted: #a3acba; --accent: #91baff; }
|
|
16
17
|
* { box-sizing: border-box; }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
.
|
|
48
|
-
.
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
border-radius: 4px;
|
|
53
|
-
background: #007aff;
|
|
54
|
-
color: #fff;
|
|
55
|
-
cursor: pointer;
|
|
56
|
-
font: 13px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
57
|
-
}
|
|
58
|
-
.btn:hover { background: #0056b3; }
|
|
59
|
-
.btn-secondary { background: #444; }
|
|
60
|
-
.btn-secondary:hover { background: #555; }
|
|
61
|
-
.search-box {
|
|
62
|
-
width: 200px;
|
|
63
|
-
padding: 6px 12px;
|
|
64
|
-
border: 1px solid #555;
|
|
65
|
-
border-radius: 4px;
|
|
66
|
-
outline: none;
|
|
67
|
-
background: #3e3e3e;
|
|
68
|
-
color: #d4d4d4;
|
|
69
|
-
font-size: 13px;
|
|
70
|
-
}
|
|
71
|
-
.search-box:focus { border-color: #007aff; }
|
|
72
|
-
.viewer {
|
|
73
|
-
max-height: 320px;
|
|
74
|
-
overflow: auto;
|
|
75
|
-
padding: 16px;
|
|
76
|
-
}
|
|
77
|
-
.xml-content {
|
|
78
|
-
margin: 0;
|
|
79
|
-
white-space: pre;
|
|
80
|
-
color: #d4d4d4;
|
|
81
|
-
font-size: 13px;
|
|
82
|
-
line-height: 1.6;
|
|
83
|
-
}
|
|
84
|
-
mark {
|
|
85
|
-
border-radius: 2px;
|
|
86
|
-
background: #ffd54f;
|
|
87
|
-
color: #1e1e1e;
|
|
88
|
-
}
|
|
89
|
-
.empty {
|
|
90
|
-
color: #999;
|
|
91
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
92
|
-
}
|
|
18
|
+
[hidden] { display: none !important; }
|
|
19
|
+
body { margin: 0; overflow: auto; background: var(--bg); color: var(--text); font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
|
20
|
+
summary { cursor: pointer; padding: 16px 20px; }
|
|
21
|
+
summary::marker { color: var(--muted); }
|
|
22
|
+
.title { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
|
|
23
|
+
.info { color: var(--muted); font-size: 12px; margin-left: 10px; }
|
|
24
|
+
.toolbar, .section-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
|
|
25
|
+
.toolbar { padding: 12px 20px; border-block: 1px solid var(--line); background: var(--panel); }
|
|
26
|
+
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
|
27
|
+
.btn { padding: 8px 12px; border: 1px solid transparent; border-radius: 7px; background: #a7c7ff; color: #14243d; cursor: pointer; font: inherit; font-weight: 600; }
|
|
28
|
+
.btn:hover { background: #c2d8ff; }
|
|
29
|
+
.btn:disabled { opacity: .55; cursor: wait; }
|
|
30
|
+
.btn-secondary { background: transparent; border-color: #48505d; color: var(--text); }
|
|
31
|
+
.btn-secondary:hover { background: #303641; }
|
|
32
|
+
.btn:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
|
|
33
|
+
.search-box { width: min(240px, 100%); min-width: 0; padding: 8px 12px; border: 1px solid #48505d; border-radius: 7px; background: var(--bg); color: var(--text); font: inherit; }
|
|
34
|
+
.search-box::placeholder { color: var(--muted); }
|
|
35
|
+
.viewer { height: 320px; min-height: 160px; resize: vertical; overflow: auto; padding: 20px; }
|
|
36
|
+
.xml-content, .selector { margin: 0; font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
|
|
37
|
+
.xml-content { white-space: pre; color: #c5d3e7; }
|
|
38
|
+
mark { border-radius: 3px; background: #eac77a; color: #252019; }
|
|
39
|
+
.empty, .hint { color: var(--muted); }
|
|
40
|
+
.empty { font-family: inherit; }
|
|
41
|
+
.hint { margin: 6px 0 0; font-size: 12px; }
|
|
42
|
+
.locators { border-top: 1px solid var(--line); padding: 20px; }
|
|
43
|
+
h2 { margin: 0; font-size: 14px; font-weight: 600; }
|
|
44
|
+
#locatorStatus { margin: 16px 0 10px; color: var(--accent); font-size: 12px; }
|
|
45
|
+
.locator-results { max-height: 480px; overflow: auto; }
|
|
46
|
+
.locator-card { margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
|
|
47
|
+
.locator-card summary { padding: 12px 14px; overflow-wrap: anywhere; }
|
|
48
|
+
.element-type { margin-left: 8px; color: var(--muted); font-size: 11px; }
|
|
49
|
+
.locator-row { margin: 0 14px 14px; }
|
|
50
|
+
.strategy { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
|
|
51
|
+
.selector { padding: 10px 12px; background: var(--bg); border-radius: 5px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
|
|
52
|
+
@media (max-width: 420px) { .toolbar, .locators { padding: 12px; } .toolbar-right { width: 100%; } .search-box { width: 100%; } .info { display: block; margin: 4px 0 0 18px; } }
|
|
93
53
|
</style>
|
|
94
54
|
</head>
|
|
95
55
|
<body>
|
|
96
|
-
<details>
|
|
56
|
+
<details open>
|
|
97
57
|
<summary>
|
|
98
|
-
<span class="title"
|
|
58
|
+
<span class="title">Page Source Inspector</span>
|
|
99
59
|
<span class="info" id="sourceInfo">Waiting for page source…</span>
|
|
100
60
|
</summary>
|
|
101
61
|
<div class="toolbar">
|
|
62
|
+
<input type="search" class="search-box" id="searchBox" placeholder="Find in XML…" aria-label="Find in XML" title="Highlight matching text in the XML">
|
|
102
63
|
<div class="toolbar-right">
|
|
103
|
-
<
|
|
104
|
-
<button class="btn btn-secondary" id="copyButton">Copy</button>
|
|
105
|
-
<button class="btn btn-secondary" id="formatButton">Format</button>
|
|
106
|
-
<button class="btn" id="generateButton">Generate Locators</button>
|
|
64
|
+
<button class="btn btn-secondary" id="formatButton">Format XML</button>
|
|
65
|
+
<button class="btn btn-secondary" id="copyButton">Copy XML</button>
|
|
107
66
|
</div>
|
|
108
67
|
</div>
|
|
109
|
-
<div class="viewer">
|
|
68
|
+
<div class="viewer" title="Drag the bottom-right corner to resize vertically">
|
|
110
69
|
<pre class="xml-content empty" id="xmlContent">Waiting for page source…</pre>
|
|
111
70
|
</div>
|
|
71
|
+
<section class="locators" aria-labelledby="locatorsHeading">
|
|
72
|
+
<div class="section-header">
|
|
73
|
+
<h2 id="locatorsHeading">Locator candidates</h2>
|
|
74
|
+
<button class="btn" id="generateButton">Generate from current page</button>
|
|
75
|
+
</div>
|
|
76
|
+
<p class="hint">Fetches fresh XML from the device and generates candidates for supported element types, including hidden elements. XML search only highlights text above.</p>
|
|
77
|
+
<div id="locatorResults" hidden>
|
|
78
|
+
<p id="locatorStatus" role="status" aria-live="polite"></p>
|
|
79
|
+
<div class="locator-results" id="locatorOutput"></div>
|
|
80
|
+
</div>
|
|
81
|
+
</section>
|
|
112
82
|
</details>
|
|
113
83
|
<script>
|
|
114
84
|
(() => {
|
|
@@ -116,6 +86,10 @@ export function createPageSourceInspectorAppUI() {
|
|
|
116
86
|
const xmlContent = document.getElementById('xmlContent');
|
|
117
87
|
const sourceInfo = document.getElementById('sourceInfo');
|
|
118
88
|
const searchBox = document.getElementById('searchBox');
|
|
89
|
+
const generateButton = document.getElementById('generateButton');
|
|
90
|
+
const locatorResults = document.getElementById('locatorResults');
|
|
91
|
+
const locatorStatus = document.getElementById('locatorStatus');
|
|
92
|
+
const locatorOutput = document.getElementById('locatorOutput');
|
|
119
93
|
let source = '';
|
|
120
94
|
let savedFile;
|
|
121
95
|
let nextRequestId = 1;
|
|
@@ -204,10 +178,41 @@ export function createPageSourceInspectorAppUI() {
|
|
|
204
178
|
try {
|
|
205
179
|
const parser = new DOMParser();
|
|
206
180
|
const documentNode = parser.parseFromString(source, 'text/xml');
|
|
207
|
-
if (documentNode.
|
|
181
|
+
if (!documentNode.documentElement || documentNode.getElementsByTagName('parsererror').length) {
|
|
208
182
|
throw new Error('Invalid XML');
|
|
209
183
|
}
|
|
210
|
-
|
|
184
|
+
|
|
185
|
+
function indentElement(element, depth) {
|
|
186
|
+
if (element.getAttribute('xml:space') === 'preserve') return;
|
|
187
|
+
const children = Array.from(element.childNodes);
|
|
188
|
+
const hasMixedContent = children.some((child) =>
|
|
189
|
+
child.nodeType === 4 || (child.nodeType === 3 && (child.nodeValue || '').trim()),
|
|
190
|
+
);
|
|
191
|
+
if (hasMixedContent || !children.some((child) => child.nodeType === 1)) return;
|
|
192
|
+
|
|
193
|
+
for (const child of children) {
|
|
194
|
+
if (child.nodeType === 3) {
|
|
195
|
+
element.removeChild(child);
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (child.nodeType === 1) indentElement(child, depth + 1);
|
|
199
|
+
element.insertBefore(documentNode.createTextNode('\\n' + ' '.repeat(depth + 1)), child);
|
|
200
|
+
}
|
|
201
|
+
element.appendChild(documentNode.createTextNode('\\n' + ' '.repeat(depth)));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
indentElement(documentNode.documentElement, 0);
|
|
205
|
+
const serializer = new XMLSerializer();
|
|
206
|
+
let formattedSource = Array.from(documentNode.childNodes)
|
|
207
|
+
.filter((node) => node.nodeType !== 3)
|
|
208
|
+
.map((node) => serializer.serializeToString(node))
|
|
209
|
+
.join('\\n');
|
|
210
|
+
const declaration = source.match(/^\\s*(<\\?xml\\s[^?]*\\?>)/);
|
|
211
|
+
if (declaration && !formattedSource.startsWith('<?xml ')) {
|
|
212
|
+
formattedSource = declaration[1] + '\\n' + formattedSource;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
source = formattedSource;
|
|
211
216
|
renderSource();
|
|
212
217
|
} catch {
|
|
213
218
|
window.alert('Failed to format XML');
|
|
@@ -223,11 +228,67 @@ export function createPageSourceInspectorAppUI() {
|
|
|
223
228
|
}
|
|
224
229
|
}
|
|
225
230
|
|
|
231
|
+
function renderLocators(elements) {
|
|
232
|
+
locatorOutput.textContent = '';
|
|
233
|
+
elements.forEach((element, index) => {
|
|
234
|
+
const card = document.createElement('details');
|
|
235
|
+
card.className = 'locator-card';
|
|
236
|
+
card.open = index === 0;
|
|
237
|
+
const heading = document.createElement('summary');
|
|
238
|
+
const label = element.text || element.contentDesc || element.resourceId;
|
|
239
|
+
heading.textContent = (index + 1) + '. ' + (label || element.tagName || 'Element');
|
|
240
|
+
if (label && element.tagName) {
|
|
241
|
+
const type = document.createElement('span');
|
|
242
|
+
type.className = 'element-type';
|
|
243
|
+
type.textContent = element.tagName;
|
|
244
|
+
heading.appendChild(type);
|
|
245
|
+
}
|
|
246
|
+
card.appendChild(heading);
|
|
247
|
+
const entries = Object.entries(element.locators || {}).filter(([, value]) => typeof value === 'string');
|
|
248
|
+
entries.forEach(([strategy, selector]) => {
|
|
249
|
+
const row = document.createElement('div');
|
|
250
|
+
row.className = 'locator-row';
|
|
251
|
+
const name = document.createElement('span');
|
|
252
|
+
name.className = 'strategy';
|
|
253
|
+
name.textContent = strategy;
|
|
254
|
+
const code = document.createElement('pre');
|
|
255
|
+
code.className = 'selector';
|
|
256
|
+
code.textContent = selector;
|
|
257
|
+
row.appendChild(name);
|
|
258
|
+
row.appendChild(code);
|
|
259
|
+
card.appendChild(row);
|
|
260
|
+
});
|
|
261
|
+
if (!entries.length) {
|
|
262
|
+
const empty = document.createElement('p');
|
|
263
|
+
empty.className = 'locator-row hint';
|
|
264
|
+
empty.textContent = 'No candidate selectors for this element.';
|
|
265
|
+
card.appendChild(empty);
|
|
266
|
+
}
|
|
267
|
+
locatorOutput.appendChild(card);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
226
271
|
async function generateLocators() {
|
|
272
|
+
if (generateButton.disabled) return;
|
|
273
|
+
generateButton.disabled = true;
|
|
274
|
+
locatorResults.hidden = false;
|
|
275
|
+
locatorStatus.textContent = 'Fetching XML and generating candidates…';
|
|
276
|
+
locatorOutput.textContent = '';
|
|
227
277
|
try {
|
|
228
|
-
await sendRequest('tools/call', {name: 'generate_locators', arguments: {}});
|
|
229
|
-
|
|
230
|
-
|
|
278
|
+
const result = await sendRequest('tools/call', {name: 'generate_locators', arguments: {}});
|
|
279
|
+
const text = (result?.content || []).filter((item) => item.type === 'text').map((item) => item.text).join('\\n');
|
|
280
|
+
if (result?.isError) throw new Error(text || 'Tool returned an error');
|
|
281
|
+
const data = JSON.parse(text);
|
|
282
|
+
if (!Array.isArray(data.interactableElements)) throw new Error('No locator data returned');
|
|
283
|
+
const elements = data.interactableElements;
|
|
284
|
+
locatorStatus.textContent = elements.length
|
|
285
|
+
? 'Candidates generated for ' + elements.length + ' elements from freshly fetched XML.'
|
|
286
|
+
: 'No supported elements found in the fetched XML.';
|
|
287
|
+
renderLocators(elements);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
locatorStatus.textContent = 'Failed to generate locators: ' + error.message;
|
|
290
|
+
} finally {
|
|
291
|
+
generateButton.disabled = false;
|
|
231
292
|
}
|
|
232
293
|
}
|
|
233
294
|
|
|
@@ -262,7 +323,21 @@ export function createPageSourceInspectorAppUI() {
|
|
|
262
323
|
appInfo: {name: 'Appium Page Source Inspector', version: '1.0.0'},
|
|
263
324
|
appCapabilities: {availableDisplayModes: ['inline', 'fullscreen']},
|
|
264
325
|
})
|
|
265
|
-
.then(() =>
|
|
326
|
+
.then(() => {
|
|
327
|
+
sendNotification('ui/notifications/initialized', {});
|
|
328
|
+
// Let flexible MCP App hosts follow resizing and details expansion.
|
|
329
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
330
|
+
let previousHeight;
|
|
331
|
+
const observer = new ResizeObserver(() => {
|
|
332
|
+
const height = Math.ceil(document.body.getBoundingClientRect().height);
|
|
333
|
+
if (height !== previousHeight) {
|
|
334
|
+
previousHeight = height;
|
|
335
|
+
sendNotification('ui/notifications/size-changed', {height});
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
observer.observe(document.body);
|
|
339
|
+
}
|
|
340
|
+
})
|
|
266
341
|
.catch(() => {
|
|
267
342
|
sourceInfo.textContent = 'Unable to initialize inspector';
|
|
268
343
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-source-inspector-app.js","sourceRoot":"","sources":["../../src/ui/page-source-inspector-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO
|
|
1
|
+
{"version":3,"file":"page-source-inspector-app.js","sourceRoot":"","sources":["../../src/ui/page-source-inspector-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoVN,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.98.0",
|
|
4
4
|
"description": "Intelligent MCP server providing AI assistants with powerful tools and resources for Appium mobile automation",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/appium/appium-mcp/issues"
|
|
@@ -70,22 +70,22 @@
|
|
|
70
70
|
"version": "npm run sync-version"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
+
"@appium/coresim": "^1.14.0",
|
|
73
74
|
"@appium/support": "^7.2.6",
|
|
74
75
|
"@modelcontextprotocol/sdk": "^1.22.0",
|
|
75
|
-
"@wdio/logger": "^
|
|
76
|
+
"@wdio/logger": "^10.0.0",
|
|
76
77
|
"@xmldom/xmldom": "^0.9.8",
|
|
77
78
|
"appium-adb": "^16.0.0",
|
|
78
|
-
"appium-ios-device": "^3.1.
|
|
79
|
+
"appium-ios-device": "^3.1.24",
|
|
79
80
|
"appium-uiautomator2-driver": "^8.0.0",
|
|
80
81
|
"appium-webdriveragent": "^16.0.0",
|
|
81
82
|
"appium-xcuitest-driver": "^12.1.0",
|
|
82
|
-
"fastmcp": "^4.
|
|
83
|
+
"fastmcp": "^4.22.4",
|
|
83
84
|
"ios-mobileprovision-finder": "^1.2.1",
|
|
84
85
|
"lru-cache": "^11.5.0",
|
|
85
|
-
"node-simctl": "^9.1.0",
|
|
86
86
|
"teen_process": "^4.2.1",
|
|
87
87
|
"webdriver": "^9.30.0",
|
|
88
|
-
"xpath": "^0.0.
|
|
88
|
+
"xpath": "^0.0.35",
|
|
89
89
|
"zod": "^4.3.6"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
@@ -114,8 +114,9 @@
|
|
|
114
114
|
},
|
|
115
115
|
"optionalDependencies": {
|
|
116
116
|
"@opentelemetry/api": "^1.9.1",
|
|
117
|
-
"@opentelemetry/exporter-trace-otlp-
|
|
118
|
-
"@opentelemetry/
|
|
117
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.223.0",
|
|
118
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.223.0",
|
|
119
|
+
"@opentelemetry/sdk-node": "^0.223.0",
|
|
119
120
|
"applesign": "^5.0.0"
|
|
120
121
|
},
|
|
121
122
|
"overrides": {
|
package/server.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"name": "io.github.appium/appium-mcp",
|
|
4
4
|
"title": "MCP Appium - Mobile Development and Automation Server",
|
|
5
5
|
"description": "MCP server for Appium mobile automation on iOS and Android devices with test creation tools.",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.98.0",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "appium-mcp",
|
|
11
|
-
"version": "1.
|
|
11
|
+
"version": "1.98.0",
|
|
12
12
|
"transport": {
|
|
13
13
|
"type": "stdio"
|
|
14
14
|
}
|
package/src/create-server.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import {FastMCP} from 'fastmcp';
|
|
17
17
|
|
|
18
18
|
import pkg from '../package.json' with {type: 'json'};
|
|
19
|
+
import {createHttpOriginPolicy} from './http-security.js';
|
|
19
20
|
import log, {configureStdioTransportLogging} from './logger.js';
|
|
20
21
|
import {PluginManager} from './plugin.js';
|
|
21
22
|
import type {AppiumMcpPlugin} from './plugin.js';
|
|
@@ -25,7 +26,7 @@ import {safeDeleteAllSessions, listSessions} from './session-store.js';
|
|
|
25
26
|
import {initializeOpenTelemetry} from './telemetry/init.js';
|
|
26
27
|
import {installTelemetryWrappers} from './telemetry/wrapOperations.js';
|
|
27
28
|
import registerTools from './tools/index.js';
|
|
28
|
-
import {TRANSPORT_TYPES} from './transport.js';
|
|
29
|
+
import {DEFAULT_HTTP_STREAM_OPTIONS, TRANSPORT_TYPES} from './transport.js';
|
|
29
30
|
import {validateConnectionPolicyEnv} from './utils/env.js';
|
|
30
31
|
|
|
31
32
|
const SERVER_VERSION = pkg.version as `${number}.${number}.${number}`;
|
|
@@ -111,17 +112,19 @@ export async function createAppiumMcpServer(options: CreateAppiumMcpServerOption
|
|
|
111
112
|
? `${SERVER_INSTRUCTIONS}\n${additionalInstructions}`
|
|
112
113
|
: SERVER_INSTRUCTIONS;
|
|
113
114
|
|
|
115
|
+
const httpOriginPolicy = createHttpOriginPolicy();
|
|
114
116
|
const server = new FastMCP({
|
|
115
117
|
name: serverName,
|
|
116
118
|
version: serverVersion,
|
|
117
119
|
instructions,
|
|
118
120
|
logger: FAST_MCP_LOGGER,
|
|
121
|
+
authenticate: httpOriginPolicy.authenticate,
|
|
119
122
|
// Appium MCP will not allow client to ask the local workspace/project folders.
|
|
120
123
|
roots: {
|
|
121
124
|
enabled: false,
|
|
122
125
|
},
|
|
123
126
|
});
|
|
124
|
-
|
|
127
|
+
wrapTransportStart(server, httpOriginPolicy.cors);
|
|
125
128
|
|
|
126
129
|
installPolicy(server, policy);
|
|
127
130
|
try {
|
|
@@ -267,12 +270,18 @@ export async function createAppiumMcpServer(options: CreateAppiumMcpServerOption
|
|
|
267
270
|
return server;
|
|
268
271
|
}
|
|
269
272
|
|
|
270
|
-
function
|
|
273
|
+
function wrapTransportStart(server: FastMCP, cors: ReturnType<typeof createHttpOriginPolicy>['cors']): void {
|
|
271
274
|
const originalStart = server.start.bind(server);
|
|
272
275
|
server.start = (async (startOptions) => {
|
|
273
276
|
if ((startOptions?.transportType ?? TRANSPORT_TYPES.stdio) === TRANSPORT_TYPES.stdio) {
|
|
274
277
|
configureStdioTransportLogging();
|
|
275
278
|
}
|
|
279
|
+
if (startOptions?.transportType === TRANSPORT_TYPES.httpStream) {
|
|
280
|
+
return originalStart({
|
|
281
|
+
...startOptions,
|
|
282
|
+
httpStream: {...DEFAULT_HTTP_STREAM_OPTIONS, ...startOptions.httpStream, cors},
|
|
283
|
+
});
|
|
284
|
+
}
|
|
276
285
|
return originalStart(startOptions);
|
|
277
286
|
}) as FastMCP['start'];
|
|
278
287
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import {NativeSimctl, SimDeviceState} from '@appium/coresim';
|
|
1
2
|
import {utilities} from 'appium-ios-device';
|
|
2
|
-
import {Simctl} from 'node-simctl';
|
|
3
3
|
|
|
4
4
|
import log from '../logger.js';
|
|
5
5
|
|
|
@@ -16,11 +16,7 @@ export interface IOSDevice {
|
|
|
16
16
|
*/
|
|
17
17
|
export class IOSManager {
|
|
18
18
|
private static instance: IOSManager;
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
private constructor() {
|
|
22
|
-
this.simctl = new Simctl();
|
|
23
|
-
}
|
|
19
|
+
private constructor() {}
|
|
24
20
|
|
|
25
21
|
/**
|
|
26
22
|
* Get the singleton instance of IOSManager
|
|
@@ -50,26 +46,15 @@ export class IOSManager {
|
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
try {
|
|
53
|
-
const devices = await
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
name: device.name,
|
|
63
|
-
udid: device.udid,
|
|
64
|
-
state: device.state,
|
|
65
|
-
type: 'simulator',
|
|
66
|
-
platform: runtime, // Runtime is already the iOS version (e.g., "18.2")
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return simulators;
|
|
49
|
+
const devices = await new NativeSimctl().getDevices();
|
|
50
|
+
return devices.map((device) => ({
|
|
51
|
+
name: device.name,
|
|
52
|
+
udid: device.udid,
|
|
53
|
+
state:
|
|
54
|
+
device.state === SimDeviceState.ShuttingDown ? 'Shutting Down' : (SimDeviceState[device.state] ?? 'unknown'),
|
|
55
|
+
type: 'simulator' as const,
|
|
56
|
+
platform: /SimRuntime\.[A-Za-z]+-(.+)$/.exec(device.runtimeIdentifier)?.[1].replace(/-/g, '.') ?? '',
|
|
57
|
+
}));
|
|
73
58
|
} catch (error) {
|
|
74
59
|
log.error(`Error listing iOS simulators: ${error}`);
|
|
75
60
|
return [];
|