ScreenSync MCP guide

MCP Server Not Connecting to Android? Fix Pairing and mDNS

Fix an MCP server not connecting to your Android phone by checking the hub, Wi-Fi, firewall and pairing token in order, and get frames streaming again.

Android phone and laptop linked through a Wi-Fi router, with a magnifier scanning the local network for a hidden hub

If your Model Context Protocol (MCP) server is not connecting to your Android phone, the fault usually sits in one of four layers: the hub is not running (or lost its port), the phone cannot reach the PC over Wi-Fi, the pairing token does not match, or the phone is linked but not capturing. ScreenSync MCP is a free Android MCP server, and this guide walks through each layer in order, using the same checks the app and hub run themselves, so you fix the real fault instead of rescanning the QR code and hoping.

How the phone finds the hub

The ScreenSync desktop hub is a small Node.js process that listens on HTTP port 3000 and talks to your AI client over stdio. The Android app can find it in three ways:

  1. Pairing link or QR code. At startup the hub prints a QR code and a link of the form screensync://pair?url=...&token=.... Scanning it gives the app both the address and the bearer token.
  2. mDNS. The hub advertises itself as _screensync-hub._tcp and the app browses for it. This is DNS-based service discovery, the same mechanism Android exposes as network service discovery.
  3. LAN scan fallback. If mDNS finds nothing within about three seconds, the app probes every address on its own /24 subnet at port 3000 and accepts only a /health reply that identifies itself as screensync-hub.

While the hub is unreachable and Auto-discover hub (mDNS) is on (the default), the app repeats this every 20 seconds. Two details matter later. The mDNS scan button in Settings > Hub runs mDNS only; the subnet scan runs during automatic discovery. And an address you typed by hand always wins over one that discovery finds.

Method Needs Typical failure
QR / pairing link Correct LAN IP in the link Hub picked a virtual adapter's IP
mDNS Multicast between devices Router filters multicast or isolates clients
LAN scan Same /24 subnet, port 3000 Different subnet or custom port

Step 1: Confirm the hub is actually running

Start with the PC. If you launched the hub with start-hub.bat or start-hub.sh, the terminal shows a pairing QR and must stay open. Then ask the hub directly:

# On the PC that runs the hub
curl http://localhost:3000/health
# {"ok":true,"service":"screensync-hub","version":"1.14.4","port":3000,...}

# Is something else holding port 3000?
netstat -ano | findstr :3000     # Windows
lsof -i :3000                    # macOS / Linux

If /health returns HTML or a 404, another program owns port 3000, such as a local dev server. The hub detects this at startup and reports that the port is occupied by an unrelated service. From then on, control_* and web_* tool calls fail with that diagnosis instead of a vague error. Stop the other program or move the hub to a free port (see the FAQ below).

One case looks alarming but is normal. If a hub already owns the port and your MCP client starts a second copy, the second copy logs that it found an existing hub and continues in MCP-only mode, using the hub that is already running.

Step 2: Test the network path from the phone

This one test separates network problems from app problems. On the phone, open a browser and go to http://<PC-IP>:3000/health. The /health route needs no token.

  • JSON containing "service":"screensync-hub": the network is fine. Skip to Step 3.
  • Timeout or "site can't be reached": the phone cannot reach the PC. Work through the checks below.

On a real phone, 127.0.0.1 and localhost point at the phone itself, not at your PC, so always use the PC's LAN address.

Use the right IP address

The hub builds its pairing link from the first non-internal IPv4 address it finds. On a PC with WSL, Hyper-V, Docker, VirtualBox or a VPN adapter, that can be a virtual interface the phone cannot reach. Compare the address in the pairing link with your real Wi-Fi or Ethernet address (ipconfig on Windows, ipconfig getifaddr en0 on most Macs, ip -4 addr on Linux). If they differ, type http://<real-IP>:3000 into Hub URL or pairing link in Settings > Hub and tap Save & ping, then enter the token and tap Save token.

Open the firewall

On Windows, the first time Node.js listens you usually get a firewall prompt. If you dismissed it, or allowed only private networks while Windows treats your Wi-Fi as public, inbound connections are dropped. Set the network profile to Private, or add a rule from an elevated prompt:

netsh advfirewall firewall add rule name="ScreenSync hub" dir=in action=allow protocol=TCP localport=3000 profile=private

That rule covers the HTTP connection and the LAN scan. mDNS uses UDP port 5353, so allowing Node.js itself on private networks is the cleaner fix. On macOS, allow node to accept incoming connections when prompted. On Linux with ufw, run sudo ufw allow 3000/tcp and sudo ufw allow 5353/udp.

Router and network settings

  • Guest networks and client isolation block device-to-device traffic entirely. Put both devices on the main network.
  • Multicast filtering, common on mesh and office Wi-Fi, breaks mDNS but leaves normal HTTP working, so the LAN scan or a typed address still succeeds.
  • Separate subnets (a wired PC on 192.168.0.x and a phone on 192.168.1.x) defeat both mDNS and the /24 scan. Use the typed address if your router routes between them.
  • VPNs on either device can hide the local network. Pause the VPN or enable its local-network access option.
  • Mobile data: confirm the phone is on Wi-Fi and has not fallen back to cellular.

Step 3: Fix pairing and token mismatches

If /health works from the phone but the app still complains, read the status line under Settings > Hub.

"Hub reachable, but it rejected this pairing token" (the app shows AUTH PROBLEM and a Re-pair button) means /health answered but an authenticated call was refused (401 or 403). The phone's token must equal SCREEN_SYNC_TOKEN on the hub. The same applies to your MCP client: if the hub runs from start-hub.bat with a custom token and the client config carries a different one, the client's calls are refused too. Pick one token and use it in all three places.

