ttttt
一个使用Google自定义搜索API和网页内容提取功能提供网络搜索能力的模型上下文协议服务器。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"google-search": {
"args": [
"-y",
"@adenot/mcp-google-search"
],
"command": "npx",
"env": {
"GOOGLE_API_KEY": "your-api-key-here",
"GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id-here"
}
}
}
}
该服务需要配置环境变量:GOOGLE_API_KEY、GOOGLE_SEARCH_ENGINE_ID
可用工具 (1 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
search 2 个参数 需填 1 项
Perform a web search query
必填参数:query
服务介绍
mcp-google-server 用于 Google 自定义搜索和网页阅读的 MCP 服务器
这是一个使用 Google 自定义搜索 API 和网页内容提取功能提供网络搜索能力的模型上下文协议 (MCP) 服务器。
设置
获取 Google API 密钥和搜索引擎 ID
-
创建一个 Google Cloud 项目:
- 前往 Google Cloud 控制台
- 创建一个新项目或选择一个现有项目
- 为您的项目启用计费
-
启用自定义搜索 API:
- 前往 API 库
- 搜索 "Custom Search API"
- 点击 "启用"
-
获取 API 密钥:
- 前往 凭据
- 点击 "创建凭据" > "API 密钥"
- 复制您的 API 密钥
- (可选)将 API 密钥限制为仅用于自定义搜索 API
-
创建自定义搜索引擎:
- 前往 可编程搜索引擎
- 输入您想要搜索的站点(对于通用网络搜索,请使用 www.google.com)
- 点击 "创建"
- 在下一页,点击 "自定义"
- 在设置中,启用 "搜索整个网络"
- 复制您的搜索引擎 ID (cx)
开发
安装依赖项:
bash
npm install
构建服务器:
bash
npm run build
开发时自动重建:
bash
npm run watch
功能
搜索工具
使用 Google 自定义搜索 API 进行网络搜索:
- 搜索整个网络或特定站点
- 控制结果数量(1-10)
- 获取带有标题、链接和摘要的结构化结果
网页阅读器工具
从任何网页中提取内容:
- 获取并解析网页内容
- 提取页面标题和主要文本
- 通过移除脚本和样式来清理内容
- 返回带有标题、文本和 URL 的结构化数据
安装
通过 Smithery 安装
要通过 Smithery 自动安装适用于 Claude Desktop 的 Google 自定义搜索服务器:
bash
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
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"
}
}
}
}
使用
搜索工具
json
{
"name": "search",
"arguments": {
"query": "您的搜索查询",
"num": 5 // 可选,默认为 5,最大为 10
}
}
网页阅读器工具
json
{
"name": "read_webpage",
"arguments": {
"url": "https://example.com"
}
}
来自网页阅读器的示例响应:
json
{
"title": "Example Domain",
"text": "已提取并清理的网页内容...",
"url": "https://example.com"
}
调试
由于 MCP 服务器通过 stdio 通信,调试可能会比较困难。我们建议使用 MCP Inspector,它作为包脚本可用:
bash
npm run inspector
Inspector 将提供一个 URL,以便您在浏览器中访问调试工具。