feat(search): add local brave mcp search skill
This commit is contained in:
3
TOOLS.md
3
TOOLS.md
@@ -56,6 +56,7 @@ Skills are shared. Your setup is yours. Keeping them apart means you can update
|
|||||||
- `http://192.168.153.117:18803`
|
- `http://192.168.153.117:18803`
|
||||||
- API: JSON enabled (`search.formats` includes `html,json`)
|
- API: JSON enabled (`search.formats` includes `html,json`)
|
||||||
- Runtime env: `SEARXNG_URL=http://192.168.153.113:18803` (workspace `.env`)
|
- Runtime env: `SEARXNG_URL=http://192.168.153.113:18803` (workspace `.env`)
|
||||||
|
- Role: preferred local-first search backend
|
||||||
- Smoke test:
|
- Smoke test:
|
||||||
- `skills/searxng-local-search/scripts/smoke.sh openclaw`
|
- `skills/searxng-local-search/scripts/smoke.sh openclaw`
|
||||||
|
|
||||||
@@ -75,7 +76,9 @@ Skills are shared. Your setup is yours. Keeping them apart means you can update
|
|||||||
- URL(s):
|
- URL(s):
|
||||||
- `http://192.168.153.113:18802`
|
- `http://192.168.153.113:18802`
|
||||||
- `http://192.168.153.117:18802`
|
- `http://192.168.153.117:18802`
|
||||||
|
- MCP endpoint: `http://192.168.153.113:18802/mcp`
|
||||||
- Note: Will confirmed Brave search port is `18802` on 2026-03-10.
|
- Note: Will confirmed Brave search port is `18802` on 2026-03-10.
|
||||||
|
- Verified 2026-03-10: reachable via `mcporter` as tool `brave_web_search`.
|
||||||
|
|
||||||
### Embeddings (local)
|
### Embeddings (local)
|
||||||
|
|
||||||
|
|||||||
54
skills/brave-mcp-search/SKILL.md
Normal file
54
skills/brave-mcp-search/SKILL.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
name: brave-mcp-search
|
||||||
|
description: Search the web via the local LAN Brave Search MCP service. Use when the user wants a Brave-backed search result set, a second opinion after SearXNG, or when SearXNG is weak/unavailable.
|
||||||
|
metadata:
|
||||||
|
openclaw:
|
||||||
|
requires:
|
||||||
|
bins: ["mcporter", "jq"]
|
||||||
|
emoji: "🦁"
|
||||||
|
---
|
||||||
|
|
||||||
|
# Brave MCP Search
|
||||||
|
|
||||||
|
## Policy
|
||||||
|
|
||||||
|
1. Prefer `searxng-local-search` first for normal web lookups.
|
||||||
|
2. Use this Brave MCP skill when:
|
||||||
|
- the user explicitly asks for Brave,
|
||||||
|
- SearXNG is unavailable,
|
||||||
|
- or SearXNG results look weak and a second opinion would help.
|
||||||
|
3. Label answers clearly as using **Brave MCP**.
|
||||||
|
|
||||||
|
## Endpoint
|
||||||
|
|
||||||
|
Default local endpoint:
|
||||||
|
|
||||||
|
- `http://192.168.153.113:18802/mcp`
|
||||||
|
|
||||||
|
You can override with `BRAVE_MCP_URL`.
|
||||||
|
|
||||||
|
## Quick usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scripts/search.sh "your query"
|
||||||
|
```
|
||||||
|
|
||||||
|
With options:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scripts/search.sh "your query" '{"country":"US","search_lang":"en","ui_lang":"en-US","count":8}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Supported common options:
|
||||||
|
- `country`
|
||||||
|
- `search_lang`
|
||||||
|
- `ui_lang`
|
||||||
|
- `count`
|
||||||
|
- `freshness`
|
||||||
|
- `safesearch`
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- This uses the local Brave MCP service through `mcporter`.
|
||||||
|
- It does not configure OpenClaw's built-in `web_search` provider.
|
||||||
|
- Native `web_fetch` remains the preferred lightweight fetch tool for page reads.
|
||||||
45
skills/brave-mcp-search/scripts/search.sh
Executable file
45
skills/brave-mcp-search/scripts/search.sh
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
URL="${BRAVE_MCP_URL:-http://192.168.153.113:18802/mcp}"
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
echo 'Usage: scripts/search.sh "query" '\''{"count":5}'\''' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
QUERY="$1"
|
||||||
|
OPTS_JSON_RAW="${2:-{}}"
|
||||||
|
OPTS_JSON="$(printf '%s' "$OPTS_JSON_RAW" | jq -c '. // {}')"
|
||||||
|
|
||||||
|
ARGS_JSON="$(jq -cn --arg q "$QUERY" --arg opts "$OPTS_JSON" '
|
||||||
|
($opts | fromjson) as $o |
|
||||||
|
{
|
||||||
|
query: $q,
|
||||||
|
country: ($o.country // "US"),
|
||||||
|
search_lang: ($o.search_lang // "en"),
|
||||||
|
ui_lang: ($o.ui_lang // "en-US"),
|
||||||
|
count: ($o.count // 5),
|
||||||
|
freshness: ($o.freshness // empty),
|
||||||
|
safesearch: ($o.safesearch // empty)
|
||||||
|
}
|
||||||
|
')"
|
||||||
|
|
||||||
|
RAW="$(mcporter call --allow-http "$URL.brave_web_search" --args "$ARGS_JSON" --output json)"
|
||||||
|
|
||||||
|
printf '%s\n' "$RAW" | jq -r '
|
||||||
|
def results:
|
||||||
|
if type=="array" then .
|
||||||
|
elif .content? then
|
||||||
|
([.content[]? | select(.type=="text") | .text | fromjson?] | map(select(. != null)) | .[0])
|
||||||
|
else . end;
|
||||||
|
|
||||||
|
results as $r |
|
||||||
|
if ($r|type) == "array" then
|
||||||
|
("Brave MCP search results (" + (($r|length)|tostring) + ")"),
|
||||||
|
"",
|
||||||
|
($r[] | "- " + (.title // "(untitled)") + "\n " + (.url // "") + (if .description then "\n " + .description else "" end) + "\n")
|
||||||
|
else
|
||||||
|
$r
|
||||||
|
end
|
||||||
|
'
|
||||||
Reference in New Issue
Block a user