The /pair page returns 403 on the phone. That is deliberate. /pair and /api/pair hand out the token, so by default they answer only on the PC itself. Open http://localhost:3000/pair on the PC and scan the QR from that screen. This also helps when your MCP client started the hub and no terminal window is visible.

"Pairing window closed". Once a device has paired and 10 minutes have passed since the hub started, /pair stops serving the token. An already-paired phone only needs the address. To pair a new device, restart the hub, or set SCREEN_SYNC_PAIR_WINDOW_MINUTES=0 if you accept the token staying available.

The PC's IP changed. Because a typed address beats a discovered one, a stale manual address blocks auto-discovery after your router hands out a new IP. Tap the hub in the mDNS scan results, which saves its address, or enter the new one. A DHCP reservation on the router prevents a repeat.

On shared networks, replace the default screensync-local-dev token, and only set SCREEN_SYNC_ALLOW_LAN_PAIR=true on networks you fully trust. Our MCP security checklist for phone control covers the rest.

Step 4: Linked, but no screenshots

A green connection badge only proves the link. Frames arrive only while a screen-capture session is running, and Android asks for MediaProjection consent each session. If the dashboard says NO CAPTURE or the live strip stays on WAITING, tap Grant screen capture and accept the prompt.

Ask your agent to call get_device_status, or check it yourself:

curl -H "Authorization: Bearer <TOKEN>" http://localhost:3000/api/device/status

The state field reads streaming (a frame arrived in the last 60 seconds), linked_no_frames (the app is connected but not capturing) or no_phone (the app is not on the hub's live event stream).

Control is a separate link. Tools such as control_tap and control_swipe run through ADB from the hub, not over the app's Wi-Fi connection, so they can fail while screenshots work. Call control_status first. If it reports that no ADB device is online, connect over USB or follow our guide to Android wireless debugging for an MCP server.

Step 5: Check the MCP client side

Sometimes the phone is fine and the client never started the server. ScreenSync runs as a local stdio server, so the client launches node itself. In Claude Code, claude mcp list or /mcp shows whether it connected (see the Claude Code MCP documentation). Register it with:

claude mcp add --env SCREEN_SYNC_TOKEN=<TOKEN> --transport stdio screensync -- node "<path>/screensync-hub.js"

For Claude Desktop, the claude_desktop_config.json entry looks like this:

{
  "mcpServers": {
    "screensync": {
      "command": "node",
      "args": ["<path>/screensync-hub.js"],
      "env": { "SCREEN_SYNC_TOKEN": "<TOKEN>" }
    }
  }
}

Use an absolute path and Node.js 18 or later. Cursor and VS Code also run stdio servers; check your client's MCP docs for where the config lives. ChatGPT's web app only connects to remote HTTPS MCP servers, so it cannot use this hub. If you also use the browser extension, note that browsers cannot do mDNS: the extension probes localhost and accepts a typed URL, as described on the browser extension page.

Frames travel from the phone to the hub over your own network and never reach EpsolDev servers, while screenshots your agent requests are sent to that agent's model provider. The ScreenSync data policy has the full detail.

Next steps

  • Starting fresh? Follow the ScreenSync setup guide from the top.
  • Once get_device_status reports streaming, run the inspect_latest_mobile_screen prompt for a first look at your app.
  • Reserve a fixed LAN IP for your PC on the router so pairing survives restarts.

Next steps

FAQ

Questions, answered

Why does the app say "Hub offline" when the hub window is open?

Usually the phone cannot reach the PC's address, not that the hub is down. Open http://<PC-IP>:3000/health in the phone's browser. If it times out, check that both devices share a non-guest Wi-Fi network, that the firewall allows Node.js on private networks, and that the pairing link carries your real LAN IP rather than a virtual adapter's.

Does ScreenSync discovery work on guest or hotel Wi-Fi?

Often not. Guest and hotel networks usually isolate clients from each other, which blocks mDNS, the subnet scan and the direct HTTP connection alike. Your own home or office router, where you control isolation and multicast settings, is far more reliable. If you must use a shared network, set a non-default SCREEN_SYNC_TOKEN so other guests cannot use the default one.

Can I open the /pair page on my phone instead of scanning the QR code?

Not by default. The /pair and /api/pair routes serve the pairing token, so the hub answers them only on the PC itself and returns 403 to other devices. Open localhost:3000/pair on the PC and scan its QR, or paste the pairing link into Settings > Hub. SCREEN_SYNC_ALLOW_LAN_PAIR=true lifts the restriction on networks you fully trust.

How do I run the ScreenSync hub on a port other than 3000?

Pass the port to the launcher: start-hub.bat 3001 on Windows or ./start-hub.sh 3001 on macOS and Linux, which sets SCREEN_SYNC_PORT for you. Put the same SCREEN_SYNC_PORT value in your MCP client's env block so both processes agree. The phone's LAN scan only probes port 3000, so pair by QR code, mDNS or a typed address.

Why do screenshots work but tap and swipe tools fail?

They use different connections. Screenshots come from the app over your Wi-Fi, while control tools such as control_tap run through ADB from the hub. Call control_status: if it reports that no ADB device is online, connect the phone by USB or set up wireless debugging. On Xiaomi phones running MIUI or HyperOS, also enable USB debugging (Security settings) in Developer options.

Written by

ScreenSync MCP team

The ScreenSync MCP team at EpsolDev builds the Android app, the desktop MCP hub and the browser extension that let AI agents see and control a real phone. These guides come out of that work.