Built For use with Cline + VS Code!
为与VS Code / Cline / Anthropic一起使用而构建的MCP Server - 启用谷歌搜索和跟踪链接及研究网站的能力
Google 搜索 MCP 服务器快速启动指南
简介
一个为 VS Code/Cline/Claude 设计的 MCP 服务器,提供 Google 搜索功能和网页内容分析工具。
安装步骤
-
克隆并设置环境
git clone https://github.com/your-username/google-search-mcp.git cd google-search-mcp npm install pip install flask google-api-python-client flask-cors beautifulsoup4 trafilatura markdownify npm run build
-
配置 API 凭证
- 方法 1:设置环境变量
GOOGLE_API_KEY
和GOOGLE_SEARCH_ENGINE_ID
- 方法 2:在根目录创建
api-keys.json
{ "api_key": "your-google-api-key", "search_engine_id": "your-custom-search-engine-id" }
- 方法 1:设置环境变量
-
创建启动脚本 (Windows 示例)
# start-python-servers.cmd @echo off echo 正在启动 Google Search MCP 的 Python 服务器... start "Google Search API" cmd /k "python google_search.py" start "Link Viewer" cmd /k "python link_view.py" echo Python 服务器已启动。您可以关闭此窗口。
配置 MCP 设置
Cline (VS Code 扩展)
文件位置: %APPDATA%\CodeUser\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
{
"mcpServers": {
"google-search": {
"command": "C:\\Program Files\\nodejs\\node.exe",
"args": ["C:\\path\\to\\google-search-mcp\\dist\\google-search.js"],
"cwd": "C:\\path\\to\\google-search-mcp",
"env": {
"GOOGLE_API_KEY": "your-google-api-key",
"GOOGLE_SEARCH_ENGINE_ID": "your-custom-search-engine-id"
},
"disabled": false,
"autoApprove": []
}
}
}
Claude 桌面应用程序
文件位置: %APPDATA%\Claude\claude_desktop_config.json
(使用相同的配置格式)
启动服务器
方法 1: 分别启动 (推荐)
start-python-servers.cmd
方法 2: 一键启动
npm run start:all
可用工具
1. google_search
{
"name": "google_search",
"arguments": {
"query": "您的搜索查询",
"num_results": 5,
"date_restrict": "w1",
"language": "en",
"country": "us",
"safe_search": "medium"
}
}
2. extract_webpage_content
{
"name": "extract_webpage_content",
"arguments": {
"url": "https://example.com"
}
}
3. extract_multiple_webpages
{
"name": "extract_multiple_webpages",
"arguments": {
"urls": [
"https://example1.com",
"https://example2.com"
]
}
}
获取 Google API 凭证
- 访问 Google Cloud 控制台
- 创建新项目或选择现有项目
- 启用自定义搜索 API
- 创建 API 密钥
- 访问 自定义搜索引擎 创建搜索引擎
- 获取搜索引擎 ID 并配置到服务器
系统要求
- Node.js (v16+)
- Python (v3.8+)
- Google Cloud Platform 账户
- 自定义搜索引擎 ID
- Google API 密钥