使用说明
🔍 Serper搜索MCP服务器
为你的AI代理提供真正的谷歌搜索——网络、图片、视频、新闻、购物和地点。
建造于 SMLabs人工智能 · 滑稽012
这有什么作用
此MCP服务器包装 Serper API公司 (谷歌搜索结果)并公开 8搜索工具 任何兼容MCP的AI客户端(Claude、Cursor、Windsurf、KiloCode、n8n等)都可以实时调用。
| 工具 | 你得到了什么 |
|---|---|
search_web |
有机结果+ 知识图谱 + 答案框 +“人们也问”+相关搜索 |
search_images |
图像URL、尺寸、源页面 |
search_videos |
标题、频道、持续时间、链接 |
search_news |
标题、来源、日期——新鲜度过滤 |
search_shopping |
产品、价格、评级、交货信息 |
search_places |
带有地址、电话、工作时间、GPS坐标的本地企业和POI |
deep_research |
多步研究:自动子查询→ 平行搜索→ 法学硕士综合引文报告 |
search_rag_context |
带有元数据的干净分块文本,用于嵌入管道和矢量DB——不需要LLM |
免费开始: Serper每月为您提供2500个免费查询。无需信用卡。
快速开始
选项1-npx(零安装)
{
"mcpServers": {
"serper-search": {
"command": "npx",
"args": ["-y", "serper-search-mcp"],
"env": {
"SERPER_API_KEY": "${SERPER_API_KEY}",
"GEMINI_API_KEY": "${GEMINI_API_KEY}"
}
}
}
}
将此添加到MCP客户端配置(下面列出的路径),然后重新启动。
选项2-Docker
{
"mcpServers": {
"serper-search": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "SERPER_API_KEY", "-e", "GEMINI_API_KEY", "smjahid/server-serper-search:3"],
"env": {
"SERPER_API_KEY": "your_key_here",
"GEMINI_API_KEY": "your_gemini_key_here"
}
}
}
}
或者直接运行:
docker run -i --rm \
-e SERPER_API_KEY=your_key \
-e GEMINI_API_KEY=your_gemini_key \
smjahid/server-serper-search:3
选项3——本地克隆
git clone https://github.com/smjahid012/serper-search-mcp-server.git
cd serper-search-mcp-server
npm install
export SERPER_API_KEY="your_key"
export GEMINI_API_KEY="your_gemini_key"
node index.js
💡 人工智能驱动的研究是免费的。
deep_research默认情况下使用Gemini的免费层。集GEMINI_API_KEY上面解锁它。
配置文件位置
| 客户端 | 配置路径 |
|---|---|
| 克劳德台式机(Mac) | ~/Library/Application Support/Claude/claude_desktop_config.json |
| 克劳德桌面(Win) | %APPDATA%\Claude\claude_desktop_config.json |
| 光标 | ~/.cursor/mcp.json |
| 帆板运动 | ~/.codeium/windsurf/mcp_config.json |
| Kilo代码 | ~/.config/kilo/kilo.json (全球)或 <project>/kilo.json (项目) |
| n8n | MCP客户端节点→ 服务器URL |
工具参考
search_web
谷歌网络搜索,包含完整的SERP细分。
{
"query": "best mechanical keyboards 2025", // required
"num_results": 10, // 1–20, default 10
"country": "US", // ISO 3166-1 alpha-2
"search_lang": "en", // language code
"freshness": "pw", // "pd" day · "pw" week · "pm" month · "py" year
"safesearch": "moderate",// "off" · "moderate" · "strict"
"autocorrect": true,
"summary": false, // Serper AI summary
"page": 1 // pagination
}
答复包括:
- 🎯 答案框 --可用时直接回答
- 🧠 知识图谱 --实体信息(类型、描述、评级、网站、属性)
- 🌐 有机结果 --标题、URL、代码段、站点链接、日期
- 💬 人们也问 --最多4个后续问题及其答案
- 🔗 相关搜索 --最多6条建议
search_images
{
"query": "minimalist desk setup",
"num_results": 10,
"country": "US",
"safesearch": "moderate"
}
返回:图像URL、缩略图、尺寸(宽×高)、源域、源页面URL。
search_videos
{
"query": "react server components tutorial",
"num_results": 5,
"freshness": "pm"
}
返回:标题、频道、持续时间、发布日期、视频URL。
search_news
{
"query": "OpenAI GPT-5 release",
"num_results": 10,
"freshness": "pd", // default is past day for news
"country": "US"
}
返回:标题、源出版物、日期、代码片段、URL。
search_shopping
{
"query": "Sony WH-1000XM5 headphones",
"num_results": 8,
"country": "US"
}
返回:产品名称、价格、卖家、星级+评论数、配送信息、产品URL。
search_places ⭐ 此服务器独有
{
"query": "ramen restaurants in Shibuya Tokyo",
"num_results": 5,
"country": "JP"
}
返回:企业名称、类别、地址、电话、网站、星级+评论数、营业时间、GPS坐标+谷歌地图链接。
示例用例:
- “查找时代广场附近评价最高的咖啡店”
- 德克萨斯州奥斯汀的哪些牙医周日开放
- “列出达卡的共享办公空间”
环境变量
| 变量 | 必填 | 默认 | 描述 |
|---|---|---|---|
SERPER_API_KEY |
✅ | — | 您的Serper API密钥 |
SERPER_MCP_TRANSPORT |
❌ | stdio |
stdio 或 http |
SERPER_MCP_PORT |
❌ | 8080 |
HTTP端口 |
SERPER_MCP_HOST |
❌ | 0.0.0.0 |
HTTP主机 |
SERPER_MCP_LOG_LEVEL |
❌ | info |
记录冗长 |
OPENROUTER_API_KEY |
❌ | — | LLM密钥 deep_research (在openrouter.ai上免费) |
OPENROUTER_MODEL |
❌ | google/gemini-3.1-flash-lite:free |
OpenRouter模型覆盖 |
GEMINI_API_KEY |
❌ | — | LLM密钥 deep_research (免费访问ai.google.dev) |
GEMINI_MODEL |
❌ | gemini-3.1-flash-lite |
Gemini模型超控 |
示例提示
一旦连接到任何MCP客户端:
Search for the latest news about Claude 4 and summarize the key points.
Find me 5 Italian restaurants in Warsaw with their ratings and phone numbers.
What is the current price of the MacBook Pro M4 on Google Shopping?
Search for YouTube tutorials on building agentic AI systems published this month.
Find images of brutalist architecture in Eastern Europe.
deep_research
使用您自己的LLM密钥进行多步骤AI研究。没有LLM数据离开您的环境。
要求: OPENROUTER_API_KEY (免费模特在 openrouter.ai)或 GEMINI_API_KEY (免费) aistudio.google.com)
{
"query": "What are the real-world limitations of RAG systems in production?",
"depth": "standard", // "basic" | "standard" | "deep"
"country": "US"
}
| 深度 | 子查询 | 每个结果 | 最适合 |
|---|---|---|---|
basic |
3 | 3 | 快速概述 |
standard |
5 | 5 | 大多数用例 |
deep |
8 | 7 | 详尽的研究 |
输出: 结构化降价报告,包含内联引用+来源部分。
通过env支持LLM(所有变量记录在 上表):
| 提供者 | 变量 | 默认值 |
|---|---|---|
| OpenRouter | OPENROUTER_API_KEY |
— |
OPENROUTER_MODEL |
google/gemini-3.1-flash-lite:free |
|
| 谷歌双子座 | GEMINI_API_KEY |
— |
GEMINI_MODEL |
gemini-3.1-flash-lite |
search_rag_context
将谷歌搜索结果转化为可嵌入的块。不需要LLM——纯文本处理。
{
"query": "transformer architecture explained",
"num_results": 10,
"max_chunk_words": 200,
"include_paa": true,
"output_format": "json" // "json" or "text"
}
JSON输出 (用于矢量DB摄入):
{
"query": "transformer architecture explained",
"total_sources": 10,
"total_chunks": 24,
"total_words": 4231,
"chunks": [
{
"chunk_index": 0,
"source_index": 1,
"title": "Attention Is All You Need",
"url": "https://arxiv.org/abs/1706.03762",
"domain": "arxiv.org",
"date": "2024-01-15",
"text": "The transformer architecture uses self-attention mechanisms...",
"word_count": 198,
"char_count": 1124
}
]
}
文本输出 (用于直接快速注射):
--- Chunk 1 | Source 1 | arxiv.org | 2024-01-15 ---
Title: Attention Is All You Need
URL: https://arxiv.org/abs/1706.03762
The transformer architecture uses self-attention...
使用案例:
- 输入Chroma、松果体、Qdrant、pgvector
- 使用新的网络数据进行地面提示
- 构建搜索增强RAG管道
建筑
serper-search-mcp-server/
├── index.js ← Zero-build JS entry (npx / Docker)
└── src/
├── index.ts ← TypeScript CLI entry
├── api/
│ ├── SerperAPI.ts ← HTTP client (per-type endpoints)
│ └── LLMClient.ts ← OpenRouter + Gemini client
├── server/
│ └── SerperMCPServer.ts ← MCP Server + tool routing
├── tools/
│ ├── SearchTools.ts ← All 8 tool definitions + validation
│ ├── DeepResearch.ts ← Multi-step research orchestration
│ └── RAGContext.ts ← Chunk + metadata formatter
├── types/
│ └── index.ts ← Full TypeScript types
└── utils/
└── ResultFormatter.ts ← Markdown formatting
双文件设计: index.js 无需任何构建步骤即可运行(非常适合 npx Docker)。TypeScript src/ 树是为想要类型安全和IDE支持的贡献者准备的。
获取Serper API密钥
- 首选 瑟珀·德夫
- 注册(免费-无信用卡)
- 从仪表板复制API密钥
- 你得到 每月2500次免费查询
版本演变
| 功能 | v1.0.0 | v2.0.1 | v3.0.0 |
|---|---|---|---|
| 工具总数 | 5 | 5 | 8 |
search_web |
✅ 仅有机 | ✅ 仅有机 | ✅ + 答案框,知识图谱,PAA,相关 |
search_images |
✅ | ✅ | ✅ + 维度、域 |
search_videos |
✅ | ✅ | ✅ + 日期字段 |
search_news |
✅ | ✅ | ✅ 更清晰的格式 |
search_shopping |
✅ | ✅ | ✅ + 交货、报价 |
search_places |
❌ | ❌ | ✅ 地址、电话、时间、GPS、地图链接 |
deep_research |
❌ | ❌ | ✅ 子查询→ 并行搜索→ 法学硕士报告 |
search_rag_context |
❌ | ❌ | ✅ 分块文本+元数据,JSON/文本输出 |
| API端点 | 全部命中 /search 和 tbm param |
全部命中 /search 和 tbm 参数 |
✅ 正确的每种类型端点 |
| 答案箱/KG/PAA | ❌ | ❌ | ✅ 全SERP提取 |
| 分页 | ❌ | ❌ | ✅ page param |
| 自动校正参数 | ❌ | ❌ | ✅ |
| LLM支持 | ❌ | ❌ | ✅ OpenRouter+Gemini(用户自己的密钥) |
| 无LLM RAG输出 | ❌ | ❌ | ✅ JSON+纯文本 |
| TypeScript类型 | 部分(重 any) |
部分(重 any) |
✅ 每个结果形状的完整类型 |
| MCP SDK版本 | ^0.5.0 | ^0.5.0或^1.0.0 | ^1.0.0 |
| 节点要求 | >=16 | >=16 | >=18(本地 fetch,无轴) |
| HTTP/SSE传输 | ❌ | ✅ | ✅ |
| 码头工人 | ❌ | ✅ | ✅ |
| npx | ❌ | ✅ | ✅ |
| 客户端配置 | 仅限克劳德桌面 | 克劳德桌面+几个 | 克劳德桌面+Cursor+Windsurf+KiloCode+n8n |
| 遥测 | ❌ 无 | ❌ 无 | ❌ 无(有意——隐私获胜) |
更新日志
v3.0.0--地点+深度研究+RAG
- ➕
search_places工具 --有地址、电话、营业时间、GPS的本地企业 - ➕ 知识图谱 网络搜索中的提取
- ➕ 答案框 网络搜索中的提取
- ➕ 人们也问 +网络结果中的相关搜索
- ➕ 分页 支持(
page参数) - ➕
autocorrect网络搜索参数 - 🔧 纠正了每种类型的Serper端点(图像/视频/新闻/购物现在使用专用端点)
- 🔧 所有结果形状的完整TypeScript类型
- ➕
deep_research工具 --LLM合成的多步骤研究(OpenRouter/Gemini) - ➕
search_rag_context工具 --用元数据嵌入就绪块(不需要LLM) - 🔧 节点≥18要求(本地
fetch)
v2.0.1
- HTTP/SSE传输模式
- Docker编写支持
- CLI标志
v1.0.0
- 首次发布:网络、图片、视频、新闻、购物
贡献
欢迎PR和问题。请在进行大更改之前打开一个问题。
git clone https://github.com/smjahid012/serper-search-mcp-server.git
cd serper-search-mcp-server
npm install
export SERPER_API_KEY="your_key"
node index.js # test immediately, no build required
许可证
Apache 2.0——请参阅 许可证
建造于 SMLabs人工智能
如果这为您节省了时间⭐ 在GitHub上帮助其他人找到它。