Sponsored by Deepsite.site

Google Search MCP Server

Created By
mixelpixxa year ago
An MCP (Model Context Protocol) server that provides Google search capabilities and webpage content analysis tools. This server enables AI models to perform Google searches and analyze webpage content programmatically.
Content

# Built For use with Cline + VS Code!

Google Search MCP Server

An MCP (Model Context Protocol) server that provides Google search capabilities and webpage content analysis tools. This server enables AI models to perform Google searches and analyze webpage content programmatically.

Features

  • Advanced Google Search with filtering options (date, language, country, safe search)
  • Detailed webpage content extraction and analysis
  • Batch webpage analysis for comparing multiple sources
  • Environment variable support for API credentials
  • Comprehensive error handling and user feedback
  • MCP-compliant interface for seamless integration with AI assistants

Prerequisites

  • Node.js (v16 or higher)
  • Python (v3.8 or higher)
  • Google Cloud Platform account
  • Custom Search Engine ID
  • Google API Key

Installation

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

  2. Install Node.js dependencies: ```bash npm install ```

  3. Install Python dependencies: ```bash pip install flask google-api-python-client flask-cors beautifulsoup4 trafilatura markdownify ```

  4. Build the TypeScript code: ```bash npm run build ```

  5. Create a helper script to start the Python servers (Windows example): ```bash

    Create start-python-servers.cmd

    @echo off echo Starting Python servers for Google Search MCP...

    REM Start Python search server start "Google Search API" cmd /k "python google_search.py"

    REM Start Python link viewer start "Link Viewer" cmd /k "python link_view.py"

    echo Python servers started. You can close this window. ```

Configuration

API Credentials

You can provide Google API credentials in two ways:

  1. **Environment Variables** (Recommended):

    • Set `GOOGLE_API_KEY` and `GOOGLE_SEARCH_ENGINE_ID` in your environment
    • The server will automatically use these values
  2. **Configuration File**:

    • Create an `api-keys.json` file in the root directory: ```json { "api_key": "your-google-api-key", "search_engine_id": "your-custom-search-engine-id" } ```

MCP Settings Configuration

Add the server configuration to your MCP settings file:

For Cline (VS Code Extension)

File location: `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json`

```json { "mcpServers": { "google-search": { "command": "C:\\Program Files\\nodejs\\node.exe", "args": ["C:\\path\\to\\google-search-mcp\\dist\\google-search.js"], "cwd": "C:\\path\\to\\google-search-mcp", "env": { "GOOGLE_API_KEY": "your-google-api-key", "GOOGLE_SEARCH_ENGINE_ID": "your-custom-search-engine-id" }, "disabled": false, "autoApprove": [] } } } ```

For Claude Desktop App

File location: `%APPDATA%\Claude\claude_desktop_config.json`

```json { "mcpServers": { "google-search": { "command": "C:\\Program Files\\nodejs\\node.exe", "args": ["C:\\path\\to\\google-search-mcp\\dist\\google-search.js"], "cwd": "C:\\path\\to\\google-search-mcp", "env": { "GOOGLE_API_KEY": "your-google-api-key", "GOOGLE_SEARCH_ENGINE_ID": "your-custom-search-engine-id" }, "disabled": false, "autoApprove": [] } } } ```

Running the Server

  1. First, start the Python servers using the helper script: ```bash start-python-servers.cmd ```

  2. Configure the MCP settings to run only the Node.js server: ```json { "command": "C:\\Program Files\\nodejs\\node.exe", "args": ["C:\\path\\to\\google-search-mcp\\dist\\google-search.js"] } ```

Method 2: All-in-One Script

Start both the TypeScript and Python servers with a single command: ```bash npm run start:all ```

Available Tools

Search Google and return relevant results from the web. This tool finds web pages, articles, and information on specific topics using Google's search engine.

```typescript { "name": "google_search", "arguments": { "query": "your search query", "num_results": 5, // optional, default: 5, max: 10 "date_restrict": "w1", // optional, restrict to past day (d1), week (w1), month (m1), year (y1) "language": "en", // optional, ISO 639-1 language code (en, es, fr, de, ja, etc.) "country": "us", // optional, ISO 3166-1 alpha-2 country code (us, uk, ca, au, etc.) "safe_search": "medium" // optional, safe search level: "off", "medium", "high" } } ```

2. extract_webpage_content

Extract and analyze content from a webpage, converting it to readable text. This tool fetches the main content while removing ads, navigation elements, and other clutter.

```typescript { "name": "extract_webpage_content", "arguments": { "url": "https://example.com" } } ```

3. extract_multiple_webpages

Extract and analyze content from multiple webpages in a single request. Ideal for comparing information across different sources or gathering comprehensive information on a topic.

```typescript { "name": "extract_multiple_webpages", "arguments": { "urls": [ "https://example1.com", "https://example2.com" ] } } ```

Example Usage

Here are some examples of how to use the Google Search MCP tools:

``` Search for information about artificial intelligence ```

Advanced Search with Filters

``` Search for recent news about climate change from the past week in Spanish ```

Content Extraction

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

Multiple Content Comparison

``` Compare information from these websites:

Getting Google API Credentials

  1. Go to the [Google Cloud Console](https://console.cloud.google.com/)
  2. Create a new project or select an existing one
  3. Enable the Custom Search API
  4. Create API credentials (API Key)
  5. Go to the [Custom Search Engine](https://programmablesearchengine.google.com/about/) page
  6. Create a new search engine and get your Search Engine ID
  7. Add these credentials to your `api-keys.json` file

Error Handling

The server provides detailed error messages for:

  • Missing or invalid API credentials
  • Failed search requests
  • Invalid webpage URLs
  • Network connectivity issues

Architecture

The server consists of two main components:

  1. TypeScript MCP Server: Handles MCP protocol communication and provides the tool interface
  2. Python Flask Server: Manages Google API interactions and webpage content analysis

License

MIT

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server
Serper MCP ServerA Serper MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
Tavily Mcp
ChatWiseThe second fastest AI chatbot™
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
Playwright McpPlaywright MCP server