本项目是一个集成 Google 自定义搜索 JSON API 的 MCP 服务器实现,能够为用户提供强大的网络搜索功能,满足多样化的搜索需求。
若想使用该服务器,你需要先完成 API 密钥和环境变量的配置,然后从本地仓库运行服务器。具体步骤如下:
export GOOGLE_API_KEY="your-api-key"
export GOOGLE_SEARCH_ENGINE_ID="your-search-engine-id"
git clone https://github.com/ayush-rudani/google-search-mcp-server.git
cd google-search-mcp-server
- **安装依赖项**
pnpm install
# 或者
npm install
- **构建项目**
pnpm run build
# 或者
npm run build
- **配置 Claude Desktop**
更新你的 claude_desktop_config.json
:
{
"mcpServers": {
"google-search": {
"command": "/path/to/node", // <--- 在终端运行 `echo "$(which 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"
}
}
}
}
将 /path/to/node
替换为你系统中 Node.js 可执行文件的完整路径。
- 测试服务器
export GOOGLE_API_KEY=你的_api_key_here
export GOOGLE_SEARCH_ENGINE_ID=你的_engine_id_here
node dist/index.js
若要从本地仓库运行该服务器,可按以下步骤操作:
git clone https://github.com/ayush-rudani/google-search-mcp-server.git
cd google-search-mcp-server
pnpm install
# 或者
npm install
pnpm run build
# 或者
npm run build
query
| 字符串 | 是 | 搜索词 |
| num_results
| 数字 | 否 | 结果数量(范围 1 - 10,默认值:5) |
| date_restrict
| 字符串 | 否 | 按日期筛选(例如,“d1”表示过去一天) |
| language
| 字符串 | 否 | 2 字符语言代码(例如,“en”) |
| country
| 字符串 | 否 | 2 字符国家代码(例如,“us”) |
| safe_search
| 字符串 | 否 | 安全级别(“off”,“medium”,“high”) |在运行服务器之前设置这些变量:
export GOOGLE_API_KEY="your-api-key"
export GOOGLE_SEARCH_ENGINE_ID="your-search-engine-id"
git clone https://github.com/ayush-rudani/google-search-mcp-server.git
cd google-search-mcp-server
pnpm install
# 或者
npm install
pnpm run build
# 或者
npm run build
claude_desktop_config.json
:{
"mcpServers": {
"google-search": {
"command": "/path/to/node", // <--- 在终端运行 `echo "$(which 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"
}
}
}
}
将 /path/to/node
替换为你系统中 Node.js 可执行文件的完整路径。
5. 测试服务器
export GOOGLE_API_KEY=你的_api_key_here
export GOOGLE_SEARCH_ENGINE_ID=你的_engine_id_here
node dist/index.js
该服务器默认启用每分钟 10 次请求的速率限制以防止超出 Google 的 API 配额。你可以在代码中调整此设置。
此 MCP 服务器根据 MIT 许可证发布。有关详细信息,请参阅 LICENSE 文件。