一个提供谷歌自定义搜索功能的模型上下文协议(MCP)服务器,借助该服务器可方便地使用谷歌自定义搜索服务。
本服务器可提供谷歌自定义搜索功能,你可以按照以下步骤进行安装、配置和使用。
要通过 Smithery 自动为 Claude Desktop 安装 google-search-mcp-server,可执行以下命令:
npx -y @smithery/cli install @gradusnikov/google-search-mcp-server --client claude
git clone https://github.com/gradusnikov/google-search-mpc-server.git
cd google-search-mpc-server
pip install fastmcp google-api-python-client python-dotenv
在项目根目录中创建一个 .env 文件,包含以下变量:
GOOGLE_API_KEY=你的谷歌 API 密钥
GOOGLE_CSE_ID=你的自定义搜索引擎 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"
]
},