Versatile browser automation tool for webpage analysis and AI integration using Playwright and MCP protocol
rag-browser
is a versatile browser automation tool built on Playwright, designed to support both CLI and MCP server modes. It provides robust functionality for web page analysis and execution of complex browser actions programmatically. By integrating with the Model Context Protocol (MCP), rag-browser
enables AI applications to perform intricate browser tasks seamlessly.
The rag-browser
MCP server offers a range of features that make it an ideal solution for integrating into AI workflows. It supports CLI mode for direct webpage analysis and MCP server mode for programmatic interaction with web pages through structured JSON action plans. Key capabilities include:
These features make rag-browser
highly flexible, supporting a wide range of use cases from simple page analysis to complex browser interactions required by AI applications.
The architecture of the rag-browser
MCP server revolves around leveraging Playwright's capabilities within an MCP-compatible framework. The protocol implementation involves handling commands sent by MCP clients, executing specified actions on web pages, and returning structured data to provide a seamless integration experience for AI applications.
This setup ensures that the rag-browser
MCP server can handle various types of interactions required by AI applications, from data extraction to task automation.
To start using the rag-browser
MCP server, ensure you have either Bun or Node.js (version 16+) installed.
Bun (Recommended): Install it with the following command:
curl -fsSL https://bun.sh/install | bash
Node.js: At least version 16+.
Once you have these prerequisites, follow one of the installation options below:
You can run rag-browser
directly from GitHub without cloning the repository. Use either Bun or Node.js/npm to execute it.
# Execute using Bun (Recommended)
bunx github:aashari/rag-browser --url "https://example.com"
# Execute using npm
npx -y github:aashari/rag-browser --url "https://example.com"
For those who prefer a local installation, you can clone the repository or install it directly.
Clone the repository:
git clone https://github.com/aashari/rag-browser.git
cd rag-browser
Run using Node.js:
npm install
node ./dist/src/index.ts --url "https://example.com"
Alternatively, use Bun to run directly from the source code:
bun install
bun src/index.ts --url "https://example.com"
The rag-browser
MCP server is particularly useful for automating tasks within AI workflows that require interaction with web pages. Some common use cases include:
Suppose you have an E-commerce website that updates its product listings frequently. You can set up a script using rag-browser
to periodically scrape the latest products and update your local database:
// Example TypeScript code snippet for scraping data
import { playwright } from 'rag-browser';
async function fetchProductData() {
const browser = await playwright.launch({ headless: false });
const page = await browser.newPage();
// Navigate to target URL and wait for specific elements to load
await page.goto('https://example.com/products');
await page.waitForSelector('.product-listing');
// Extract product data as JSON
const productsData = await page.evaluate(() => {
return document.querySelectorAll('.product-listing').map(item => ({
name: item.querySelector('.name').innerText,
price: item.querySelector('.price').innerText
}));
});
// Log or save the extracted data
console.log(productsData);
// Close the browser once done
await browser.close();
}
// Schedule this function to run periodically using a cron job or similar scheduler.
To integrate rag-browser
into your AI application, you need to configure an MCP client. The following sample configuration shows how to set up the integration:
{
"mcpServers": {
"rag-browser": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-rag-browser"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
rag-browser
as an MCP server within your environment.By following these steps, you can fully leverage the capabilities of rag-browser
through your AI application's workflows.
The rag-browser
MCP server is designed to be highly compatible and performant across different environments. Here’s a compatibility matrix showcasing its support for various MCP clients:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ✅ | Tools Only |
This matrix highlights that rag-browser
is fully compatible with both resources and prompts in MCP clients like Claude Desktop and Continue, but only supports tools for the Cursor client.
For advanced users, you can configure rag-browser
using environment variables and custom command arguments. Here are some tips:
Environment Variables:
{
"API_KEY": "your-api-key",
"TIMEOUT": "30000", // Set a custom timeout value if needed
"HEADLESS_MODE": true/false // Enable or disable headless mode
}
Custom Command Arguments:
node dist/src/index.ts --url "https://example.com" --timeout 60000
Additionally, ensure that sensitive information such as API keys are securely managed and not hardcoded in your scripts.
How do I integrate rag-browser
with Continue?
Continue
.What is the difference between resources, tools, and prompts?
Can I run rag-browser
in headless mode?
HEADLESS_MODE
to true when configuring the environment variables.How do I handle large volumes of data extraction?
What if I encounter errors while running the MCP commands?
Contributions to the rag-browser
project are welcome! Here’s how you can contribute:
To get started with development:
Join the broader MCP ecosystem to stay updated on the latest protocols, tools, and clients:
By participating in the wider MCP community, you can benefit from shared insights and collaborate on innovative solutions.
This comprehensive MCP server documentation positions rag-browser
as a valuable tool for developers building AI applications requiring robust browser automation capabilities.
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods