Search MCP Server
A Model Context Protocol (MCP) server for integrating Google Search capabilities into AI applications.
README
Search MCP Server
A Model Context Protocol (MCP) server for integrating Google Search capabilities into AI applications
π€ Native Claude Desktop integration - Use Google search directly in Claude!
Language / θ―θ¨: English | δΈζ
β οΈ Disclaimer
This project is for educational and research purposes only. It is a personal tool designed to help developers integrate search capabilities into their AI applications. Users are responsible for ensuring their use complies with applicable terms of service and applicable laws and regulations.
Important:
- This is NOT an official product of any search engine
- This is NOT affiliated with or endorsed by any search provider
- Google and Google Search are trademarks of Google LLC. This project is independent and not endorsed by or affiliated with Google.
- Users must comply with Google's Terms of Service
- Users must comply with Google's Automated Query Guidelines
- Respect rate limits and robots.txt
- Use at your own risk
Features
- β Google Search Integration - Leverage Google's powerful search engine
- β MCP Protocol Support - Native Claude Desktop integration via Model Context Protocol
- β REST API - Standard HTTP interface for web applications
- β Localized Search - Geographic location-based search results
- β Session Management - Cookie-based session persistence
- β Rate Limiting - Built-in request throttling for responsible use
- β Smart Retry - Automatic recovery with exponential backoff
Quick Start
Prerequisites
- Node.js 18+
- npm or yarn
Installation
# Clone repository
git clone https://github.com/CodeMK/search-mcp.git
cd search-mcp
# Install dependencies
npm install
# Install Playwright browser
npx playwright install chromium
# Copy environment config
cp .env.example .env
# Build the project
npm run build
Choose Your Mode
This project supports two modes - choose based on your use case:
π€ MCP Server Mode (Recommended for Claude Desktop)
Perfect for AI-assisted development with Claude Desktop:
search-mcp mcp
Then configure Claude Desktop following the MCP Setup Guide below.
π REST API Mode (For Web Applications)
Traditional HTTP API for web applications:
search-mcp start
Server runs on http://localhost:3000/api/search
π€ Claude Desktop Setup
Step 1: Find Config File
Windows:
%APPDATA%\Claude\claude_desktop_config.json
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Step 2: Add Configuration
{
"mcpServers": {
"search": {
"command": "node",
"args": ["D:\\search-mcp\\dist\\mcp-server.js"],
"env": {
"HEADLESS": "true",
"LOG_LEVEL": "info"
}
}
}
}
Important: Replace D:\\search-mcp with your actual project path. On macOS/Linux, use forward slashes: /path/to/search-mcp/dist/mcp-server.js
Step 3: Restart Claude Desktop
Completely quit and restart Claude Desktop.
Step 4: Test
In Claude Desktop, type:
Please use search to find "TypeScript tutorial"
API Usage
REST API Endpoint
curl -X POST http://localhost:3000/api/search \
-H "Content-Type: application/json" \
-d '{"query": "TypeScript", "region": "US"}'
MCP Tool (Claude Desktop)
Available as the search tool in Claude Desktop conversations.
Request Parameters:
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| query | string | β | - | Search keyword |
| region | string | β | auto | Country code (US, JP, GB, CN, etc.) |
| numResults | number | β | 10 | Number of results |
Response Example:
{
"statusCode": 200,
"result": {
"success": true,
"meta": {
"regionCode": "US",
"regionName": "United States",
"resultCount": 5,
"latency": 15000
},
"results": [
{
"rank": 1,
"title": "TypeScript: JavaScript with syntax for types",
"link": "https://www.typescriptlang.org/",
"snippet": "TypeScript is a strongly typed programming language..."
}
]
}
}
Configuration
Environment Variables
# Server Configuration
PORT=3000 # REST API server port
HOST=0.0.0.0 # Server host
LOG_LEVEL=info # Log level
# Browser Configuration
HEADLESS=true # Headless mode
DEVTOOLS=false # Enable DevTools
SLOW_MO=0 # Slow motion (ms)
# Search Configuration
DEFAULT_REGION=US # Default region
MAX_RESULTS=10 # Max results per search
Responsible Use
Rate Limiting
To ensure respectful and responsible use:
- Min Delay: 15 seconds between requests
- Max Delay: 30 seconds between requests
- Burst Limit: Max 2 requests per 3 minutes
Best Practices
- Respect robots.txt - Follow website guidelines
- Limit request frequency - Don't overload servers
- Use for legitimate purposes - Educational and research only
- Comply with Google ToS - Follow Google's Terms of Service
- Avoid automated queries - Respect Google's Automated Query Guidelines
Project Structure
search-mcp/
βββ src/
β βββ mcp-server.ts # MCP server entry point
β βββ index.ts # REST API entry point
β βββ cli.ts # CLI tool entry point
β βββ api/ # REST API routes
β βββ services/ # Core business logic
β βββ engines/ # Browser automation
β βββ utils/ # Utilities
β βββ config/ # Configuration
βββ dist/ # Compiled output
βββ data/ # Runtime data (cookies)
βββ logs/ # Application logs
βββ scripts/ # Utility scripts
Development
npm run dev # REST API development mode
npm run dev:mcp # MCP server development mode
npm run build # Build TypeScript
npm run start # Production REST API mode
npm run start:mcp # Production MCP mode
npm run test # Run tests
Documentation
- π MCP_GUIDE.md - Complete MCP setup and usage guide
- πͺ Cookie Management - See MCP_GUIDE.md
- π Development Guide - See MCP_GUIDE.md
Troubleshooting
Claude Desktop Cannot Connect
- β
Build project:
npm run build - β
Check config: Ensure path to
mcp-server.jsis correct - β
Check dependencies:
npm install - β Restart Claude Desktop completely
CAPTCHA Detected
- Set
HEADLESS=falsein.env - Restart the server
- Complete CAPTCHA manually in browser
- Cookies will be saved for future use
Connection Closed
- Wait 3-5 minutes before retrying
- System has automatic retry mechanism
- Check if burst limit was triggered
Legal & Ethics
Compliance
Users of this project must:
- β Comply with Google's Terms of Service
- β Respect Google's Automated Query Guidelines
- β Follow applicable laws and regulations
- β Respect website policies and guidelines (robots.txt)
- β Use only for legitimate educational purposes
Prohibited Uses
- β Commercial exploitation without permission
- β Spam or abuse of services
- β Violating intellectual property rights
- β Bypassing security measures for malicious purposes
- β Violating Google's Terms of Service or automated query policies
License
MIT License - See LICENSE file for details
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Acknowledgments
- Built with Playwright
- Implements Model Context Protocol
- Inspired by the AI development community
Resources
Note: This is a personal project for learning purposes. It is not affiliated with, endorsed by, or sponsored by any search provider or other company.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.