fix(mcp-v2): clearer MCP error when target host hasn't enabled remote access#3922
Conversation
… missing When the relay returns 503 with "host not connected", the host's heartbeat to the API may still be healthy — the actual cause is that the desktop's exposeHostServiceViaRelay setting is off, so no tunnel exists. Surface that hint instead of "is not online".
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdated an error message in the host service client to provide users with specific, actionable troubleshooting steps when a host is not connected, replacing a generic notification with detailed instructions referencing the remote access security settings toggle. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 6/8 reviews remaining, refill in 10 minutes and 3 seconds.Comment |
Greptile SummaryThis PR improves the error message returned by Confidence Score: 5/5Safe to merge — single-line string change with no logic impact. The change is a trivial string update in a single branch of an error-formatting function. No logic, control flow, or data handling is affected, and the new message is clearly more actionable than the old one. No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/mcp-v2/src/host-service-client.ts | Single-line string change in describeRelayFailure — replaces "is not online" with a more actionable message that tells users to enable the remote-access toggle in Settings → Security. |
Sequence Diagram
sequenceDiagram
participant MCP as MCP Caller
participant Relay as Cloud Relay
participant Host as User's Host
MCP->>Relay: POST /hosts/{routingKey}/trpc/{procedure}
alt exposeHostServiceViaRelay = false (tunnel not open)
Relay-->>MCP: 503 "host not connected"
Note over MCP: describeRelayFailure()<br/>NEW: "Host X has not enabled remote access.<br/>Toggle 'Allow remote workspaces...' in Settings → Security"
else exposeHostServiceViaRelay = true (tunnel open)
Relay->>Host: Forward request
Host-->>Relay: Response
Relay-->>MCP: 200 OK (or other status)
end
Reviews (1): Last reviewed commit: "fix(mcp-v2): point users at remote-acces..." | Re-trigger Greptile
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
Improves the error message MCP callers see when the cloud relay can't reach a user's host because the host hasn't enabled the remote-access tunnel.
Root cause
Cloud MCP can only reach a user's host when the desktop's
exposeHostServiceViaRelaysetting is on (Pro plan + Settings → Security → "Allow remote workspaces to access this device"). That field defaults tofalse, so until a user explicitly toggles it on, the host-service never opens a tunnel to the relay.When MCP hits an un-tunneled host, the relay returns
503 host not connectedanddescribeRelayFailureinpackages/mcp-v2/src/host-service-client.tspreviously rendered that asHost {hostId} is not online.Why the previous message was misleading
The host's heartbeat to the API can be perfectly healthy — the host process is running, the user is signed in, the device shows online in the UI. "Not online" implied the user's machine was off or the app was closed, sending people down the wrong debugging path. The actual fix is one toggle in Settings.
Change
Single-line edit to the 503 + "host not connected" branch in
describeRelayFailure. New string:workspaces_create/workspaces_deletetool descriptions are intentionally left untouched — the error itself now carries the guidance, and tool descriptions are token-cost-per-call.Predecessor
Follows #3918, which fixed the relay path for workspaces and OAuth
client_nametracking.Test plan
workspaces_createagainst a host with the remote-access toggle off; confirm the new error string is returned instead of "is not online"Summary by CodeRabbit