This example demonstrates how to use the Browserbase MCP server with E2B to create a web automation agent that can take screenshots and interact with web pages.
- Connect to Browserbase MCP server through E2B
- Use OpenAI Agents to automate web tasks
- Take screenshots of web pages
- Stream results in real-time
- E2B API key
- Browserbase API key
- Browserbase project ID
- Gemini API key (for Browserbase)
- OpenAI API key
-
Copy the environment template:
cp env.template .env
-
Fill in your API keys in the
.envfile:E2B_API_KEY=your_e2b_api_key BROWSERBASE_API_KEY=your_browserbase_api_key BROWSERBASE_PROJECT_ID=your_browserbase_project_id GEMINI_API_KEY=your_gemini_api_key OPENAI_API_KEY=your_openai_api_key -
Install dependencies:
npm install
-
Run the example:
npm start
The example creates an E2B sandbox with the Browserbase MCP server, connects an OpenAI Agent to it, and then asks the agent to take a screenshot of the E2B landing page and describe what it's about.