MCP HubMCP Hub
apify

mcp-server-rag-web-browser

by: apify

A MCP Server for the RAG Web Browser Actor

118created 06/12/2024
Visit
RAG
Web

πŸ“ŒOverview

Purpose: The MCP Server aims to facilitate fast interactions between AI agents and web content, enabling seamless browsing and information retrieval for language models.

Overview: The Model Context Protocol (MCP) Server for the RAG Web Browser Actor is designed to allow AI agents and large language models to perform web searches, scrape data, and extract information efficiently. Operating locally, it communicates with the RAG Web Browser Actor to enhance AI capabilities by enabling access to real-time web data.

Key Features:

  • Search Tool: Enables querying Google Search, scraping results, and returning cleaned content in Markdown format. It allows specification of search terms, the number of results, output formats, and scraping techniques.

  • Integration with AI Agents: Provides a straightforward API over standard input/output (stdio) for easy integration with AI Agents, supporting responsive web browsing and content extraction.


Model Context Protocol (MCP) Server for the RAG Web Browser Actor 🌐

Implementation of an MCP server for the RAG Web Browser Actor. This Actor serves as a web browser for large language models (LLMs) and RAG pipelines, similar to a web search in ChatGPT.

🎯 What does this MCP server do?

This server provides fast responses to AI agents and LLMs, allowing them to interact with the web and extract information from web pages. It runs locally and communicates with the RAG Web Browser Actor in Standby mode, sending search queries and receiving extracted web content in response.

The RAG Web Browser Actor allows an AI assistant to:

  • Perform web searches, scrape the top N URLs from the results, and return their cleaned content as Markdown
  • Fetch a single URL and return its content as Markdown

🧱 Components

Tools

  • search: Query Google Search, scrape the top N URLs from the results, and return their cleaned content as Markdown. Arguments:
    • query (string, required): Search term or URL
    • maxResults (number, optional): Maximum number of search results to scrape (default: 1)
    • scrapingTool (string, optional): Select a scraping tool for extracting web pages. Options: 'browser-playwright' or 'raw-http' (default: 'raw-http')
    • outputFormats (array, optional): Select one or more formats for the output. Options: 'text', 'markdown', 'html' (default: ['markdown'])
    • requestTimeoutSecs (number, optional): Maximum time in seconds for the request (default: 40)

πŸ”„ What is the Model Context Protocol?

The Model Context Protocol (MCP) is a framework that enables AI applications, such as Claude Desktop, to connect seamlessly with external tools and data sources.

For more details, visit the Model Context Protocol website or read the blog post What is MCP and why does it matter?.

πŸ€– How does the MCP Server integrate with AI Agents?

The MCP Server empowers AI Agents to perform web searches and browsing using the RAG Web Browser Actor.

Interested in building and monetizing your own AI agent on Apify? Check out the step-by-step guide for creating, publishing, and monetizing AI agents on the Apify platform.

πŸ”Œ Related MCP servers and clients by Apify

This server operates over standard input/output (stdio), providing a straightforward connection to AI Agents. Apify offers several other MCP-related tools:

Server Options

  • πŸ–₯️ This MCP Server – A local stdio-based server for direct integration with Claude Desktop
  • 🌐 RAG Web Browser Actor via SSE – Access the RAG Web Browser directly via Server-Sent Events without running a local server
  • πŸ‡¦ MCP Server Actor – MCP Server that provides AI agents with access to over 4,000 specialized Apify Actors

Client Options

  • πŸ’¬ Tester MCP Client – A user-friendly UI for interacting with any SSE-based MCP server

πŸ› οΈ Configuration

Prerequisites

  • MacOS or Windows
  • The latest version of Claude Desktop must be installed (or another MCP client)
  • Node.js (v18 or higher)
  • Apify API Token (APIFY_TOKEN)

Install

Follow the steps below to set up and run the server on your local machine:

  1. Clone the repository:
git clone git@github.com:apify/mcp-server-rag-web-browser.git
  1. Navigate to the project directory and install dependencies:
cd mcp-server-rag-web-browser
npm install
  1. Build the project:
npm run build

Claude Desktop Configuration

Configure Claude Desktop to recognize the MCP server:

  1. Open Claude Desktop configuration and edit the configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%/Claude/claude_desktop_config.json

    Add the following:

    "mcpServers": {
      "rag-web-browser": {
        "command": "npx",
        "args": [
          "@apify/mcp-server-rag-web-browser"
        ],
        "env": {
           "APIFY_TOKEN": "your-apify-api-token"
        }
      }
    }
    
  2. Restart Claude Desktop fully (quit and start again).

  3. Confirm connection by looking for the πŸ”Œ icon.

Example queries to try in Claude:

What is an MCP server and how can it be used?
What is an LLM, and what are the recent news updates?
Find and analyze recent research papers about LLMs.

Debugging the server using MCP Inspector:

export APIFY_TOKEN=your-apify-api-token
npx @modelcontextprotocol/inspector npx -y @apify/mcp-server-rag-web-browser

πŸ‘·πŸΌ Development

Local client (stdio)

To test the server locally, use the example client:

export APIFY_TOKEN=your-apify-api-token
node dist/example_client_stdio.js

The script will start the MCP server, fetch available tools, and call the search tool with a query.

Direct API Call

To test calling the RAG Web Browser Actor directly:

export APIFY_TOKEN=your-apify-api-token
node dist/example_call_web_browser.js

Debugging

Since MCP servers operate over standard input/output (stdio), debugging can be challenging. For best experience, use the MCP Inspector:

  1. Build the package:
npm run build
  1. Launch the MCP Inspector:
export APIFY_TOKEN=your-apify-api-token
npx @modelcontextprotocol/inspector node dist/index.js

The Inspector will display a URL to open in your browser to begin debugging.