Skip to main content
Glama

MCP Google Custom Search Server

by limklister

MCP Google 自定义搜索服务器

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

🌟 功能

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

📋 先决条件

在开始之前,请确保您已:

  1. 启用了自定义搜索 API 的 Google Cloud 项目
  2. 自定义搜索引擎 ID
  3. 当地发展要求:
    • Node.js(v18 或更高版本)
    • npm(Node.js 附带)

🚀 快速入门

  1. 克隆存储库:
    git clone https://github.com/yourusername/mcp-google-custom-search-server.git cd mcp-google-custom-search-server
  2. 安装依赖项:
    npm install
  3. 创建 .env 文件:
    GOOGLE_API_KEY=your-api-key GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id
  4. 构建服务器:
    npm run build
  5. 启动服务器:
    npm start

🔧 配置

环境变量

多变的描述必需的
GOOGLE_API_KEY您的 Google 自定义搜索 API 密钥是的
GOOGLE_SEARCH_ENGINE_ID您的自定义搜索引擎 ID是的

Claude 桌面集成

将此配置添加到您的 Claude Desktop 配置文件(通常位于~/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 参考

可用工具

搜索

使用 Google 自定义搜索 API 执行网络搜索。

参数:

  • query (字符串,必需):要执行的搜索查询
  • numResults (数字,可选):要返回的结果数
    • 默认值:5
    • 最大:10

响应示例:

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

🛠️ 开发

项目结构

mcp-google-custom-search-server/ ├── src/ │ └── index.ts # Main server implementation ├── build/ # Compiled JavaScript output ├── .env # Environment variables ├── package.json # Project dependencies and scripts ├── tsconfig.json # TypeScript configuration └── README.md # Project documentation

可用脚本

  • npm run build :将 TypeScript 编译为 JavaScript
  • npm start :启动 MCP 服务器
  • npm run dev :用于开发的监视模式

测试

  1. 使用 MCP 检查器:
    npx @modelcontextprotocol/inspector node build/index.js
  2. 使用示例查询进行手动测试:
    # After starting the server {"jsonrpc":"2.0","id":1,"method":"callTool","params":{"name":"search","arguments":{"query":"example search"}}}

📝 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

🙏 致谢

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Tools

模型上下文协议服务器使 LLM 能够通过标准化界面使用 Google 的自定义搜索 API 执行网络搜索。

  1. 🌟 功能
    1. 📋 先决条件
      1. 🚀 快速入门
        1. 🔧 配置
          1. 环境变量
          2. Claude 桌面集成
        2. 📖 API 参考
          1. 可用工具
        3. 🛠️ 开发
          1. 项目结构
          2. 可用脚本
          3. 测试
        4. 📝 许可证
          1. 🙏 致谢

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              Provides web search capabilities using Google Custom Search API, enabling users to perform searches through a Model Context Protocol server.
              Last updated -
              2
              209
              17
              JavaScript
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that enables LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and various API operations including record management.
              Last updated -
              10
              77
              Python
              MIT License
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that provides LLMs with access to Valyu's knowledge retrieval and feedback APIs for searching proprietary/web sources and submitting transaction feedback.
              Last updated -
              2
              TypeScript
              MIT License
              • Linux
              • Apple
            • -
              security
              F
              license
              -
              quality
              A Model Context Protocol server that enables Claude to perform Google Custom Search operations by connecting to Google's search API.
              Last updated -
              Python
              • Linux

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/limklister/mcp-google-custom-search-server'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server