serpapi-mcp
A wrapper skill that calls SerpAPI’s MCP server (Model Context Protocol) via the mcporter CLI.
What this skill provides
- - Runs SerpAPI searches from OpenClaw via MCP (HTTP).
- Returns the full SerpAPI JSON to stdout (the primary contract).
- Optionally persists each query + response into Airtable:
- raw JSON (full SerpAPI payload)
- a structured “summary” (Top 10 organics, PAA/Related questions, videos, images, counts, flags)
/serp usage
Treat this skill as providing the /serp command.
Syntax:
Defaults:
- - INLINECODE4
- INLINECODE5
- INLINECODE6
Notes:
- - If you want SERP features such as People also ask (PAA), video packs, knowledge graph, etc., prefer:
-
engine=google
- INLINECODE8
Examples:
- - INLINECODE9
- INLINECODE10
- INLINECODE11
How it works
Main script (prints JSON to stdout):
It calls this MCP tool endpoint:
Optional Airtable logger:
Requirements
1) MCP client (mcporter)
This skill requires mcporter installed on the host.
Install:
Verify:
2) SerpAPI key(s) + failover
You can configure either a single key or a failover pool:
-
SERPAPI_API_KEY
- - Failover pool (comma-separated, tried in order):
- INLINECODE20
Recommended placement (any of these is supported):
-
skills.entries.serpapi-mcp.env.SERPAPI_API_KEY
-
skills.entries.serpapi-mcp.env.SERPAPI_API_KEYS
-
env.vars.SERPAPI_API_KEY
- INLINECODE24
Failover behavior:
- - The script retries with the next key on common quota / auth / rate-limit errors (e.g. 429/401/403, “quota exceeded”, “rate limit”).
- For other errors (e.g. malformed request), it stops early and returns the error.
Optional: store searches/results in Airtable
Enable / disable
Enable logging:
- -
SERP_LOG_AIRTABLE=1 (or true)
You can set this globally in the Gateway env (always on) or per-run when executing the script.
Airtable configuration (Gateway env)
Set these environment variables (do not store secrets in the repo/workspace):
- -
AIRTABLE_TOKEN (Airtable Personal Access Token) - INLINECODE28
- INLINECODE29 (table name or table id)
Write behavior & compatibility
- - Airtable does not auto-create fields.
- The logger is schema-aware:
- It reads the table schema via Airtable Metadata API.
- It only writes fields that already exist in your table (by name).
- It coerces values to the Airtable field type when possible (checkbox/number/text/select/date).
Airtable table schema (recommended)
Field names must match exactly.
Core:
- -
Query → Single line text - INLINECODE31 → Single line text
- INLINECODE32 → Number (integer)
- INLINECODE33 → Single line text
- INLINECODE34 → Date/Time
Provenance:
- -
SerpApiSearchId → Single line text - INLINECODE36 → URL
- INLINECODE37 → URL
Raw payload:
- -
ResultJson → Long text - INLINECODE39 → Checkbox
- (Back-compat: the logger also supports
ResultJsonTruncated if you prefer that name.)
Structured summary:
- -
SummaryJson → Long text - INLINECODE42 → Checkbox
- INLINECODE43 → Long text
- INLINECODE44 → Long text
- INLINECODE45 → Long text
- INLINECODE46 → Long text
- INLINECODE47 → Long text
Flags + counts:
- -
HasAiOverview → Checkbox - INLINECODE49 → Checkbox
- INLINECODE50 → Checkbox
- INLINECODE51 → Number (integer)
- INLINECODE52 → Number (integer)
- INLINECODE53 → Number (integer)
- INLINECODE54 → Number (integer)
- INLINECODE55 → Number (integer)
Airtable size limits
Airtable has per-cell size limits. The logger truncates JSON strings if needed:
- -
AIRTABLE_MAX_JSON_CHARS (default: 90000) - INLINECODE57 (default: 90000)
Output
Returns SerpAPI JSON. Depending on engine and what Google shows, the payload may include keys like:
- - INLINECODE58
- INLINECODE59 / INLINECODE60
- INLINECODE61
- INLINECODE62
- INLINECODE63
- INLINECODE64 / INLINECODE65
- ads blocks (
top_ads, bottom_ads, etc.)
serpapi-mcp
一个通过 mcporter CLI 调用 SerpAPI 的 MCP 服务器(模型上下文协议)的包装技能。
本技能提供的功能
- - 通过 MCP(HTTP)从 OpenClaw 运行 SerpAPI 搜索
- 将完整的 SerpAPI JSON 返回至标准输出(主要约定)
- 可选地将每次查询和响应持久化到 Airtable:
- 原始 JSON(完整的 SerpAPI 负载)
- 结构化“摘要”(前 10 条自然结果、PAA/相关问题、视频、图片、计数、标志)
/serp 用法
将此技能视为提供 /serp 命令。
语法:
- - /serp <查询词>
- /serp <查询词> [引擎] [数量] [模式]
默认值:
- - engine=google_light
- num=5
- mode=compact
注意:
- - 如需获取 SERP 功能,如“其他人还问”(PAA)、视频包、知识图谱等,建议使用:
- engine=google
- mode=complete
示例:
- - /serp site:cnmv.es educación financiera
- /serp AAPL stock google 3 compact
- /serp mortgage pay off vs invest google 10 complete
工作原理
主脚本(将 JSON 打印至标准输出):
- - skills/serpapi-mcp/scripts/serp.sh <查询词> [引擎] [数量] [模式]
它调用以下 MCP 工具端点:
- - https://mcp.serpapi.com/$SERPAPIAPIKEY/mcp.search
可选的 Airtable 日志记录器:
- - skills/serpapi-mcp/scripts/airtable_log.mjs
要求
1) MCP 客户端(mcporter)
此技能需要在主机上安装 mcporter。
安装:
- - npm install -g mcporter
验证:
2) SerpAPI 密钥 + 故障转移
您可以配置单个密钥或故障转移池:
- SERPAPI
APIKEY
- SERPAPI
APIKEYS
推荐配置位置(支持以下任意方式):
- skills.entries.serpapi-mcp.env.SERPAPI
APIKEY
- skills.entries.serpapi-mcp.env.SERPAPI
APIKEYS
- env.vars.SERPAPI
APIKEY
- env.vars.SERPAPI
APIKEYS
故障转移行为:
- - 脚本在遇到常见的配额/认证/速率限制错误(如 429/401/403、“配额超限”、“速率限制”)时,会使用下一个密钥重试。
- 对于其他错误(如格式错误的请求),脚本会提前停止并返回错误。
可选:将搜索/结果存储到 Airtable
启用/禁用
启用日志记录:
- - SERPLOGAIRTABLE=1(或 true)
您可以在网关环境中全局设置(始终启用),或在执行脚本时按运行设置。
Airtable 配置(网关环境)
设置以下环境变量(请勿将密钥存储在仓库/工作区中):
- - AIRTABLETOKEN(Airtable 个人访问令牌)
- AIRTABLEBASEID
- AIRTABLETABLE(表名或表 ID)
写入行为与兼容性
- - Airtable 不会自动创建字段。
- 日志记录器是模式感知的:
- 它通过 Airtable 元数据 API 读取表模式。
- 它只写入表中已存在的字段(按名称匹配)。
- 它尽可能将值强制转换为 Airtable 字段类型(复选框/数字/文本/选择/日期)。
Airtable 表模式(推荐)
字段名称必须完全匹配。
核心字段:
- - Query → 单行文本
- Engine → 单行文本
- Num → 数字(整数)
- Mode → 单行文本
- CreatedAt → 日期/时间
来源信息:
- - SerpApiSearchId → 单行文本
- SerpApiJsonEndpoint → URL
- GoogleUrl → URL
原始负载:
- - ResultJson → 长文本
- ResultJsonTruncatedFlag → 复选框
- (向后兼容:如果您偏好该名称,日志记录器也支持 ResultJsonTruncated。)
结构化摘要:
- - SummaryJson → 长文本
- SummaryJsonTruncated → 复选框
- OrganicTop10Json → 长文本
- RelatedQuestionsTop10Json → 长文本
- ShortVideosTop10Json → 长文本
- VideosTop10Json → 长文本
- ImagesTop10Json → 长文本
标志与计数:
- - HasAiOverview → 复选框
- HasAnswerBox → 复选框
- HasKnowledgeGraph → 复选框
- OrganicCount → 数字(整数)
- RelatedQuestionsCount → 数字(整数)
- ShortVideosCount → 数字(整数)
- VideosCount → 数字(整数)
- ImagesCount → 数字(整数)
Airtable 大小限制
Airtable 对每个单元格有大小限制。日志记录器会在必要时截断 JSON 字符串:
- - AIRTABLEMAXJSONCHARS(默认值:90000)
- AIRTABLEMAXSUMMARYCHARS(默认值:90000)
输出
返回 SerpAPI JSON。根据引擎和 Google 显示的内容,负载可能包含以下键:
- - organicresults
- shortvideos / videosresults
- imagesresults
- relatedquestions
- knowledgegraph
- answerbox / aioverview
- 广告块(topads、bottomads 等)