Skip to content

Bug: DXT Method Requires Port Change After Each Claude Desktop Restart #37

@samkarazi

Description

@samkarazi

Problem Summary
The Firefox Browser Control MCP using the DXT method fails to reconnect after Claude Desktop restarts, requiring manual port changes to restore functionality.
Steps to Reproduce

Install Firefox extension from addons.mozilla.org
Install mcp-server-v1.5.1.dxt in Claude Desktop
Configure Firefox extension with port (e.g., 8091) and secret key
Verify MCP works (can list tabs, open tabs, etc.)
Close Claude Desktop completely
Restart Claude Desktop
Test Firefox MCP tools

Expected Behavior
MCP should reconnect automatically using the same port configuration.
Actual Behavior

MCP tools fail with "WebSocket is not open" error
Port appears to remain bound from previous session
Workaround: Change port in both Firefox extension and Claude Desktop config
Temporary fix: Works until next restart, then cycle repeats

Environment

OS: Windows
Claude Desktop: Latest version (supporting DXT)
Firefox: Latest version
Extension: Browser Control MCP v1.5.0
MCP Server: BrowserControl v1.5.1 (DXT method)

Error Logs
2025-08-31T01:52:02.755Z [Firefox Control] [info] Message from client: {"method":"tools/call","params":{"name":"get-list-of-open-tabs","arguments":{}},"jsonrpc":"2.0","id":4}
2025-08-31T01:52:02.763Z [Firefox Control] [info] Message from server: {"result":{"content":[{"type":"text","text":"WebSocket is not open"}],"isError":true},"jsonrpc":"2.0","id":4}
Additional log pattern shows:

Server starts successfully: Server started and connected successfully
Server crashes unexpectedly: Server transport closed unexpectedly, this is likely due to the process exiting early

Root Cause Analysis

Port cleanup failure: WebSocket ports aren't properly released when Claude Desktop shuts down
Process management issue: DXT method doesn't handle graceful shutdown
Windows port binding: Ports remain "in use" after process termination

Workarounds That Work

Manual port cycling: Change port in both Firefox extension and Claude Desktop after each restart
Process cleanup: Kill orphaned Node.js processes before restart
Node.js method: Use JSON configuration instead of DXT (more stable)

Suggested Fixes

Improve DXT shutdown handling: Ensure proper WebSocket cleanup on Claude Desktop exit
Add port auto-detection: Try multiple ports if primary port is occupied
Better error messaging: Distinguish between "port in use" vs "extension not connected"
Process cleanup: Ensure MCP server process terminates cleanly

Impact

User experience: Requires manual intervention after each restart
Adoption barrier: Users may abandon setup thinking it's broken
Workaround dependency: Must change ports repeatedly

Additional Notes
The Node.js method appears more stable and doesn't exhibit this port binding issue, suggesting the problem is specific to the DXT packaging/process management.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions