browser-use-mcp-server icon indicating copy to clipboard operation
browser-use-mcp-server copied to clipboard

[BUG] [error] [browser-server] spawn browser-use-mcp-server ENOENT

Open iroy2000 opened this issue 1 year ago • 2 comments

Describe the bug

I'm using Claude Desktop, and I try to follow the readme and install the requirements.

I'm able to run browser-use-mcp-server in my terminal, the following command works

browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000

But when I try to hook it up to Claude with the following config, it failed

{ "mcpServers": { "browser-server": { "command": "browser-use-mcp-server", "args": [ "run", "server", "--port", "8000", "--stdio", "--proxy-port", "9000" ], "env": { "OPENAI_API_KEY": "my-open-ai-key" } } } }

2025-04-24T02:58:20.709Z [browser-server] [info] Initializing server...
2025-04-24T02:58:20.731Z [browser-server] [error] spawn browser-use-mcp-server ENOENT {"context":"connection","stack":"Error: spawn browser-use-mcp-server ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n    at onErrorNT (node:internal/child_process:483:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}
2025-04-24T02:58:20.731Z [browser-server] [error] spawn browser-use-mcp-server ENOENT {"stack":"Error: spawn browser-use-mcp-server ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n    at onErrorNT (node:internal/child_process:483:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}
2025-04-24T02:58:20.734Z [browser-server] [info] Server transport closed
2025-04-24T02:58:20.734Z [browser-server] [info] Client transport closed
2025-04-24T02:58:20.734Z [browser-server] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log.
2025-04-24T02:58:20.734Z [browser-server] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}

Screenshots

Image

If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: macOS
    • Version 15.3.1
  • Claude Desktop
    • Version 0.9.2

Additional context

Add any other context about the problem here.

iroy2000 avatar Apr 24 '25 03:04 iroy2000

Hey @iroy2000, thanks for pointing this out.

The underlying issue arises from the current architecture where we proxy the MCP SSE server through a stdio script, which introduces several problems:

Issues:

  • Log interference: Logs from the proxied SSE server, intended for browser-use, are passed through to the stdio client. These logs:
    • Appear as errors in tools like MCP Inspector (though they're ignored and thus still usable).
    • Can cause crashes in sensitive clients like Claude Desktop.
  • False error detection: Standard logs from the stdio server itself incorrectly appear as errors, even though they're harmless (ignored by Claude Desktop and MCP Inspector, but ideally shouldn't appear at all).

Temporary Fix:

  • Disabling browser-use logs can help mitigate crashes on sensitive clients (e.g., Claude Desktop):
    BROWSER_USE_LOGGING_LEVEL=result
    
    However, this solution is only temporary.

Next Steps:

A proper resolution likely requires refactoring the stdio module to remove the proxy entirely, as it was initially implemented only as a temporary workaround. I'm happy to accept contributions on this—I’ll also open a PR soon to address it.

michiosw avatar Apr 28 '25 04:04 michiosw

Here's a clearer, concise, and well-structured rewrite:


I've created a branch to address this issue over the coming days/weeks:

👉 43-bug-error-browser-server-spawn-browser-use-mcp-server-enoent

Thanks again for highlighting this important bug, @iroy2000!

michiosw avatar Apr 28 '25 04:04 michiosw