关于 searchapi-mcp-server
searchapi-mcp-server 通过 SearchApi.io 为 LLM 客户端提供 Google 搜索、购物、职位和 YouTube 搜索。它将结果整理为精简的结构化文本,并在可用时优先呈现直接答案。
主要功能
- 01Google 网页搜索
- 02Google 购物搜索
- 03Google 职位搜索
- 04YouTube 搜索
- 05精简的结构化文本结果
适用场景
- 01查找问题相关的网页结果
- 02比较商品列表
- 03按地点搜索职位
- 04查找相关 YouTube 视频
MCP 相关
向 MCP 客户端提供四种由 SearchApi.io 支持的搜索工具:Google 搜索、Google 购物、Google 职位和 YouTube 搜索。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
4收录的工具列表 · 更新于 2 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| q | string | 是 | 搜索查询 |
| gl | string | 否 | 用于本地化结果的两位国家代码(例如 us、sa) |
| hl | string | 否 | 界面语言代码(例如 en、ar、zh-CN) |
| num | integer | 否 | 要返回的自然搜索结果数量(1–20,默认值为 10) |
详细介绍
searchapi-mcp-server
npx @ahmednsh/searchapi-mcp-server
将 SearchApi.io 封装为四种工具的 MCP 服务:Google 搜索、Google 购物、Google 职位和 YouTube 搜索。结果以紧凑的结构化文本返回,专为大模型上下文设计——优先提供直接答案,不返回原始 JSON。
社区项目,与 SearchApi.io 无关联,也未获得其认可。 “SearchApi” 是其各自所有者的商标。
Claude Desktop 配置
在 searchapi.io 获取 API 密钥,然后将服务添加到 claude_desktop_config.json(Windows 上为 %AppData%\Claude\,macOS 上为 ~/Library/Application Support/Claude/):
{
"mcpServers": {
"searchapi": {
"command": "npx",
"args": ["-y", "@ahmednsh/searchapi-mcp-server"],
"env": {
"SEARCHAPI_API_KEY": "your-api-key"
}
}
}
}
重启 Claude Desktop。四种工具会显示在“searchapi”服务下。
工具
google_search
q(必填)、num(1–20,默认值为 10)、gl(国家代码,例如 sa)、hl(语言代码,例如 ar)。
只要 Google 返回直接答案功能(答案框、知识图谱、AI 概览),就会将其置于自然搜索结果之前:
Search results for "capital of Saudi Arabia":
---
[Answer box]
Saudi Arabia Capital: Riyadh
---
1. Riyadh
https://en.wikipedia.org/wiki/Riyadh
Riyadh is the capital and largest city of Saudi Arabia. It is also the capital of the Riyadh Province and the centre of the Riyadh Governorate.
2. Riyadh | Population, Climate, Map, History, & Facts
https://www.britannica.com/place/Riyadh
Riyadh is Saudi Arabia's capital and largest city. It became the capital of the Saud dynasty in 1824 and, except for a brief period in the ...
google_shopping
q(必填)、gl(国家代码)、include_links(布尔值,默认值为 false)。
Shopping results for "wireless mouse" (showing 10 of 40):
1. Logitech M220 Silent Wireless Mouse
$13.83 — Walmart — 4.8★ (44,000 reviews)
Free 90-day returns
2. Logitech G305 Lightspeed Wireless Gaming Mouse
$29.99 — Target — 4.6★ (8,100 reviews)
30-day returns
google_jobs
q(必填)、location(例如 "Riyadh, Saudi Arabia")。
Job results for "software engineer" in "Riyadh, Saudi Arabia":
1. Senior Software Engineer - Backend — Delivery Hero
Riyadh Saudi Arabia · via Delivery Hero
No degree mentioned
Apply: https://careers.deliveryhero.com/job/senior-software-engineer-backend-in-riyadh-saudi-arabia-jid-7417
About the opportunity We are looking for a highly talented Senior Backend Engineer to join our Riyadh office. If you are looking for a place where ...
youtube_search
q(必填)。
YouTube results for "model context protocol tutorial":
1. Model Context Protocol Clearly Explained | MCP Beyond the Hype
https://www.youtube.com/watch?v=tzrwxLNHtRY
codebasics ✓ — 557,404 views — 15:04 — 1 year ago
This video contains a very simple explanation of MCP, also known as Model Context Protocol. We will first understand what ...
2. What is MCP? Integrate AI Agents with Databases & APIs
https://www.youtube.com/watch?v=eur8dUO9mvE
IBM Technology ✓ — 684,035 views — 3:46 — 1 year ago
Dive into the world of Model Context Protocol and learn how to seamlessly connect AI agents to databases, APIs, and more.
开发者须知
- 错误语义: 工具执行失败(缺少或无效的密钥、HTTP 429/4xx/5xx、网络错误)时,会返回一条易读消息并设置
isError: true,让客户端和模型能够区分调用失败与搜索内容。“无结果”不是错误——空搜索也算成功,消息会提示模型更换关键词,而不是重试。 google_shopping的include_links默认关闭,因为 Google 购物的商品链接是约 500 个字符的跟踪 URL,指向 Google 而非商家;结果会显示卖家名称。如有需要,请设置include_links: true。- 输出上限: 每次调用最多返回 10 条结果(截断时,标题会显示
showing 10 of N);职位描述会移除 HTML,并截断至 250 个字符。 - 布局:
src/index.ts用于注册工具并与 SearchApi 通信;src/format.ts包含纯粹的响应转文本格式化函数,并在src/format.test.ts中进行单元测试(npm test)。
开发
git clone https://github.com/Ahmednsh/searchapi-mcp-server.git && cd searchapi-mcp-server && npm install && npm run build
npm test
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。