这是一个通过Serper API提供Google搜索功能的模型上下文协议(MCP)服务器,并且配备了一个由AI驱动的深度研究工具。此服务器能够轻松地将搜索和研究功能集成到您的MCP应用程序中。
git clone https://github.com/yourusername/serper-search-server.git
cd serper-search-server
pnpm install
pnpm run build
从Serper.dev获取您的Serper API密钥
在根目录创建一个.env文件:
# 必需
SERPER_API_KEY=your_api_key_here
# 可选 - 高级质量指标配置(默认预配置)
USAGE_METRICS_KEY=your-custom-metrics-key # 可选
USAGE_PROJECT_ID=your-custom-project-id # 可选
METRICS_ENDPOINT=https://your-custom-host.com # 可选
DISABLE_METRICS=false # 不推荐
关于以下内容的详细信息,请参阅TELEMETRY.md:
在您的Claude Desktop配置中添加服务器配置:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"serper-search-server": {
"command": "/path/to/serper-search-server/build/index.js",
"env": {
"SERPER_API_KEY": "your_api_key_here"
}
}
}
}
该服务器提供了一个强大的搜索工具,具有以下参数:
{
"query": string, // 搜索查询
"numResults"?: number, // 结果数量(默认:110,最大:100)
"gl"?: string, // 国家代码(例如:“us”,“uk”)
"hl"?: string, // 语言代码(例如:“en”,“es”)
"autocorrect"?: boolean, // 启用拼写纠正(默认:true)
"type"?: "search" // 搜索类型(更多类型即将推出)
}
对于更全面的研究需求,该服务器提供了一个深度研究工具,执行多步骤研究,具有以下参数:
{
"query": string, // 研究查询或问题
"depth"?: "basic" | "standard" | "deep", // 研究深度(默认:“standard”)
"maxSources"?: number // 包含的最大来源数(默认:10)
}
深度研究工具:
深度级别:
搜索结果包含丰富的数据:
{
"searchParameters": {
"q": "apple inc",
"gl": "us",
"hl": "en",
"autocorrect": true,
"type": "search"
},
"knowledgeGraph": {
"title": "Apple",
"type": "科技公司",
"website": "http://www.apple.com/",
"description": "苹果公司是一家美国跨国科技公司...",
"attributes": {
"总部": "加利福尼亚州库比蒂诺",
"CEO": "蒂姆·库克(2011年8月24日至今)",
"成立日期": "1976年4月1日,加利福尼亚州洛斯阿尔托斯"
}
},
"organic": [
{
"title": "Apple",
"link": "https://www.apple.com/",
"snippet": "发现苹果公司的创新世界...",
"position": 1
}
],
"peopleAlsoAsk": [
{
"question": "苹果公司是什么意思?",
"snippet": "苹果公司,以前称为苹果电脑公司...",
"link": "https://www.britannica.com/topic/Apple-Inc"
}
],
"relatedSearches": [
{
"query": "谁发明了iPhone"
}
]
}
当可用时,包含实体信息:
搜索结果列表包括:
与搜索相关的常见问题:
用户经常进行的相关搜索查询列表。
深度研究工具包括集成的质量指标:
关于收集的用于提高搜索质量的指标的详细信息,请参阅TELEMETRY.md。
欢迎贡献!请随时提交Pull Request。
本项目采用MIT许可证 - 详情请参阅LICENSE文件。