# Web Search MCP (`silicatelabs/web-search-mcp`) Actor

An Apify Actor that runs a persistent **Model Context Protocol (MCP) server**, giving AI assistants real-time web search capabilities. Connect Claude Desktop, Cursor, or any MCP-compatible AI client to search the web without leaving your workflow.

- **URL**: https://apify.com/silicatelabs/web-search-mcp.md
- **Developed by:** [Silicate Labs](https://apify.com/silicatelabs) (community)
- **Categories:** MCP servers, AI, Automation
- **Stats:** 2 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Web Search MCP Server

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-brightgreen)](https://apify.com/actors)
[![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-blue)](https://modelcontextprotocol.io)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)

An Apify Actor that runs a persistent **Model Context Protocol (MCP) server**, giving AI assistants real-time web search capabilities. Connect Claude Desktop, Cursor, or any MCP-compatible AI client to search the web without leaving your workflow.

### Features

- 🔍 **search\_web** — Search the web via DuckDuckGo (free, no key) or Brave Search (higher quality)
- 📰 **search\_news** — Search for recent news articles
- 📄 **fetch\_page** — Fetch and extract clean text content from any URL
- 🔐 **Domain whitelist** — Restrict `fetch_page` to approved domains
- 📊 **Audit log** — Optionally log all searches to an Apify dataset
- ⚡ **Always-on** — Runs in Apify Standby mode for persistent 24/7 availability

### Quick Start

#### 1. Run on Apify

1. Go to the [Apify Console](https://console.apify.com) and find this actor
2. Click **Try for free** → configure inputs → **Start**
3. Copy the **Standby URL** from the actor run logs (looks like `https://web-search-mcp.username.apify.actor`)

#### 2. Connect to Claude Desktop

Add the following to your Claude Desktop `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "web-search": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://your-standby-url/sse"]
    }
  }
}
```

Restart Claude Desktop and you'll see the tools appear in the interface.

#### 3. Connect to Cursor / other MCP clients

Set the SSE URL to: `https://YOUR-STANDBY-URL/sse`

### Input Configuration

| Parameter | Type | Default | Description |
|---|---|---|---|
| `defaultMaxResults` | integer | `10` | Default number of results returned per search |
| `braveApiKey` | string | — | Optional [Brave Search API key](https://brave.com/search/api/) for better results |
| `enableFetchTool` | boolean | `true` | Enable the `fetch_page` tool |
| `enableNewsTool` | boolean | `true` | Enable the `search_news` tool |
| `allowedDomains` | string\[] | `[]` | Whitelist domains for `fetch_page` (empty = all allowed) |
| `logSearches` | boolean | `false` | Log all queries to the Apify dataset |

### MCP Tools Reference

#### `search_web`

Search the web and get ranked results.

**Parameters:**

- `query` (string, required) — The search query
- `maxResults` (integer, optional, default: 10) — Number of results (1–50)
- `safeSearch` (enum, optional) — `strict`, `moderate`, or `off`

**Returns:** Ranked list of results with title, URL, and snippet.

***

#### `search_news`

Search for recent news articles.

**Parameters:**

- `query` (string, required) — News search query
- `maxResults` (integer, optional) — Number of articles (1–20)

**Returns:** List of news articles with publication time when available.

***

#### `fetch_page`

Fetch a web page and return its clean text content.

**Parameters:**

- `url` (string, required) — Full URL to fetch
- `maxLength` (integer, optional, default: 8000) — Max characters (500–50000)

**Returns:** Page title, meta description, and extracted body text.

### API Endpoints

| Endpoint | Method | Description |
|---|---|---|
| `/sse` | GET | MCP SSE connection endpoint |
| `/messages?sessionId=X` | POST | MCP message handler |
| `/health` | GET | Health check + active sessions |
| `/` | GET | Server info and instructions |

### Architecture

```
AI Client (Claude, Cursor, etc.)
        │ SSE connection
        ▼
  Express HTTP Server (:3000)
        │
  MCP Server (McpServer)
        │
  ┌─────┴──────────┐
  │   Search Tools  │
  └─────┬──────────┘
        │
  ┌─────┴─────────────────────┐
  │ DuckDuckGo HTML API        │ (default, no key needed)
  │ Brave Search REST API      │ (optional, with API key)
  └────────────────────────────┘
```

### Local Development

```bash
git clone https://github.com/your-org/web-search-mcp
cd web-search-mcp
npm install
npm start
```

The server starts on `http://localhost:3000`. Connect any MCP client to `http://localhost:3000/sse`.

### Example Usage (in Claude)

Once connected, you can ask Claude:

> *"Search for the latest news about AI regulations in Europe"*

> *"What are the top Python web frameworks in 2025? Search the web and summarize."*

> *"Fetch the content from https://example.com/blog/post and summarize the key points."*

### License

Apache 2.0 — see [LICENSE](LICENSE)

# Actor input Schema

## `defaultMaxResults` (type: `integer`):

Default number of search results returned per query (tools can override this).

## `braveApiKey` (type: `string`):

Optional Brave Search API key for higher-quality results. Leave empty to use DuckDuckGo (no key required).

## `enableFetchTool` (type: `boolean`):

Allow the MCP client to fetch and extract full page content from any URL.

## `enableNewsTool` (type: `boolean`):

Allow the MCP client to search for recent news articles.

## `allowedDomains` (type: `array`):

Whitelist of domains the fetch\_page tool can access. Leave empty to allow all.

## `logSearches` (type: `boolean`):

Save every search query and result count to the Apify dataset for auditing.

## Actor input object example

```json
{
  "defaultMaxResults": 10,
  "enableFetchTool": true,
  "enableNewsTool": true,
  "logSearches": false
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("silicatelabs/web-search-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("silicatelabs/web-search-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call silicatelabs/web-search-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,silicatelabs/web-search-mcp"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wnnRm9SxLcSByLsqm/builds/JtRHhjmzjX2RNnm5O/openapi.json
