Google Search MCP Server

Google Search MCP Server

site icon
2025.04.13 0
TypeScript网页搜索API集成搜索工具
Google Search MCP Server 是一个集成了 Google 自定义搜索 JSON API 的 MCP 服务器实现,提供网页搜索能力。该服务器具备高级过滤功能,可以控制搜索结果的日期、语言、国家和安全搜索级别,并内置速率限制以防止 API 配额耗尽。
View on GitHub

Overview

基本能力

产品定位

Google Search MCP Server 是一个提供网页搜索能力的 MCP 服务器实现,集成了 Google 的自定义搜索 JSON API。

核心功能

  • 网页搜索: 提供全面的查询选项进行 Google 搜索
  • 高级过滤: 可按日期、语言、国家和安全搜索级别控制结果
  • 速率限制: 内置速率限制以防止 API 配额耗尽
  • 结构化结果: 返回格式化的搜索结果,包括标题、URL 和摘要

适用场景

  • 需要集成 Google 搜索功能的应用程序
  • 需要高级搜索过滤选项的项目
  • 需要控制搜索速率以防止 API 配额耗尽的应用

工具列表

  • google_search
  • 使用高级过滤选项执行 Google 搜索
  • 输入参数:
    • query (字符串): 搜索词(必需)
    • num_results (数字, 可选): 结果数量 (1-10, 默认: 5)
    • date_restrict (字符串, 可选): 按日期过滤 (例如 "d1" 表示最近一天)
    • language (字符串, 可选): 2字母语言代码 (例如 "en")
    • country (字符串, 可选): 2字母国家代码 (例如 "us")
    • safe_search (字符串, 可选): 安全级别 ("off", "medium", "high")

常见问题解答

  • 速率限制默认为每分钟 10 个请求,可根据需要调整

使用教程

使用依赖

  1. 需要安装 Node.js 环境
  2. 需要获取 Google API 密钥和搜索引擎 ID

安装教程

  1. 克隆仓库 bash git clone https://github.com/ayush-rudani/google-search-mcp-server.git cd google-search-mcp-server

  2. 安装依赖 bash pnpm install # 或 npm install

  3. 构建项目 bash pnpm run build # 或 npm run build

  4. 配置环境变量 bash export GOOGLE_API_KEY="your-api-key" export GOOGLE_SEARCH_ENGINE_ID="your-search-engine-id"

  5. 配置 Claude Desktop 更新 claude_desktop_config.json 文件: json { "mcpServers": { "google-search": { "command": "/path/to/node", "args": ["/full/path/to/google-search-mcp/index.js"], "env": { "GOOGLE_API_KEY": "your-api-key", "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id" } } } }

调试方式

  1. 设置环境变量 bash export GOOGLE_API_KEY=your_api_key_here export GOOGLE_SEARCH_ENGINE_ID=your_engine_id_here

  2. 运行服务器 bash node dist/index.js

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。