Skip to main content
Glama
Google Search MCP Server

Google Search MCP Server

by hinsmoment
README.md
# Google Search MCP Server

> A powerful Model Context Protocol (MCP) server providing Google search and image search capabilities for Claude Code

[![MCP](https://img.shields.io/badge/MCP-compatible-green)](https://modelcontextprotocol.io)
[![中文文档](https://img.shields.io/badge/文档-中文版-red)](README_CN.md)
[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
[![Node.js](https://img.shields.io/badge/node.js-%3E%3D18.0.0-brightgreen)](https://nodejs.org)

---

## Features

### 🌐 Google Text Search
- Search Google with customizable result count
- Extract titles, links, and descriptions
- Support for multiple languages

### 📄 Web Content Extraction
- Extract main content from any webpage
- Smart content filtering (ads, navigation removed)
- Batch extraction support

### 🔍 Combined Search & Extract
- Search and auto-extract multiple results
- One-click deep content retrieval

### 🖼️ Image Search with AI Analysis ⭐
- **Dual-platform search**: Google Images + Pinterest
- **Multi-model AI visual analysis**: Supports GLM-4.6V, GPT-4O, Claude 3.5, and more
- **Quality scoring system**: S/A/B/C grading
- Perfect for finding product reference images

---

## Installation

### Prerequisites
- Node.js >= 18.0.0
- Claude Code with MCP support

### Setup

1. **Clone the repository**
```bash
git clone https://github.com/hinsmoment/google-search-mcp.git
cd google-search-mcp
```

2. **Install dependencies**
```bash
npm install
```

3. **Configure Claude Code**

Add to your Claude configuration (`~/.claude.json` or via Settings):

```json
{
  "mcpServers": {
    "google-search": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/google-search-mcp/server.js"]
    }
  }
}
```

4. **Restart Claude Code**

---

## Usage

### 1. Google Search

```
Search Google for "Claude Code AI assistant"
```

### 2. Extract Webpage Content

```
Extract content from https://example.com
```

### 3. Batch Extract URLs

```
Extract content from these URLs:
- https://github.com/topic1
- https://github.com/topic2
- https://github.com/topic3
```

### 4. Image Search (Product Reference)

```
Find similar products using this image: /path/to/product.jpg
```

---

## MCP Tools

| Tool | Description | Parameters |
|------|-------------|------------|
| `google_search` | Google text search | `query`, `maxResults` (1-25) |
| `fetch_url` | Extract webpage content | `url` |
| `batch_fetch_urls` | Batch extract multiple URLs | `urls` (array) |
| `search_and_extract` | Search + extract results | `query`, `maxResults` (1-10) |
| `search_by_image` | Image-based product search | `image_path`, `max_results`, `enable_ai_analysis` |

---

## Image Search Details

### How It Works

```
┌─────────────────┐
│  Upload Image   │
└────────┬────────┘
         ↓
┌─────────────────┐
│  AI Analysis    │
│  (Multi-Model)   │
│  - Product type │
│  - Keywords     │
└────────┬────────┘
         ↓
    ┌────┴────┐
    ↓         ↓
┌───────┐  ┌───────┐
│Google │  │Pinterest│
│Images │  │Search  │
└───┬───┘  └───┬───┘
    └────┬────┘
         ↓
┌─────────────────┐
│  Merge & Score  │
│  S/A/B/C Grades │
└─────────────────┘
```

### Quality Scoring

| Grade | Score | Sources |
|-------|-------|---------|
| **S** | 85-100 | Tmall HK, Tmall, JD Mall, Brand Sites |
| **A** | 75-84 | JD, Amazon, Taobao, Pinterest |
| **B** | 60-74 | Other e-commerce sites |
| **C** | < 60 | General websites |

---

## Technical Architecture

### Browser Automation
- **Puppeteer** (primary)
- **Playwright** (automatic fallback)

### Key Dependencies
```json
{
  "puppeteer": "^22.15.0"
}
```

### Module Structure
```
google-search-mcp/
├── server.js           # MCP server implementation
├── lib/
│   └── image-search.js # Image search module with AI analysis
├── package.json
└── README.md
```

---

## Configuration

### Optional: AI Analysis API Key

For enhanced image analysis, set your GLM API key:

```bash
# Linux/macOS
export GLM_API_KEY=your_api_key_here

# Windows (PowerShell)
$env:GLM_API_KEY="your_api_key_here"

# Windows (CMD)
set GLM_API_KEY=your_api_key_here
```

**Note**: The fallback keyword-based search works without an API key.

---

## Examples

### Example 1: E-commerce Product Research

```
Find similar products to: ./images/dinosaur-pencil-case.jpg
Return top 15 results with AI analysis enabled
```

**Output includes**:
- Product image analysis
- Keywords extracted
- Dual-platform results (Google + Pinterest)
- Quality scores with grades

### Example 2: Content Research

```
Search for "MCP protocol Model Context"
Extract full content from top 5 results
```

---

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

### Development Setup

```bash
# Install dependencies
npm install

# Run tests
npm test

# Start MCP server (for debugging)
node server.js
```

### Coding Standards

- Follow existing code style
- Add comments for complex logic
- Test your changes thoroughly

---

## Troubleshooting

### Puppeteer Chrome Download Issues

If Puppeteer fails to download Chrome:

```bash
# Skip Chrome download and use system Chrome
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer
```

### MCP Server Not Starting

1. Check Node.js version: `node --version` (requires >= 18.0.0)
2. Verify file path in Claude configuration
3. Check Claude Code logs for errors

### Image Search Returns No Results

- Verify image path is correct
- Check internet connection
- Try disabling AI analysis if API key issues

---

## Limitations

- Google search may be affected by anti-scraping measures
- Pinterest direct scraping is limited (uses Google `site:pinterest.com` filter)
- API-based AI analysis requires separate GLM API key

---

## Roadmap

- [ ] Add more image search platforms (Behance, Dribbble)
- [ ] Implement local image similarity matching (CLIP/DINOv2)
- [ ] Add result caching
- [ ] Support for more AI vision models

---

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## Acknowledgments

- [Model Context Protocol](https://modelcontextprotocol.io) by Anthropic
- [Puppeteer](https://pptr.dev) for browser automation
- [Zhipu AI](https://open.bigmodel.cn/) for GLM-4.6V vision model
- [OpenAI](https://openai.com/) for GPT-5.2 / GPT-4O vision model
- [Anthropic](https://www.anthropic.com/) for Claude 4.5 Sonnet vision model

---

## Author

Created by [成哥](https://github.com/hinsmoment)

**Special thanks**: Developed with Claude Code assistance

---

## Support

- 🐛 Report bugs: [GitHub Issues](https://github.com/hinsmoment/google-search-mcp/issues)
- 💡 Feature requests: [GitHub Discussions](https://github.com/hinsmoment/google-search-mcp/discussions)

---

<div align="center">

**⭐ Star this repo if it helps you!**

Made with ❤️ by the open-source community

</div>

TDQS

B3.2/5.0

Scored across 5 tools

Disambiguation4/5

Each tool has a recognizable lane: plain search, image search, single-page fetch, batch fetch, and a composite search+extract. The only overlap is search_and_extract, which composes the functionality of google_search plus fetch_url, so an agent may pick it when it wanted finer control over the two underlying steps.

Naming Consistency4/5

All names use consistent snake_case, which is readable and predictable. Verb placement varies slightly (batch_fetch_urls / fetch_url use verb-first, while google_search and search_by_image lead with the resource or modality), but the pattern is still easy to infer.

Tool Count5/5

Five tools is a tight, well-scoped surface for a search/fetch server: one primitive search, one image search, two fetch variants (single/batch), and one convenience composite. Nothing appears redundant at the count level.

Completeness4/5

Core search and content-extraction lifecycle is covered, including batching and image-based search. Minor gaps exist around result pagination, result-count/language/region parameters exposed as dedicated operations, and deeper page traversal, but agents can work around these with the existing tools.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues