LM

limklister/mcp-google-custom-search-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

47 stars 17 forks 质量 66 趋势 0MIT

limklister/mcp-google-custom-search-server 是从 https://github.com/limklister/mcp-google-custom-search-server. 导入的 MCP 服务器候选

概览

limklister/mcp-google-custom-search-server 是从 https://github.com/limklister/mcp-google-custom-search-server. 导入的 MCP 服务器候选

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,通过谷歌的自定义搜索API提供网页搜索功能。该服务器使语言学习模型(LLM)能够通过标准化接口进行网页搜索。

🌟 特色

  • 与谷歌自定义搜索API无缝集成
  • 符合模型上下文协议(MCP)的服务器实现
  • 使用 TypeScript 实现的类型安全
  • 环境变量配置
  • 使用 Zod 进行输入验证
  • 可配置搜索结果(每个查询最多10个)
  • 格式化搜索结果,包括标题、网址和描述
  • 错误处理与验证
  • 兼容 Claude Desktop 及其他 MCP 客户端

📋 先修条件

在开始之前,请确保你具备:

  1. 一个支持自定义搜索API的谷歌云项目
  • 访问谷歌云控制台
  • 启用自定义搜索API
  • 创建API凭证
  1. 自定义搜索引擎ID
  • 访问可编程搜索引擎
  • 创建一个新的搜索引擎
  • 获取你的搜索引擎ID
  1. 地方发展要求:
  • Node.js(V18或更高)
  • NPM(随Node.js附赠)

🚀 快速启动

  1. 克隆仓库:

  2. 安装依赖:

  3. 创建一个 .env 文件:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Google Custom Search Server

A Model Context Protocol (MCP) server that provides web search capabilities through Google’s Custom Search API. This server enables Language Learning Models (LLMs) to perform web searches using a standardized interface.

🌟 Features

  • Seamless integration with Google Custom Search API
  • Model Context Protocol (MCP) compliant server implementation
  • Type-safe implementation using TypeScript
  • Environment variable configuration
  • Input validation using Zod
  • Configurable search results (up to 10 per query)
  • Formatted search results including titles, URLs, and descriptions
  • Error handling and validation
  • Compatible with Claude Desktop and other MCP clients

📋 Prerequisites

Before you begin, ensure you have:

  1. A Google Cloud Project with Custom Search API enabled

  2. A Custom Search Engine ID

  3. Local development requirements:

    • Node.js (v18 or higher)
    • npm (comes with Node.js)

🚀 Quick Start

  1. Clone the repository:

    git clone https://github.com/limklister/mcp-google-custom-search-server.git
    cd mcp-google-custom-search-server
    
  2. Install dependencies:

    npm install
    
  3. Create a .env file:

    GOOGLE_API_KEY=your-api-key
    GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id
    
  4. Build the server:

    npm run build
    
  5. Start the server:

    npm start
    

🔧 Configuration

Environment Variables

Variable Description Required
GOOGLE_API_KEY Your Google Custom Search API key Yes
GOOGLE_SEARCH_ENGINE_ID Your Custom Search Engine ID Yes

Claude Desktop Integration

Add this configuration to your Claude Desktop config file (typically located at ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "google-search": {
      "command": "node",
      "args": [
        "/absolute/path/to/mcp-google-custom-search-server/build/index.js"
      ],
      "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id"
      }
    }
  }
}

📖 API Reference

Available Tools

Performs a web search using Google Custom Search API.

Parameters:

  • query (string, required): The search query to execute
  • numResults (number, optional): Number of results to return
    • Default: 5
    • Maximum: 10

Example Response:

Result 1:
Title: Example Search Result
URL: https://example.com
Description: This is an example search result description
---

Result 2:
...
在 GitHub 查看完整 README

安装

npx @modelcontextprotocol/inspector node build/index.js
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "google-search": { "command": "node", "args": [ "/absolute/path/to/mcp-google-custom-search-server/build/index.js" ], "env": { "GOOGLE_API_KEY": "your-api-key", "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id" } } } }