Skip to content

Restart the MCP server after Android kills and re-creates the service - #87

Merged
ehoeve786 merged 1 commit into
mainfrom
mcp-restart-after-kill
Nov 16, 2026
Merged

ehoeve786 merged 1 commit into
mainfrom
mcp-restart-after-kill

Conversation

@ehoeve786

Copy link
Copy Markdown
Owner

When the phone is low on memory, Android kills SecureRemote and re-creates the sticky MCP service with a null intent. Tailscale resumes on its own in SecureRemoteApp.onCreate, but onStartCommand(null) started nothing, so the Funnel proxy answered every agent with 502 Bad Gateway ("SecureRemote's MCP server is not running on the phone") until the owner pressed Start.

  • A null intent now starts the server.
  • If Android refuses a foreground start from the background, the service stops instead of crash-looping.
  • A server the owner stopped (or that stopped on idle or screen-off) has called stopSelf(), so it is not re-created.

Generated by Claude Code

Tailscale resumes on its own when the process comes back, but the sticky restart
delivers a null intent that started nothing, so the proxy answered agents with
502 Bad Gateway until the owner pressed Start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiTeuLynZ1g6ie1LPaMmMU
@ehoeve786
ehoeve786 merged commit bccc909 into main Nov 16, 2026
6 checks passed
@ehoeve786
ehoeve786 deleted the mcp-restart-after-kill branch November 16, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants