Web-search-MCP

pritthwishGC/Web-search-MCP

3.3

If you are the rightful owner of Web-search-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Web Search MCP Server is a robust Model Context Protocol (MCP) server designed to enhance AI assistants with web search and page scraping capabilities.

Tools
2
Resources
0
Prompts
0

🔍 Web Search MCP Server

A powerful Model Context Protocol (MCP) server that brings web search and page scraping capabilities to your AI assistants! 🚀


✨ Features

FeatureDescription
🌐 Web SearchSearch the web using Google via Serper API
📄 Page ScrapingExtract content from any webpage using ScrapingDog
Edge DeploymentRuns on Cloudflare Workers for ultra-low latency
🔌 MCP CompatibleWorks with Claude, Kiro, and any MCP client
🔒 SecureAPI keys stored as encrypted secrets

🛠️ Tools

🔎 web_search

Search the web using Google via Serper API.

{
  "query": "latest AI news",
  "num_results": 10,
  "search_type": "search"
}
ParameterTypeRequiredDescription
querystringThe search query
num_resultsnumberResults count (1-100, default: 10)
search_typestringsearch | news | images

📄 scrape_page

Extract content from a web page.

{
  "url": "https://example.com",
  "render_js": true,
  "premium": false
}
ParameterTypeRequiredDescription
urlstringThe URL to scrape
render_jsbooleanEnable JavaScript rendering
premiumbooleanUse premium proxies

📁 Project Structure

📦 Web-search-MCP
├── 📂 src/
│   ├── 📄 index.ts              # 🚀 Main entry & router
│   ├── 📂 clients/
│   │   ├── 📄 serper.ts         # 🔍 Serper API client
│   │   └── 📄 scrapingdog.ts    # 🐕 ScrapingDog client
│   ├── 📂 handlers/
│   │   ├── 📄 mcp.ts            # 📡 MCP JSON-RPC handler
│   │   └── 📄 sse.ts            # 📺 SSE session handler
│   ├── 📂 tools/
│   │   ├── 📄 registry.ts       # 📋 Tool registry
│   │   ├── 📄 web-search.ts     # 🔎 Search tool
│   │   └── 📄 scrape-page.ts    # 📄 Scrape tool
│   └── 📂 validators/
│       └── 📄 index.ts          # ✅ Input validators
├── 📄 wrangler.toml             # ⚙️ Cloudflare config
├── 📄 package.json
├── 📄 tsconfig.json
└── 📄 vitest.config.ts

📋 Prerequisites

Before you begin, ensure you have:


🚀 Quick Start

1️⃣ Clone & Install

git clone https://github.com/pritthwishGC/Web-search-MCP.git
cd Web-search-MCP
npm install

2️⃣ Configure Local Environment

Create a .dev.vars file:

SERPER_API_KEY=your_serper_api_key_here
SCRAPINGDOG_API_KEY=your_scrapingdog_api_key_here

3️⃣ Run Locally

npm run dev

🎉 Server running at http://localhost:8787


☁️ Deployment

Step 1: Login to Cloudflare

npx wrangler login

Step 2: Set Your API Secrets 🔐

npx wrangler secret put SERPER_API_KEY
# 📝 Enter your Serper API key when prompted

npx wrangler secret put SCRAPINGDOG_API_KEY
# 📝 Enter your ScrapingDog API key when prompted

Step 3: Deploy 🚀

npm run deploy

✅ Your MCP server is now live at:

https://web-search-mcp-server.<your-subdomain>.workers.dev

🔑 Updating API Keys

💻 Via CLI (Recommended)

# 🔄 Update Serper API key
npx wrangler secret put SERPER_API_KEY

# 🔄 Update ScrapingDog API key  
npx wrangler secret put SCRAPINGDOG_API_KEY

🌐 Via Cloudflare Dashboard

  1. Go to dash.cloudflare.com
  2. Navigate to Workers & Pagesweb-search-mcp-server
  3. Click SettingsVariables and Secrets
  4. Click ✏️ Edit next to the secret
  5. Enter new value and Save

💡 No redeployment needed! Secrets update immediately.


🔌 MCP Client Configuration

Add this to your MCP client config:

{
  "mcpServers": {
    "web-search": {
      "url": "https://web-search-mcp-server.<your-subdomain>.workers.dev/mcp"
    }
  }
}

📍 Config File Locations

ClientLocation
🟦 Kiro (Workspace).kiro/settings/mcp.json
🟦 Kiro (User)~/.kiro/settings/mcp.json
🟣 Claude Desktopclaude_desktop_config.json

🌐 API Endpoints

MethodPathDescription
POST/mcp📡 MCP JSON-RPC endpoint
GET/sse📺 SSE connection
POST/message💬 MCP messages (SSE)
GET/health💚 Health check

🧪 Testing

# Run tests once
npm test

# Run tests in watch mode
npm run test:watch

📜 Scripts

CommandDescription
npm run dev🔧 Start local dev server
npm run deploy🚀 Deploy to Cloudflare
npm test🧪 Run tests
npm run test:watch👀 Watch mode

🔐 Environment Variables

VariableDescription
SERPER_API_KEY🔍 Serper API key for Google Search
SCRAPINGDOG_API_KEY🐕 ScrapingDog API key for scraping

📄 License

MIT © pritthwishGC


Made with ❤️ for the MCP community

⭐ Star this repo if you find it useful!