loading…
Search for a command to run...
loading…
An MCP server that enables Claude Code to perform web searches via Bing, read webpage content, and get current time, with a smart search skill for structured mu
An MCP server that enables Claude Code to perform web searches via Bing, read webpage content, and get current time, with a smart search skill for structured multi-source verification.
为 Claude Code 提供网络搜索能力的 MCP Server 和子代理模板。
本项目通过 MCP (Model Context Protocol) 为 Claude Code 提供网络搜索能力。当 Claude Code 需要查询实时信息或获取网络内容时,可以通过本项目进行搜索并返回准确答案。
用户 → Claude Code 主代理 → local-web-search-agent 子代理 → MCP Server → Bing 搜索
↓
Chrome for Testing (页面渲染)
有两种方式可以让你的项目获得网络搜索能力:
这种方式适用于你想在自己的项目中直接使用搜索工具。
安装依赖
cd /path/to/local-web-search-agent
npm install
npm run build
配置 MCP Server
在你的项目目录下创建或编辑 .claude/settings.json:
{
"mcpServers": {
"local-web-search": {
"command": "node",
"args": ["/absolute/path/to/local-web-search-agent/build/index.js"]
}
}
}
使用工具
配置完成后,你可以在 Claude Code 中直接调用以下工具:
web_search_bing: 执行网络搜索read_webpage: 读取网页内容get_current_time: 获取当前时间信息这种方式会让所有项目都能使用网络搜索能力,更方便。
复制子代理模板
将 src/agents/local-web-search-agent.md 复制到全局 agents 目录:
mkdir -p ~/.claude/agents
cp src/agents/local-web-search-agent.md ~/.claude/agents/
在你的项目中配置 MCP Server
在你的项目目录下创建或编辑 .claude/settings.json:
{
"mcpServers": {
"local-web-search": {
"command": "node",
"args": ["/absolute/path/to/local-web-search-agent/build/index.js"]
}
}
}
使用子代理
在 Claude Code 中,当需要网络搜索时:
/agent local-web-search-agent 命令明确指定本项目提供了一个名为 smart-search 的技能,适用于需要高可靠性和结构化结果的搜索场景。
复制技能模板
将 src/skills/smart-search/SKILL.md 复制到全局 skills 目录:
mkdir -p ~/.claude/skills/smart-search
cp src/skills/smart-search/SKILL.md ~/.claude/skills/smart-search/
注意: Skill 的正确目录结构为 ~/.claude/skills/<skill-name>/SKILL.md
在 Claude Code 中使用
当需要进行可靠的信息搜索时:
/smart-search 命令明确指定| 场景 | 示例 |
|---|---|
| 查询软件版本 | "LayaAir 最新版本是多少?" |
| 查找技术文档 | "React 19 的新特性有哪些?" |
| 问题解决方案 | "Python pip 安装错误怎么解决?" |
| 最新动态 | "Claude 4 发布时间" |
智能搜索技能会返回结构化的结果,包括:
使用 Bing 搜索引擎执行网络搜索。
参数:
query (string, 必需): 搜索关键词num (number, 可选): 返回结果数量,默认 10,最大 50useInternational (boolean, 可选): 是否使用 Bing 国际版,默认 false返回:
[
{
"title": "搜索结果标题",
"url": "https://example.com",
"snippet": "搜索结果摘要..."
}
]
访问指定 URL,提取并清洗页面正文内容。
参数:
url (string, 必需): 要读取的网页 URL返回:
{
"title": "网页标题",
"markdown_content": "# 清洗后的 Markdown 内容"
}
获取当前时间信息,包括当前年份、去年年份、前年年份等。用于搜索最新动态时动态获取年份信息。
参数: 无
返回:
{
"currentDateTime": "2026/2/26 10:30:00",
"currentYear": 2026,
"currentMonth": 2,
"currentDay": 26,
"lastYear": 2025,
"yearBeforeLast": 2024,
"isoDate": "2026-02-26T02:30:00.000Z"
}
local-web-search-agent 子代理会自动执行以下步骤:
web_search_bing 进行搜索read_webpage 阅读相关页面你:Python 最新版本是多少?
→ [主代理自动调用 local-web-search-agent]
→ Python 的最新稳定版本是 3.13.0,发布于 2024 年 10 月。
来源:https://www.python.org/downloads/
你:对比一下最近的两款热门轻薄本,给出选购建议。
→ [子代理进行多轮搜索和阅读]
→ [返回对比表格和购买建议]
local-web-search-agent/
├── src/
│ ├── index.ts # MCP Server 入口
│ ├── agents/
│ │ └── local-web-search-agent.md # 子代理模板
│ ├── skills/
│ │ └── smart-search/
│ │ └── SKILL.md # 智能搜索技能
│ └── tools/
│ ├── webSearchBing.ts # Bing 搜索工具
│ ├── readWebpage.ts # 网页读取工具
│ ├── currentTime.ts # 当前时间工具
│ └── cache.ts # 缓存工具
├── build/ # 编译输出目录
├── package.json
└── tsconfig.json
# 安装依赖
npm install
# 开发模式
npm run dev
# 编译
npm run build
# 监听模式编译
npm run watch
CHROME_PATH: Chrome for Testing 可执行文件路径(默认:D:/app/chrome-win64/chrome.exe)本项目主线仅提供本地 Playwright + Bing 搜索路径,强调“本地浏览器 + 人工点击,避免登录外部账号”。
如果你需要基于远程 API 的搜索方案(例如 Tavily),可以使用下面的社区 Fork:
web_search_tavily 工具,使用 Tavily API 进行搜索,需要配置 TAVILY_API_KEY 环境变量。适合需要更快速、稳定的 API 搜索且愿意注册 Tavily 账号的用户。MIT
Run in your terminal:
claude mcp add web-search-agent -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.