mobile-mcp-server 1.0.4 → 1.0.6

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/proxy_client.js +21 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobile-mcp-server",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "MCP server for Android emulator and Appium mobile automation",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
package/proxy_client.js CHANGED
@@ -18,6 +18,24 @@ async function main() {
18
18
  if (!line.trim()) return;
19
19
  try {
20
20
  const request = JSON.parse(line);
21
+
22
+ // 🛡️ JSON-RPC Spec: If ID is missing, it's a notification.
23
+ // We should forward it but NEVER respond to it.
24
+ if (request.id === undefined) {
25
+ // Forward notification silently
26
+ fetch(SERVER_URL, {
27
+ method: "POST",
28
+ headers: {
29
+ "Content-Type": "application/json",
30
+ "Accept": "application/json, text/event-stream",
31
+ "x-mcp-key": API_KEY
32
+ },
33
+ body: JSON.stringify(request)
34
+ }).catch(() => { }); // Fire and forget
35
+ return;
36
+ }
37
+
38
+ // It's a request, use the robust forwarder
21
39
  await forwardRequest(request);
22
40
  } catch (e) {
23
41
  process.stderr.write(`[Proxy Error] Malformed JSON from Stdio: ${e.message}\n`);
@@ -102,8 +120,9 @@ async function forwardRequest(request) {
102
120
  } catch (error) {
103
121
  process.stderr.write(`[Proxy Error] ${error.message}\n`);
104
122
 
105
- // Return valid JSON-RPC error back to Claude so it doesn't crash with ZodError
106
- if (requestId !== null || request.method) {
123
+ // 🛡️ CRITICAL: Never respond to a Notification (no ID)
124
+ // Only respond if we have a requestId (even 0 is valid)
125
+ if (requestId !== null) {
107
126
  process.stdout.write(JSON.stringify({
108
127
  jsonrpc: "2.0",
109
128
  error: {