Back to MCP directory
publicPublicdnsLocal runtime

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

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client