返回市场
谷歌搜索MCP服务器

谷歌搜索MCP服务器

作者:gradusnikov6 星标更新:2025-03-07

项目介绍

Google Search MCP 服务器

smithery 徽章

这是一个提供 Google 自定义搜索功能的模型上下文协议(MCP)服务器。

安装

通过 Smithery 安装

要通过 Smithery 自动安装 google-search-mcp-server 到 Claude Desktop:

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=your_google_api_key
GOOGLE_CSE_ID=your_custom_search_engine_id

获取这些凭证的方法:

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

使用方法

使用 MCP 启动服务器:

mcp run google_search_mcp_server.py

或者将服务器添加到 Claude Desktop 应用的 CLAUDE_DIRECTORY/claude_desktop_config.json 中。例如,如果你正在使用 Windows 子系统 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"
            ]
        },