返回 MCP 目录
public公开dns本地运行

google-search-server

一个提供Google自定义搜索功能的MCP服务器,可通过Smithery自动安装或手动配置部署。

article

README

🚀 谷歌搜索 MCP 服务器

一个提供谷歌自定义搜索功能的模型上下文协议(MCP)服务器,借助该服务器可方便地使用谷歌自定义搜索服务。

🚀 快速开始

本服务器可提供谷歌自定义搜索功能,你可以按照以下步骤进行安装、配置和使用。

📦 安装指南

通过 Smithery 自动安装

要通过 Smithery 自动为 Claude Desktop 安装 google-search-mcp-server,可执行以下命令:

npx -y @smithery/cli install @gradusnikov/google-search-mcp-server --client claude

手动安装

  1. 克隆仓库:
git clone https://github.com/gradusnikov/google-search-mpc-server.git
cd google-search-mpc-server
  1. 安装依赖项:
pip install fastmcp google-api-python-client python-dotenv

🔧 配置

在项目根目录中创建一个 .env 文件,包含以下变量:

GOOGLE_API_KEY=你的谷歌 API 密钥
GOOGLE_CSE_ID=你的自定义搜索引擎 ID

获取这些凭证的方法:

  1. 在 Google Cloud 创建一个新项目并启用自定义搜索 API。
  2. 从 Google Cloud 控制台生成 API 密钥。
  3. 在 https://cse.google.com/cse/all 创建一个 Custom Search Engine 并获取其 ID。

💻 使用示例

基础用法

使用 MCP 启动服务器:

mcp run google_search_mcp_server.py

高级用法

在 Claude Desktop 应用的 CLAUDE_DIRECTORY/claude_desktop_config.json 中添加该服务器。例如,如果你使用的是 Windows Subsystem for Linux (WSL),配置可能如下所示:

"google-search": {
            "command": "wsl.exe",
            "args": [
                "bash",
                "-c",
                "source /home/[user]/anaconda3/etc/profile.d/conda.sh && conda activate mcp && /home/[user]/anaconda3/bin/mcp run /home/[user]/google-search-mpc-server/google_search_mcp_server.py"
            ]
        },
help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端