Open
Description
Issue Description
When attempting to use Stagehand MCP with a local Chrome instance (CDP on port 9222), I encountered the following errors:
Cannot create proxy with a non-object as target or handler.
-
You seem to be calling page on a page in an uninitialized Stagehand object. Ensure you are running await stagehand.init() on the Stagehand object before referencing the page object.
Steps to Reproduce
- Start Chrome with remote debugging enabled:
--remote-debugging-port=9222
-
- Start the Stagehand MCP server with the correct LOCAL_CDP_URL.
-
- Attempt to use browser automation via MCP.
Solution
The issue was resolved by ensuring that await stagehand.init()
is called before any reference to the page
object. In my case, the initialization was either missing or not awaited properly, causing the errors above. After adding and properly awaiting stagehand.init()
, the errors were resolved and browser automation worked as expected.
Suggestion
Consider adding clearer error messages or documentation to help users ensure proper initialization order, especially when using Stagehand in local mode.
Thank you for your work on this project!
Metadata
Metadata
Assignees
Labels
No labels