这是一个使用 Google 自定义搜索 API 和网页内容提取功能提供网络搜索能力的模型上下文协议(MCP)服务器。
创建 Google Cloud 项目:
启用自定义搜索 API:
获取 API 密钥:
创建自定义搜索引擎:
安装依赖项:
npm install
构建服务器:
npm run build
开发时自动重建:
npm run watch
使用 Google 自定义搜索 API 执行网络搜索:
从任何网页中提取内容:
要通过 Smithery 自动为 Claude Desktop 安装 Google 自定义搜索服务器:
npx -y @smithery/cli install @adenot/mcp-google-search --client claude
要与 Claude Desktop 一起使用,请使用您的 Google API 凭证添加服务器配置:
在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"google-search": {
"command": "npx",
"args": [
"-y",
"@adenot/mcp-google-search"
],
"env": {
"GOOGLE_API_KEY": "your-api-key-here",
"GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id-here"
}
}
}
}

{
"name": "search",
"arguments": {
"query": "your search query",
"num": 5 // optional, default is 5, max is 10
}
}

{
"name": "read_webpage",
"arguments": {
"url": "https://example.com"
}
}

来自网页阅读器的示例响应:
{
"title": "Example Domain",
"text": "Extracted and cleaned webpage content...",
"url": "https://example.com"
}

由于 MCP 服务器通过 stdio 进行通信,调试可能具有挑战性。我们建议使用 MCP Inspector,它作为包脚本可用:
npm run inspector
Inspector 将提供一个 URL,以便您在浏览器中访问调试工具。